Skip to main content
Experimental API: This API is experimental and subject to change. Endpoints, request/response formats, and behavior may be modified without notice. Some endpoints are maintained for compatibility with local ComfyUI but may have different semantics (e.g., ignored fields).
This page provides complete examples for common Comfy Cloud API operations.
Subscription Required: Running workflows via the API requires an active Comfy Cloud subscription. See pricing plans for details.

Setup

All examples use these common imports and configuration:

Object Info

Retrieve available node definitions. This is useful for understanding what nodes are available and their input/output specifications.

Uploading Inputs

Upload images, masks, or other files for use in workflows.

Direct Upload (Multipart)

Upload Mask

The subfolder parameter is accepted for API compatibility but ignored in cloud storage. All files are stored in a flat, content-addressed namespace.

Running Workflows

Submit a workflow for execution.
Concurrent submissions supported: Depending on your subscription tier, you can submit multiple workflows without waiting for previous jobs to complete. Jobs run in parallel up to your tier’s limit — additional jobs queue automatically. See Parallel Execution for details and concurrency limits.

Submit Workflow

Using Partner Nodes

If your workflow contains Partner Nodes (nodes that call external AI services like Flux Pro, Ideogram, etc.), you must include your Comfy API key in the extra_data field of the request payload.
The ComfyUI frontend automatically packages your API key into extra_data when running workflows in the browser. This section is only relevant when calling the API directly.
Generate your API key at platform.comfy.org. This is the same key used for Cloud API authentication (X-API-Key header). See Getting an API Key for step-by-step instructions.

Modify Workflow Inputs


Checking Job Status

Poll for job completion. Job Status Values: The API returns one of the following status values:

WebSocket for Real-Time Progress

Connect to the WebSocket for real-time execution updates.
The clientId parameter is currently ignored—all connections for a user receive the same messages. Pass a unique clientId for forward compatibility.

WebSocket Message Types

Messages are sent as JSON text frames unless otherwise noted.

Binary Messages (Preview Images)

During image generation, ComfyUI sends binary WebSocket frames containing preview images. These are raw binary data (not JSON): Binary frame formats (all integers are big-endian):
See the OpenAPI Specification for complete schema definitions of each JSON message type.

Downloading Outputs

Retrieve generated files after job completion.

Complete End-to-End Example

Here’s a full example that ties everything together:

Queue Management

Get Queue Status

Cancel a Job

Interrupt Current Execution


Error Handling

HTTP Errors

REST API endpoints return standard HTTP status codes:

Execution Errors

During workflow execution, errors are delivered via the execution_error WebSocket message. The exception_type field identifies the error category: