You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, I want to build a GUI using Vue, that grabs images created in input or output folders, and then lets the users call the API by filling out JSON templates that use the assets already in the comfyUI library.
Say, for example, you want to upscale an image, and you may want to use different models to do the upscale. The GUI would show you all the models that you can use, polled from the models folder, and it will also give you a gallery of images presented on the client on the client machine (What is the API endpoint that will enable this? Is there an API endpoint for this? Can I add one?) and then when the user selects an image on their client machine, it sends the path of that image where it lives on the server in the API call to the server.
What are the API endpoints that will enable this?
I know that there are api endpoint that give you the models. Even just a simple readme that points to the the file where the API endpoints are defined.
LLAMA 3 generated documentation based on this file:
Endpoints
GET Endpoints
/prompt
Returns the current status of the prompt queue
Response: JSON object with status information
/extensions
Returns a list of extension URLs to import
Response: JSON array of script URLs
/embeddings
Returns a list of embedding names
Response: JSON array of embedding names
/object_info
Returns node object definitions for the graph
Response: JSON object with node definitions
/queue
Returns the current state of the queue
Response: JSON object with running and pending items
/history
Returns the prompt execution history
Response: JSON object with history items
/system_stats
Returns system and device stats
Response: JSON object with system stats
/settings
Returns all setting values for the current user
Response: JSON object with setting values
/settings/:id
Returns a specific setting value for the current user
Response: JSON value of the setting
/userdata/:file
Returns a user data file for the current user
Response: File contents
POST Endpoints
/prompt
Queues a new prompt
Request Body: JSON object with prompt data
Response: JSON object with queue status
/interrupt
Interrupts the execution of the running prompt
Response: JSON object with interrupt status
/users
Creates a new user
Request Body: JSON object with username
Response: JSON object with user data
/settings
Stores a dictionary of settings for the current user
Request Body: JSON object with setting values
Response: JSON object with setting values
/settings/:id
Stores a specific setting value for the current user
Request Body: JSON value of the setting
Response: JSON object with setting value
/userdata/:file
Stores a user data file for the current user
Request Body: File contents
Response: JSON object with file upload status
DELETE Endpoints
/queue/:id
Deletes an item from the queue
Response: JSON object with delete status
/history/:id
Deletes an item from the history
Response: JSON object with delete status
Note that this documentation only covers the endpoints and methods defined in the provided JavaScript file. There may be additional endpoints or methods not included in this documentation.
Reacted by SMohsenM, infinite, Johnson A, c0pper, spieter, Ryo, FedeCastanares-superreal, Unirion, furkancoskun, Adam Burrough and 22 more
Is there proper documentation with all recorded endpoints and info about them? I want to use img2img, but not sure what's the right endpoint to upload the images.
Is there proper documentation with all recorded endpoints and info about them? I want to use img2img, but not sure what's the right endpoint to upload the images.
I have summarized my learnings here in COMFYUI_API.md π₯³
The above repo also has a simple combined python script to test the major API endpoints (the ones that are not implemented in the python script are marked accordingly in the API doc).
The diff between this script and the other example scripts is that mine has a good verbose of execution states and flow steps (based on websocket info).
This helped me to put everything together and thus I'm sharing it with the world hoping this would help others too.
One key think I found missing was the API interaction sequence diagram.
So, I created that too and added that in my API doc.
The mermaid diagram is there but you can also check it out here (for any corrections)
What i am doing is , parsing the JSON of orignal workflow, with object_info and trying to use connecitons nodes and build the workflow which can be send to prompt endpoint,
But this code of making prompt is not that great some how its as below ::
Problem is for now its working for Loras simple thats it, but cant work for any other lie if i have ipadapter or in middle i muted the workflow etc.
Do you know how comfyUI does that ? or how I can do it ?? its in kotlin code.
private fun analyzeWorkflowForAPIPrompt(uiWorkflow: UiWorkflow): Pair<Set<String>, Map<String, Map<Int, Pair<String, Int>>>> {
// Set of nodes that will be excluded from the API prompt (only bypassed/muted nodes)
val excludedNodes = mutableSetOf<String>()
// Identify nodes to exclude based solely on mode
for (node in uiWorkflow.nodes) {
// Exclude nodes that are bypassed/muted (mode = 4)
if (node.mode == 4) {
excludedNodes.add(node.id)
Log.d(TAG, "Excluding bypassed/muted node ${node.id} (type=${node.type}, mode=${node.mode}) from API prompt")
}
}
// Connection remapping: for each node that gets input from an excluded node,
// remap to get input from the excluded node's input or a suitable alternative.
val connectionRemapping = mutableMapOf<String, MutableMap<Int, Pair<String, Int>>>()
// Build maps for easier analysis
val linkMap = mutableMapOf<Int, UiLink>() // linkId -> UiLink
val nodeInputs = mutableMapOf<String, MutableMap<Int, Int>>() // nodeId -> (slotIndex -> linkId)
val nodeOutputs = mutableMapOf<String, MutableMap<Int, MutableList<Int>>>() // nodeId -> (slotIndex -> list of linkIds)
// Populate linkMap
uiWorkflow.links.forEach { link ->
linkMap[link.id] = link
}
// Populate nodeInputs
uiWorkflow.nodes.forEach { node ->
nodeInputs[node.id] = mutableMapOf()
node.inputs.forEachIndexed { index, input ->
if (input.link != null && !input.link.isJsonNull && input.link.isJsonPrimitive && input.link.asJsonPrimitive.isNumber) {
nodeInputs[node.id]!![index] = input.link.asInt
}
}
}
// Populate nodeOutputs
uiWorkflow.nodes.forEach { node ->
nodeOutputs[node.id] = mutableMapOf()
node.outputs.forEachIndexed { index, output ->
if (output.links != null && output.links.isNotEmpty()) {
nodeOutputs[node.id]!![index] = output.links.toMutableList()
}
}
}
// Process excluded nodes to remap their connections
for (excludedNodeId in excludedNodes) {
// For each output slot of the excluded node, process its links
val excludedNodeOutputMap = nodeOutputs[excludedNodeId] ?: continue
for ((outputSlot, links) in excludedNodeOutputMap) {
for (linkId in links) {
val link = linkMap[linkId] ?: continue
val targetNodeId = link.target_id
val targetSlot = link.target_slot
// Skip if target node is also excluded
if (targetNodeId in excludedNodes) continue
// Get the target node and its input for the target slot
val targetNode = getNodeById(uiWorkflow, targetNodeId) ?: continue
if (targetSlot >= targetNode.inputs.size) continue
val targetInput = targetNode.inputs[targetSlot]
val expectedType = if (!targetInput.type.isJsonNull && targetInput.type.isJsonPrimitive) {
targetInput.type.asString
} else {
""
}
// Special case for muted nodes: skip the connection if no valid input found
if (targetNode.mode == 4) {
// Skip this connection as the target node is muted and the input is required
continue
}
if (targetNode.type == "SaveImage") {
// Special case: For SaveImage nodes, connect to VAEDecode output if possible
val vaeDecodeNode = uiWorkflow.nodes.find { it.type == "VAEDecode" && it.id !in excludedNodes }
if (vaeDecodeNode != null) {
Log.d(TAG, "Remapping SaveImage input: node ${targetNodeId} slot $targetSlot to VAEDecode ${vaeDecodeNode.id} slot 0")
connectionRemapping.getOrPut(targetNodeId) { mutableMapOf() }[targetSlot] = Pair(vaeDecodeNode.id, 0)
}
} else {
// Try to find the appropriate input remap based on type matching
var chosenMapping: Pair<String, Int>? = null
var fallbackMapping: Pair<String, Int>? = null
// Get all candidate inputs from the excluded node
val excludedInputs = nodeInputs[excludedNodeId] ?: continue
for ((inputSlot, candidateLinkId) in excludedInputs) {
val candidateLink = linkMap[candidateLinkId] ?: continue
val candidateSourceNodeId = candidateLink.origin_id
val candidateSourceSlot = candidateLink.origin_slot
// Skip if candidate source is also excluded
if (candidateSourceNodeId in excludedNodes) continue
// Save the first found mapping as a fallback
if (fallbackMapping == null) {
fallbackMapping = Pair(candidateSourceNodeId, candidateSourceSlot)
}
// Try to obtain candidate type from the excluded nodeβs input at the candidate slot
if (inputSlot < targetNode.inputs.size) {
val candidateInput = targetNode.inputs[inputSlot]
val candidateType = if (!candidateInput.type.isJsonNull && candidateInput.type.isJsonPrimitive) {
candidateInput.type.asString
} else {
""
}
if (candidateType == expectedType) {
chosenMapping = Pair(candidateSourceNodeId, candidateSourceSlot)
break
}
}
}
// Apply the chosen mapping or fallback
val mappingToApply = chosenMapping ?: fallbackMapping
if (mappingToApply != null) {
connectionRemapping.getOrPut(targetNodeId) { mutableMapOf() }[targetSlot] = mappingToApply
Log.d(TAG, "Remapped: target node $targetNodeId slot $targetSlot now uses source ${mappingToApply.first} slot ${mappingToApply.second}")
} else {
Log.d(TAG, "Could not find a suitable input remap for node $targetNodeId slot $targetSlot")
}
}
}
}
}
// Return the set of nodes to exclude and the connection remapping
return Pair(excludedNodes, connectionRemapping)
}
What i am doing is , parsing the JSON of orignal workflow, with object_info and trying to use connections nodes and build the workflow which can be send to prompt endpoint,
To understand correctly, you are just trying to parse out prompt values from the json. from CLIP Text Encode Node?
workflow json (full workflow export) or workflow api json (linked)?
@dattazigzag So i am first converting to Object_info
and finding, input output of node and their connections and linearly, sending this data into prompt. but this part of connections etc not quite well.
Maybe create a separate issue.
I'm not clear about your ask on what you are trying to do: why do you want to know, in your words, "... input output of node and their connections " to pass it to prompt? you want to check what nodes are connected to each other, from the json Object? If so, why ?
If you want to update a prompt (text node), you can simply modify the parameters in the object and pass the object as BODY to the/prompt endpoint.
Say, the exported workflow (api) json, has a text node:
"3": {
"inputs": {
"text": " ...",
"clip": [
"1",
1
]
},
"class_type": "CLIPTextEncode",
"_meta": {
"title": "<what ever name you gave to the node>"
}
}
The "3" is not fixed and could be any number based on your workflow ... and you can use the 'title' string as a unique identifier instead of the Node ID. Based on that you can update the 'text' and make a POST with the updated json object as the request's BODY .
Are you looking a generic universal parsing function for any kind of workflow api Json object to parse specific node values?
I'm not sure what you are trying to do. May be take some time to explain better the context and your requirements.
@dattazigzag Sorry for insufficient , requirements.
first my update a prompt (text node), etc task is wroking for eg for simple workflow which contains : checkpoint, lora and and output image , ksampler i am able to parse it even with changes
What i want and what i am facing issue with ?
So i have tons of workflows saved which uses various nodes, for eg some are using face id node, some use reactor face swap, now i am using f5tts node, and many time workflows nodes are muted,by passed (as i am checking it by 4,2 etc)
My logic of parsing to api json flow is not correct
Or in one line
Yes i need unversal function which can parse any workflow json with any nodes or connecitons muted bypassed, any type of complexity into Prompt json !!
They way comfy is doing itself. thank you
An updated reference of the API in the new ComfyUI's electron app (inspired by @DuckyBlender Llama3, this is done by Gemini's long context)
HTTP API endpoints available in the ComfyUI server, based on server.py.
Note: All endpoints are also available with an /api prefix. For example, /prompt can also be accessed at /api/prompt.
WebSocket
GET /ws
Establishes a WebSocket connection for real-time communication between the frontend and backend.
Query Parameters:
clientId (optional): A unique identifier for the client. If provided, the server will try to reuse an existing session.
Communication:
The server sends status updates, execution progress, preview images, and feature flags.
The client can send feature flags upon connection.
JavaScript Client Example:
constserver_address="127.0.0.1:8188";constclient_id="your_client_id_here";// Or generate a UUIDconstws=newWebSocket(`ws://${server_address}/ws?clientId=${client_id}`);ws.onopen=()=>{console.log("WebSocket connection established.");// You can send feature flags or other initial messages here if needed.// ws.send(JSON.stringify({ type: "feature_flags", data: { your_flag: true }}));};ws.onmessage=(event)=>{if(typeofevent.data==="string"){constdata=JSON.parse(event.data);console.log("Received JSON message:",data);// Handle different message typesif(data.type==='status'){console.log("Queue status:",data.data.status.exec_info.queue_remaining);}elseif(data.type==='executing'){console.log("Currently executing node:",data.data.node);}}else{// Handle binary data (like preview images)console.log("Received binary message of size:",event.data.size);}};ws.onerror=(error)=>{console.error("WebSocket error:",error);};ws.onclose=()=>{console.log("WebSocket connection closed.");};
Python Client Example:
importwebsocketimportjsonimportuuidserver_address="127.0.0.1:8188"client_id=str(uuid.uuid4())
defon_message(ws, message):
# The server sends both text and binary messagesifisinstance(message, str):
data=json.loads(message)
# Handle different message typesifdata['type'] =='status':
print(f"Queue remaining: {data['data']['status']['exec_info']['queue_remaining']}")
elifdata['type'] =='executing':
node_id=data['data']['node']
ifnode_idisNone:
print("Execution finished")
else:
print(f"Executing node: {node_id}")
else:
print("Received other message type:", data['type'])
else:
# Handle binary preview imagesprint("Received a binary message (preview image)")
defon_error(ws, error):
print(f"WebSocket Error: {error}")
defon_close(ws, close_status_code, close_msg):
print("### WebSocket closed ###")
defon_open(ws):
print("WebSocket connection opened")
if__name__=="__main__":
ws_url=f"ws://{server_address}/ws?clientId={client_id}"ws=websocket.WebSocketApp(ws_url,
on_open=on_open,
on_message=on_message,
on_error=on_error,
on_close=on_close)
ws.run_forever()
File & Asset Endpoints
GET /
Serves the main index.html file for the ComfyUI frontend.
Response:
Content-Type: text/html
The main HTML page.
GET /embeddings
Retrieves a list of available embedding names.
Example Response:
[
"embedding1",
"embedding2"
]
GET /models
Retrieves a list of available model types (the names of the model folders).
Example Response:
[
"checkpoints",
"loras",
"vae",
"controlnet"
]
GET /models/{folder}
Retrieves a list of available models within a specific folder.
Path Parameters:
folder: The name of the model folder (e.g., checkpoints).
Has anybody had an issue with Python script using a workflow's API.json resulting in the workflow running and generating the proper output, but ended with the workflow hanging up and not seemingly ending? By which I mean the green bar across the top of ComfyUI remains and a "(0%) ??? (100%)" is seen in the far left of the green bar? That's what I'm getting for some reason. While my API call from python works and produces the correct output, I have to re-start comfyui after running the script if I want to run another workflow again (whether manually or through the python script).
Has anybody had an issue with Python script using a workflow's API.json resulting in the workflow running and generating the proper output, but ended with the workflow hanging up and not seemingly ending? By which I mean the green bar across the top of ComfyUI remains and a "(0%) ??? (100%)" is seen in the far left of the green bar? That's what I'm getting for some reason. While my API call from python works and produces the correct output, I have to re-start comfyui after running the script if I want to run another workflow again (whether manually or through the python script).
So,
So what does the log of ComfyUI says?
Do you mean the Comfy Server Hangs (gets blocked) and can't execute any other workflow or workflow call (via API)
May be add eject models and clear cache nodes in your workflow and to be triple sure also call, via api to clear cache
Thanks for the response. The issue was I had one terminal running comfy with its venv, then I had another terminal where I created a venv for my python API script and activated that venv, and then ran the python script from there.
The solution was to activate the venv for comfy in the second terminal and run the python API script.
Thanks for the response. The issue was I had one terminal running comfy with its venv, then I had another terminal where I created a venv for my python API script and activated that venv, and then ran the python script from there.
The solution was to activate the venv for comfy in the second terminal and run the python API script.
Okay, So, both are running now? The comfy server as well as your python script (that uses comfy API and talks to the comfy server) ?
Activity
cornpip commentedon Nov 30, 2023
https://github.com/comfyanonymous/ComfyUI/tree/master/script_examples
DuckyBlender commentedon Mar 16, 2024
Is there going to be more documented API? Two file examples isn't an API documentation
johnbenac commentedon Mar 20, 2024
Yes, I want to build a GUI using Vue, that grabs images created in input or output folders, and then lets the users call the API by filling out JSON templates that use the assets already in the comfyUI library.
Say, for example, you want to upscale an image, and you may want to use different models to do the upscale. The GUI would show you all the models that you can use, polled from the models folder, and it will also give you a gallery of images presented on the client on the client machine (What is the API endpoint that will enable this? Is there an API endpoint for this? Can I add one?) and then when the user selects an image on their client machine, it sends the path of that image where it lives on the server in the API call to the server.
What are the API endpoints that will enable this?
I know that there are api endpoint that give you the models. Even just a simple readme that points to the the file where the API endpoints are defined.
johnbenac commentedon Mar 21, 2024
This file seems somewhat self explanatory:
[ComfyUI/web/scripts
/api.js](https://github.com/comfyanonymous/ComfyUI/blob/master/web/scripts/api.js)
DuckyBlender commentedon Apr 30, 2024
LLAMA 3 generated documentation based on this file:
Endpoints
GET Endpoints
/prompt/extensions/embeddings/object_info/queue/history/system_stats/settings/settings/:id/userdata/:filePOST Endpoints
/prompt/interrupt/users/settings/settings/:id/userdata/:fileDELETE Endpoints
/queue/:id/history/:idNote that this documentation only covers the endpoints and methods defined in the provided JavaScript file. There may be additional endpoints or methods not included in this documentation.
JulianKingman commentedon Jun 19, 2024
Would a PR with API documentation be welcome/accepted?
Spritan commentedon Aug 25, 2024
is there any /health endpint to acertain if my comfyui instance is running
ltdrdata commentedon Aug 25, 2024
You can utilize
/system_stats.TimRutjens04 commentedon Nov 28, 2024
I've found the API code, not much of an addition to the response of @DuckyBlender but it's something I guess, its over here: https://github.com/comfyanonymous/ComfyUI/blob/master/server.py
All code for the endpoints are found here, hope it might help give a little more understanding on how to use them
lim3light commentedon Feb 13, 2025
Is there proper documentation with all recorded endpoints and info about them? I want to use img2img, but not sure what's the right endpoint to upload the images.
christian-byrne commentedon Feb 13, 2025
https://docs.comfy.org/essentials/comms_routes
https://docs.comfy.org/essentials/comfyui-server/comms_messages#built-in-message-types
dattazigzag commentedon Apr 6, 2025
I have summarized my learnings here in COMFYUI_API.md π₯³
The above repo also has a simple combined python script to test the major API endpoints (the ones that are not implemented in the python script are marked accordingly in the API doc).
The diff between this script and the other example scripts is that mine has a good verbose of execution states and flow steps (based on websocket info).
This helped me to put everything together and thus I'm sharing it with the world hoping this would help others too.
One key think I found missing was the
API interaction sequence diagram.So, I created that too and added that in my API doc.
The mermaid diagram is there but you can also check it out here (for any corrections)
saurabhthesuperhero commentedon Apr 8, 2025
@dattazigzag can you help me,,
What i am doing is , parsing the JSON of orignal workflow, with object_info and trying to use connecitons nodes and build the workflow which can be send to prompt endpoint,
But this code of making prompt is not that great some how its as below ::
Problem is for now its working for Loras simple thats it, but cant work for any other lie if i have ipadapter or in middle i muted the workflow etc.
Do you know how comfyUI does that ? or how I can do it ?? its in kotlin code.
dattazigzag commentedon Apr 8, 2025
To understand correctly, you are just trying to parse out prompt values from the json. from
CLIP Text EncodeNode?workflow json (full workflow export) or workflow api json (linked)?
saurabhthesuperhero commentedon Apr 9, 2025
@dattazigzag
So i am first converting to Object_info
and finding, input output of node and their connections and linearly, sending this data into prompt.
but this part of connections etc not quite well.
dattazigzag commentedon Apr 9, 2025
BODYto the/promptendpoint.Say, the exported workflow (api) json, has a text node:
The
"3"is not fixed and could be any number based on your workflow ... and you can use the 'title' string as a unique identifier instead of the Node ID. Based on that you can update the 'text' and make aPOSTwith the updated json object as the request's BODY .Are you looking a generic universal parsing function for any kind of workflow api Json object to parse specific node values?
I'm not sure what you are trying to do. May be take some time to explain better the context and your requirements.
saurabhthesuperhero commentedon Apr 9, 2025
@dattazigzag Sorry for insufficient , requirements.
What i want and what i am facing issue with ?
So i have tons of workflows saved which uses various nodes, for eg some are using face id node, some use reactor face swap, now i am using f5tts node, and many time workflows nodes are muted,by passed (as i am checking it by 4,2 etc)
My logic of parsing to api json flow is not correct
Or in one line
Yes i need unversal function which can parse any workflow json with any nodes or connecitons muted bypassed, any type of complexity into Prompt json !!
They way comfy is doing itself. thank you
hope my requirement is clear
AbrahamN commentedon Aug 14, 2025
An updated reference of the API in the new ComfyUI's electron app (inspired by @DuckyBlender Llama3, this is done by Gemini's long context)
HTTP API endpoints available in the ComfyUI server, based on
server.py.Note: All endpoints are also available with an
/apiprefix. For example,/promptcan also be accessed at/api/prompt.WebSocket
GET /wsEstablishes a WebSocket connection for real-time communication between the frontend and backend.
Query Parameters:
clientId(optional): A unique identifier for the client. If provided, the server will try to reuse an existing session.Communication:
JavaScript Client Example:
Python Client Example:
File & Asset Endpoints
GET /Serves the main
index.htmlfile for the ComfyUI frontend.Content-Type: text/htmlGET /embeddingsRetrieves a list of available embedding names.
GET /modelsRetrieves a list of available model types (the names of the model folders).
GET /models/{folder}Retrieves a list of available models within a specific folder.
folder: The name of the model folder (e.g.,checkpoints)./models/checkpoints):GET /extensionsRetrieves a list of custom frontend extensions.
POST /upload/imageUploads an image to a specified directory.
multipart/form-dataimage: The image file to upload.overwrite(optional): If set totrueor1, overwrites an existing file with the same name.subfolder(optional): The subfolder within thetypedirectory to save the image.type(optional): The directory type. Can beinput,output, ortemp. Defaults toinput.{ "name": "example.png", "subfolder": "optional_subfolder", "type": "input" }POST /upload/maskUploads a mask and applies it as the alpha channel to an existing image.
multipart/form-dataimage: The mask image file.original_ref: A JSON string referencing the original image to apply the mask to./upload/image.{ "name": "masked_image.png", "subfolder": "", "type": "output" }GET /viewRetrieves and displays an image or file from the output, input, or temp directories.
/view?filename=example.png&subfolder=foo&type=outputContent-Type.GET /view_metadata/{folder_name}Retrieves metadata from a
.safetensorsmodel file./view_metadata/checkpoints?filename=model.safetensors{ "ss_sd_model_name": "v1-5-pruned-emaonly", "ss_resolution": "512,512", "ss_clip_skip": "2" }System & Queue Endpoints
GET /system_statsRetrieves statistics about the server's system and GPU devices.
{ "system": { "os": "posix", "ram_total": 67325669376, "ram_free": 58778599424, "comfyui_version": "1.2.3", "python_version": "3.10.9" }, "devices": [ { "name": "NVIDIA GeForce RTX 4090", "type": "cuda", "index": 0, "vram_total": 25757220864, "vram_free": 23358472192, "torch_vram_total": 25757220864, "torch_vram_free": 23358472192 } ] }GET /featuresRetrieves a list of server-side feature flags.
{ "custom_nodes_from_web": true }POST /promptSubmits a workflow (prompt) to the queue for execution.
{ "prompt": { "3": { "class_type": "KSampler", "inputs": { "model": ["4", 0], "positive": ["6", 0], "negative": ["7", 0], "latent_image": ["5", 0], "seed": 8566257, "steps": 20, "cfg": 8, "sampler_name": "euler", "scheduler": "normal", "denoise": 1 } }, "4": { "class_type": "CheckpointLoaderSimple", "inputs": { "ckpt_name": "v1-5-pruned-emaonly.ckpt" } }, "5": { "class_type": "EmptyLatentImage", "inputs": { "width": 512, "height": 512, "batch_size": 1 } }, "6": { "class_type": "CLIPTextEncode", "inputs": { "clip": ["4", 1], "text": "masterpiece, best quality, a friendly robot" } }, "7": { "class_type": "CLIPTextEncode", "inputs": { "clip": ["4", 1], "text": "bad anatomy, worst quality" } }, "8": { "class_type": "VAEDecode", "inputs": { "samples": ["3", 0], "vae": ["4", 2] } }, "9": { "class_type": "SaveImage", "inputs": { "filename_prefix": "ComfyUI", "images": ["8", 0] } } }, "client_id": "your_client_id_here" }{ "prompt_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "number": 42, "node_errors": {} }GET /promptRetrieves the current status of the execution queue.
{ "exec_info": { "queue_remaining": 1 } }GET /queueRetrieves the running and pending items in the prompt queue.
{ "queue_running": [ [ 1, "a1b2c3d4...", {}, { "client_id": "..." } ] ], "queue_pending": [ [ 2, "b2c3d4e5...", {}, { "client_id": "..." } ] ] }POST /queueModifies the prompt queue.
{ "delete": ["a1b2c3d4...", "b2c3d4e5..."] }200 OKPOST /interruptInterrupts the currently executing task.
200 OKPOST /freeFrees up system and/or VRAM.
{ "unload_models": true, "free_memory": true }200 OKHistory Endpoints
GET /historyRetrieves the execution history.
{ "a1b2c3d4-e5f6-7890-1234-567890abcdef": { "prompt": [ 1, "a1b2...", {}, {} ], "outputs": { "9": { "images": [ { "filename": "ComfyUI_00001_.png", "subfolder": "", "type": "output" } ] } } } }GET /history/{prompt_id}Retrieves a specific entry from the execution history.
{ "prompt": [ 1, "a1b2...", {}, {} ], "outputs": { "9": { "images": [ { "filename": "ComfyUI_00001_.png", "subfolder": "", "type": "output" } ] } } }POST /historyModifies the execution history.
{ "clear": true }200 OKNode & Object Info Endpoints
GET /object_infoRetrieves detailed information about all available node classes.
{ "CheckpointLoaderSimple": { "input": { "required": { "ckpt_name": [ [ "model1.safetensors", "model2.ckpt" ], {} ] } }, "output": [ "MODEL", "CLIP", "VAE" ], "output_is_list": [ false, false, false ], "output_name": [ "MODEL", "CLIP", "VAE" ], "name": "CheckpointLoaderSimple", "display_name": "Load Checkpoint", "description": "", "category": "loaders", "output_node": false } }GET /object_info/{node_class}Retrieves detailed information for a single node class.
/object_info/KSampler):{ "KSampler": { "input": { "required": { "model": [ "MODEL", {} ], "seed": [ "INT", { "default": 0, "min": 0, "max": 18446744073709551615 } ], "steps": [ "INT", { "default": 20, "min": 1, "max": 10000 } ], "cfg": [ "FLOAT", { "default": 8, "min": 0, "max": 100 } ], "sampler_name": [ [ "euler", "dpm_fast" ], {} ], "scheduler": [ [ "normal", "karras" ], {} ], "positive": [ "CONDITIONING", {} ], "negative": [ "CONDITIONING", {} ], "latent_image": [ "LATENT", {} ], "denoise": [ "FLOAT", { "default": 1, "min": 0, "max": 1 } ] } }, "output": [ "LATENT" ], "output_is_list": [ false ], "output_name": [ "LATENT" ], "name": "KSampler", "display_name": "KSampler", "description": "", "category": "sampling", "output_node": false } }NorthernNoober commentedon Jan 16, 2026
Has anybody had an issue with Python script using a workflow's API.json resulting in the workflow running and generating the proper output, but ended with the workflow hanging up and not seemingly ending? By which I mean the green bar across the top of ComfyUI remains and a "(0%) ??? (100%)" is seen in the far left of the green bar? That's what I'm getting for some reason. While my API call from python works and produces the correct output, I have to re-start comfyui after running the script if I want to run another workflow again (whether manually or through the python script).
dattazigzag commentedon Jan 17, 2026
So,
So what does the log of ComfyUI says?
Do you mean the Comfy Server Hangs (gets blocked) and can't execute any other workflow or workflow call (via API)
May be add eject models and clear cache nodes in your workflow and to be triple sure also call, via api to clear cache
NorthernNoober commentedon Jan 17, 2026
Thanks for the response. The issue was I had one terminal running comfy with its venv, then I had another terminal where I created a venv for my python API script and activated that venv, and then ran the python script from there.
The solution was to activate the venv for comfy in the second terminal and run the python API script.
dattazigzag commentedon Jan 19, 2026
Okay, So, both are running now? The comfy server as well as your python script (that uses comfy API and talks to the comfy server) ?
NorthernNoober commentedon Jan 19, 2026
Yes, both are running and both are using the comfy venv, and now the comfy API completes without hanging up the workflow.