Skip to main content

ComfyUI API-Workflow Converter

The ComfyUI API-workflow converter translates prompt JSON between the two formats ComfyUI uses: the API format you POST to /prompt, and the canvas workflow format the editor saves and loads. Paste either JSON and get the other, with node positions, links and widget values rebuilt. Conversion runs entirely in your browser; nothing is uploaded.

Input JSON

About the two formats

API format: numeric node ids with class_type and inputs - what you POST to /prompt and what most scripts and API examples use.

Canvas format: nodes + links arrays with positions and widget values - what ComfyUI saves and loads in the editor.

Honest limitation: widget order in the canvas format is not stored per-widget in the API format. This converter emits values in input-key order, which is correct for most standard nodes. If a node shows a shifted widget value after loading, drag the value into the right slot once and re-save. Newer ComfyUI frontends can also load API JSON directly.

How to convert, step by step

API format to canvas workflow

  1. Get the API JSON: enable dev mode in ComfyUI settings, then Workflow > Export (API). Or copy the prompt JSON your script already sends to /prompt.
  2. Paste it into Input JSON above and press Convert to workflow.
  3. Copy the output and save it as a .json file, then load it in ComfyUI via drag and drop or Workflow > Open.
  4. Nodes arrive auto-laid-out in dependency layers. Drag them into a tidy arrangement and re-save.

Canvas workflow to API format

  1. Save your workflow from the editor (Workflow > Save) to get the canvas format JSON.
  2. Paste it and press Convert to API.
  3. POST the result to the /prompt endpoint of your ComfyUI server, or drop it into your script. Linked inputs map exactly.

API format vs canvas workflow format

PropertyAPI / prompt formatCanvas workflow format
Used byscripts, API examples, POST /promptthe ComfyUI editor, save and load
Top levelobject keyed by numeric node idnodes and links arrays plus id counters
Node identityclass_type plus inputstype, id, pos, size, order
Connections[node id, output slot] arrays inside inputslink table with origin and target slots
Widget valuesvalues keyed by input namewidgets_values array, positional
Editor datanonegroups, config, extra, version

Troubleshooting conversion errors

Invalid JSON: the usual causes are single quotes instead of double quotes, trailing commas, or Python literals like True, False and None instead of true, false and null. Export real JSON from ComfyUI or fix the literals and convert again.

Could not detect format: the tool expects an object whose values carry class_type (API format) or an object with a nodes array (canvas format). If your payload is wrapped, for example {"prompt": {...}}, paste the inner object.

Input is already canvas format / already API format: you pressed the button for the wrong direction. The converter auto-detects the input; use the other button.

Widget values look shifted after loading: the API format does not store widget order per node. Values are emitted in input-key order, which is correct for most standard nodes. Drag the stray value into the right slot once and re-save, or load the API JSON directly in a newer ComfyUI frontend.

Missing links after converting to canvas: the prompt JSON references a node id that is not present in the file. Export the complete prompt, not a fragment, so every connection has both endpoints.

Frequently asked questions

What is the difference between the ComfyUI API format and the workflow format?

The API format is a flat object keyed by numeric node ids, each with class_type and inputs. It is what you POST to the /prompt endpoint. The workflow format has nodes and links arrays with positions and widget values, and it is what the ComfyUI editor saves and loads.

How do I export my workflow as API format JSON?

Enable dev mode in the ComfyUI settings, then use Workflow > Export (API). The downloaded file is the prompt JSON that scripts and API examples expect.

Does the converter upload my workflow anywhere?

No. Parsing and conversion run entirely in your browser. Workflows can contain private model paths or API keys, so nothing you paste here leaves your machine.

Why did a node get the wrong widget value after conversion?

The API format does not record widget order per node. The converter emits values in input-key order, which matches most standard nodes. If a custom node orders its widgets differently, drag the value into the right slot once and re-save the workflow.

Can I turn API JSON someone shared back into an editable canvas workflow?

Yes. Paste the API JSON and press Convert to workflow. Nodes are laid out automatically in dependency layers, so you get a connected graph you can rearrange and save from the editor.

Which format should scripts use to queue prompts?

The API format. POST it to /prompt on your ComfyUI server with the client id header your library provides. The canvas format is only for the editor.

Related ComfyUI tools

Debug the sampler settings inside a workflow with the ComfyUI sampler guide.

See every node, link and widget in a workflow file with the ComfyUI workflow inspector.

Compare two workflow revisions field by field with ComfyUI workflow diff.