Retrieve ComfyUI API outputs from task history and /view
After execution, identify which nodes produced results and where those results reside. Node IDs, prompt IDs and filenames are different identifiers.
Purpose and scope
After execution, identify which nodes produced results and where those results reside. Node IDs, prompt IDs and filenames are different identifiers.
Source-supported context
Official routes expose history and /view, while executed is a UI-update event. Output structures depend on the actual node rather than one universal fixed field. Source 1 Source 2
Before you start
1. Keep the accepted prompt_id, target instance and authorized access method.
2. Use an output node that saves or returns the data you need.
3. Take filenames and subfolders from the server's task response, not arbitrary user-supplied absolute paths.
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. Wait for a terminal result or query that prompt's history. On failure, report the error instead of interpreting empty outputs as an indefinitely queued task.
Step 2. Traverse actual outputs for supported node types; do not assume a fixed numeric ID always belongs to SaveImage.
Step 3. Preserve filename, subfolder and type in /view requests, encoding them with URLSearchParams rather than manual concatenation.
Step 4. Associate the result with its task and validate response type/length. Explain expired temporary files rather than polling without a bound.
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 query = new URLSearchParams({
filename: item.filename,
subfolder: item.subfolder ?? "",
type: item.type ?? "output",
});
const fileUrl = `${COMFY_BASE_URL}/view?${query}`;
Completion check
The client receives the correct task's artifact with a traceable output node/category, even across concurrent requests.
Limitations and cautions
Video and custom output schemas need explicit handling. A public integration must not permit arbitrary server-file reads through path parameters.
Original sources
- ComfyUI Server API routes — original record checked 2026-09-21.
- ComfyUI execution messages — 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-21