Reference only

Submit a ComfyUI workflow through its native API and track prompt_id

This guide concerns an instance you own or are authorized to use. ComfyUI's native HTTP API is distinct from this site's knowledge MCP and does not authorize access to third-party services.

Purpose and scope

This guide concerns an instance you own or are authorized to use. ComfyUI's native HTTP API is distinct from this site's knowledge MCP and does not authorize access to third-party services.

Source-supported context

Official routes describe POST /prompt validation and queueing, returning prompt_id or structured errors. Execution messages/history track what happens after acceptance. Source 1 Source 2 Source 3

Before you start

1. Use a workflow that opens and runs on the current instance, exported in API format.

2. Confirm target-server nodes and models instead of assuming they match the local machine.

3. Protect remote access rather than publishing an unrestricted generation endpoint.

Steps and checks

The sequence below is an editorial procedure based on the cited context, not a diagnosis already confirmed for your environment.

Step 1. Export through the native UI and inspect class_type and inputs; UI nodes with positions are not the API prompt structure.

Step 2. Substitute only necessary inputs using the server's real options, keeping source IDs and output slots valid.

Step 3. Send a prompt plus traceable client_id and inspect status, error and node_errors rather than ignoring rejected responses.

Step 4. Save the accepted prompt_id, follow success/error/interruption through WebSocket or history, and prevent retry logic from duplicating queue entries.

Commands and request examples

Use the environment and shell identified above. Paths and variables are examples to adapt; these commands/snippets were not executed for your machine.

const body = { prompt: API_WORKFLOW, client_id: CLIENT_ID };
const response = await fetch(`${COMFY_BASE_URL}/prompt`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify(body),
});
const result = await response.json();
if (!response.ok || !result.prompt_id) {
  throw new Error("Submission failed: inspect redacted error and node_errors");
}

Completion check

Validation succeeds, an ID is returned and the corresponding result is eventually obtained. HTTP 200 or a queue number must not be shown as already generated.

Limitations and cautions

The code is a request-shape example, not a standalone runnable graph. API_WORKFLOW, CLIENT_ID and COMFY_BASE_URL need real values; authentication and bounded network timeouts belong to the deployment.

Original sources

Localization prepared: 2026-09-22. The source-check dates above were inherited from the existing article; this translation does not claim they were all rechecked today. No GPU run, minimum-memory measurement or runtime guarantee is supplied.

Was this page helpful?

Anonymous. Only a yes/no counter is stored; no account, IP address or device details.

Sources & references

Localized from the existing Chinese research draft. Original source-check dates are retained; this translation is not new technical verification or a runtime test.

01ComfyUI Server API routesSource checked: 2026-09-2102ComfyUI execution messagesSource checked: 2026-09-2103ComfyUI execution.py validationSource checked: 2026-09-21

Report an issue · a1e8ee32-ab77-5524-9efb-1380f4cdf725