ComfyUI Workflow vs API Prompt: What Is the Difference?

Compare a ComfyUI workflow with an API prompt. Learn what the workflow and prompt metadata fields contain and when each representation is useful.
Two representations of one generation process
ComfyUI can represent a generation process as a visual node graph and as an execution-oriented prompt structure. These representations are related, but they are not interchangeable in every context. Knowing the difference helps when you share workflows, automate generation or inspect metadata embedded in output files.
What the workflow field represents
The workflow is designed to restore the visual graph in the ComfyUI frontend. It can include nodes, connections and layout information. This is useful when you want to inspect or edit how a graph is organized. The exact contents depend on the workflow and ComfyUI version.
What the prompt field represents
The API prompt is the execution-oriented structure used when submitting a workflow to a ComfyUI server. It describes nodes and inputs in a form intended for execution. It may not contain the same visual layout information as the frontend workflow. A prompt JSON should not be assumed to recreate the exact canvas arrangement.
Where the data may be stored
ComfyUI documentation describes embedded workflow and prompt fields in supported output formats. For PNG, these are stored in text metadata. Other formats use format-specific metadata locations. Save nodes and configuration affect whether the information is written. Files created with metadata saving disabled cannot be expected to contain the usual fields.
Which one should you use?
Use the workflow representation when you need to reopen and edit the visual graph. Use the API prompt representation when you are working with API execution or automation. Preserve both when your workflow requires both visual editing and programmatic execution.
Limitations and portability
Neither representation automatically includes every external asset. Model files, custom nodes, input images and environment settings may remain outside the metadata. Treat embedded data as untrusted input, inspect unfamiliar nodes and avoid installing unknown custom code simply because a workflow references it.