Skip to main content

Endpoint

Queues a ComfyUI workflow (prompt) for execution. The prompt must be in the API format exported from ComfyUI’s “File → Export (API)” feature.

Request Body

object
required
The workflow definition containing all nodes and their configurations. Each key is a node ID, and the value contains the node’s class type and inputs.
string
Optional custom identifier for the prompt. If not provided, a UUID will be generated automatically.
string
Optional client identifier for tracking execution via WebSocket. Automatically added to extra_data if provided.
number
Optional queue position number. If not provided, the prompt is added to the end of the queue.
boolean
When true, adds the prompt to the front of the queue (high priority). Only works when number is not specified.
object
Additional metadata to store with the prompt execution.
array
Optional array of node IDs to execute. When provided, only these nodes and their dependencies will be executed.

Response

string
Unique identifier for the queued prompt. Use this to track execution status and retrieve results.
number
Queue position number assigned to this prompt.
object
Object containing any validation errors for specific nodes. Empty if validation passed.

Error Response

object
Error information when prompt validation fails.
object
Validation errors for specific nodes in the workflow.

Example Request

Example Response (Success)

Example Response (Error)

Python Example

JavaScript Example

Notes

The prompt object structure depends on your workflow. Export it from ComfyUI using “File → Export (API)” to get the correct format.
When running locally without CORS enabled, requests must come from the same origin (host and port) to prevent CSRF attacks. Use --enable-cors-header to allow cross-origin requests.
Use client_id in combination with the WebSocket API to receive real-time updates about your prompt’s execution status.

See Also