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
- ComfyUI Server API routes — original record checked 2026-09-21.
- ComfyUI execution messages — original record checked 2026-09-21.
- ComfyUI execution.py validation — original record checked 2026-09-21.
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.
Related troubleshooting and guides
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-21Report an issue · a1e8ee32-ab77-5524-9efb-1380f4cdf725
Related reading
Pages linked to this one by the editors.
Log keyword: prompt_outputs_failed_validation
A rejected request needs structured error inspection. HTTP 400 is not, by itself, evidence of an unstable network and should not trigger endless resubmission.
Log keyword: has no class_type
An API execution node needs class_type. The same missing_node_type category may also report a class that exists in the request but is unknown to the backend, so read message and extra_info together.
Log keyword: execution_error
A connected socket and accepted queue request are not a result. Check client_id, prompt_id, terminal events and history together.
After execution, identify which nodes produced results and where those results reside. Node IDs, prompt IDs and filenames are different identifiers.