> ## Documentation Index
> Fetch the complete documentation index at: https://docs.comfy.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Read a ComfyUI workflow as a build definition

> Turns a workflow file into the definition it maps to, without writing anything. A workflow is a much poorer input than a Desktop snapshot: it records what a graph refers to, never what was installed. There are no versions in it, no Python, and no pip state, so everything here is a name resolved against something else, and everything that could not be resolved is named in the report rather than dropped.

Both export dialects are accepted, the API format and the UI format, and which one was read is reported. Every distinct node class is looked up against the Comfy Registry to find the pack that provides it. Many classes usually resolve to one pack, and that pack is installed once.

A class from a pack Cloud does not install is missing from the class map. When the UI export stamps such a class with a registry pack (`cnr_id`, read without regard to case), the stamp decides its pack. A class stamped with the id of a pack already going in is attached to that pack without asking the registry. Otherwise the registry's class index is asked about up to three of the pack's stamped classes, and once it names the stamped pack for one, the pack goes in and its other stamped classes follow without being asked about. A stamped pack the registry records under the repository of a pack already going in is attached to that pack rather than installed twice. A stamp nothing confirms leaves its classes in `unresolvedClasses`, or in `uncheckedClasses` when the registry did not answer. The check proves that the file and the index agree, not who wrote the class: the registry lets any publisher list any class name, so a publisher can make its own pack confirm for a name it chose. Packs that entered the definition this way are listed in `packsFromStamps`, and every class a stamp attributed, however it got there, in `classesFromStamps`. The class map never placed those classes, so Comfy Cloud cannot be assumed to have them. A file that stamps many packs has only the first 16 (by registry id) looked up; the classes of the rest are reported in `uncheckedClasses`.

A class the map lacks with no registry stamp, which is every class in an API-format export, is looked up in the registry's class index (the first 16 by name). When the index names a pack already going in, by id or repository, the class is attached to it and listed in `classesFromStamps`. When it names another pack, nothing is added: the class stays in `unresolvedClasses` and its `unknownClasses` entry carries that pack as `suggestedPack`. A class stamped with only a GitHub repository (`aux_id`) counts the index's answer only when it names that repository, and is otherwise offered the repository itself. A class the index gave no answer for (the registry did not reply in time, or the class is past the first 16) is listed in `uncheckedClasses`, since nothing said no pack publishes it. A registry stamp the class index cannot confirm, on a pack the registry has, is offered as that pack. A class that runs only in the browser (KJNodes GetNode and SetNode, Easy-Use getNode and setNode, rgthree's group, label, reroute and bypass helpers) still needs its pack, whose script registers it in the editor: the pack goes in like a mapped class's pack, and the class is listed in `classesFromStamps` when Comfy Cloud does not install that pack. Such a class stamped with another pack follows its stamp instead. When the registry's class index names another pack for the same name (GetNode and SetNode), an unstamped class is placed only in its pack already going in, and is otherwise offered that pack as `suggestedPack` (`browserRegistration`) and stays in `unresolvedClasses`. ComfyUI's own notes, reroute and primitive install nothing and are not reported.

A class Comfy Cloud hides (labelled in Cloud's supported-nodes config and left out of its node list) is not in the class map. Cloud's config names its pack, so the class goes into that pack, stamped or not, and the pack is added when nothing else brought it in. A hidden ComfyUI built-in installs nothing. Either way the class is listed in `classesFromStamps`, since Cloud does not run it.

Two things a workflow cannot supply. It names no version, so a pack is pinned to the registry's newest published release and `pinnedToLatest` says when that happened; the same file resolved weeks apart can therefore differ. It names no model source, only a filename that existed on someone else's disk, so models never enter the definition and are returned in the report for the caller to resolve and add.

A registry that cannot be reached leaves its classes in `uncheckedClasses` rather than in `unresolvedClasses`. Nothing about a network fault says a pack is missing, and reporting one as the other would tell a person to delete nodes that are perfectly fine.

A 400 carries the identifier a caller branches on, never the wording: `INVALID_REQUEST` when no workflow was sent, `INVALID_WORKFLOW` when the payload is not a workflow or holds no nodes, and `WORKFLOW_TOO_LARGE` when it names more node classes than one import may carry.

Use POST /v1/builds/from-workflow to create the build in one call instead.




## OpenAPI

````yaml /openapi-builder.yaml post /v1/workflows/resolve
openapi: 3.0.3
info:
  title: Comfy Builder API
  version: 0.1.0
  description: >
    Builder owns builds (editable environment definitions) and cuts immutable,
    deployable releases that Deploy later runs.
servers:
  - url: https://platformapi.comfy.org/builder
    description: Comfy Developer Platform
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /v1/workflows/resolve:
    post:
      summary: Read a ComfyUI workflow as a build definition
      description: >
        Turns a workflow file into the definition it maps to, without writing
        anything. A workflow is a much poorer input than a Desktop snapshot: it
        records what a graph refers to, never what was installed. There are no
        versions in it, no Python, and no pip state, so everything here is a
        name resolved against something else, and everything that could not be
        resolved is named in the report rather than dropped.


        Both export dialects are accepted, the API format and the UI format, and
        which one was read is reported. Every distinct node class is looked up
        against the Comfy Registry to find the pack that provides it. Many
        classes usually resolve to one pack, and that pack is installed once.


        A class from a pack Cloud does not install is missing from the class
        map. When the UI export stamps such a class with a registry pack
        (`cnr_id`, read without regard to case), the stamp decides its pack. A
        class stamped with the id of a pack already going in is attached to that
        pack without asking the registry. Otherwise the registry's class index
        is asked about up to three of the pack's stamped classes, and once it
        names the stamped pack for one, the pack goes in and its other stamped
        classes follow without being asked about. A stamped pack the registry
        records under the repository of a pack already going in is attached to
        that pack rather than installed twice. A stamp nothing confirms leaves
        its classes in `unresolvedClasses`, or in `uncheckedClasses` when the
        registry did not answer. The check proves that the file and the index
        agree, not who wrote the class: the registry lets any publisher list any
        class name, so a publisher can make its own pack confirm for a name it
        chose. Packs that entered the definition this way are listed in
        `packsFromStamps`, and every class a stamp attributed, however it got
        there, in `classesFromStamps`. The class map never placed those classes,
        so Comfy Cloud cannot be assumed to have them. A file that stamps many
        packs has only the first 16 (by registry id) looked up; the classes of
        the rest are reported in `uncheckedClasses`.


        A class the map lacks with no registry stamp, which is every class in an
        API-format export, is looked up in the registry's class index (the first
        16 by name). When the index names a pack already going in, by id or
        repository, the class is attached to it and listed in
        `classesFromStamps`. When it names another pack, nothing is added: the
        class stays in `unresolvedClasses` and its `unknownClasses` entry
        carries that pack as `suggestedPack`. A class stamped with only a GitHub
        repository (`aux_id`) counts the index's answer only when it names that
        repository, and is otherwise offered the repository itself. A class the
        index gave no answer for (the registry did not reply in time, or the
        class is past the first 16) is listed in `uncheckedClasses`, since
        nothing said no pack publishes it. A registry stamp the class index
        cannot confirm, on a pack the registry has, is offered as that pack. A
        class that runs only in the browser (KJNodes GetNode and SetNode,
        Easy-Use getNode and setNode, rgthree's group, label, reroute and bypass
        helpers) still needs its pack, whose script registers it in the editor:
        the pack goes in like a mapped class's pack, and the class is listed in
        `classesFromStamps` when Comfy Cloud does not install that pack. Such a
        class stamped with another pack follows its stamp instead. When the
        registry's class index names another pack for the same name (GetNode and
        SetNode), an unstamped class is placed only in its pack already going
        in, and is otherwise offered that pack as `suggestedPack`
        (`browserRegistration`) and stays in `unresolvedClasses`. ComfyUI's own
        notes, reroute and primitive install nothing and are not reported.


        A class Comfy Cloud hides (labelled in Cloud's supported-nodes config
        and left out of its node list) is not in the class map. Cloud's config
        names its pack, so the class goes into that pack, stamped or not, and
        the pack is added when nothing else brought it in. A hidden ComfyUI
        built-in installs nothing. Either way the class is listed in
        `classesFromStamps`, since Cloud does not run it.


        Two things a workflow cannot supply. It names no version, so a pack is
        pinned to the registry's newest published release and `pinnedToLatest`
        says when that happened; the same file resolved weeks apart can
        therefore differ. It names no model source, only a filename that existed
        on someone else's disk, so models never enter the definition and are
        returned in the report for the caller to resolve and add.


        A registry that cannot be reached leaves its classes in
        `uncheckedClasses` rather than in `unresolvedClasses`. Nothing about a
        network fault says a pack is missing, and reporting one as the other
        would tell a person to delete nodes that are perfectly fine.


        A 400 carries the identifier a caller branches on, never the wording:
        `INVALID_REQUEST` when no workflow was sent, `INVALID_WORKFLOW` when the
        payload is not a workflow or holds no nodes, and `WORKFLOW_TOO_LARGE`
        when it names more node classes than one import may carry.


        Use POST /v1/builds/from-workflow to create the build in one call
        instead.
      operationId: resolveWorkflow
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkflowResolveRequest'
      responses:
        '200':
          description: >
            The workflow was read. A report naming models is the normal outcome,
            not a failure: resolving them to sources is the caller's next step.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowResolveResult'
        '400':
          $ref: '#/components/responses/BadRequest'
components:
  schemas:
    WorkflowResolveRequest:
      type: object
      required:
        - workflow
      properties:
        workflow:
          $ref: '#/components/schemas/ComfyWorkflow'
    WorkflowResolveResult:
      type: object
      required:
        - definition
        - report
        - format
      properties:
        definition:
          $ref: '#/components/schemas/Definition'
        report:
          $ref: '#/components/schemas/WorkflowImportReport'
        format:
          type: string
          enum:
            - api
            - ui
          description: Which export dialect the file was read as.
    ComfyWorkflow:
      type: object
      description: >
        A ComfyUI workflow, in either export dialect. The API format is a flat
        object of node id to node, each carrying `class_type` and its values
        under `inputs`. The UI format carries a `nodes` array with positional
        `widgets_values` alongside a `links` array, which is what identifies it,
        and may hold reusable groups under `definitions.subgraphs` that are
        expanded when read.


        Read rather than validated field by field: the node classes and model
        filenames are taken out, and everything else is ignored. A payload that
        matches neither dialect is a 400.
      additionalProperties: true
    Definition:
      type: object
      description: >
        The user's environment choices (nodes, models, base version). Free-form
        for MVP, except that a field named like a known one in another case
        (customnodes for customNodes) is rejected: create and update refuse one
        they bring in, and check and cut refuse it wherever it sits. A public
        custom node declares an https github.com repository URL plus an optional
        gitRef (absent means the default branch); a private one references an
        uploaded blobId; exactly one of the two per node. A model declares a
        type (the ComfyUI model folder it lands in, e.g. checkpoints, loras,
        vae) plus exactly one source, a public sourceUri (https) or a private
        blobId, and an optional filename and sha256; the built release records
        each model so it can be placed at deploy time (models are not baked into
        the image). A CivitAI sourceUri is saved without its token query
        parameter and any user:password@ part, since a deployment downloads
        CivitAI links with the platform's own token, so a saved definition can
        read back without them. A CivitAI sourceUri (civitai.com or civitai.red,
        with or without www.) should be a download link
        (https://civitai.com/api/download/models/<versionId>) or a model page
        link (https://civitai.com/models/<modelId>), since a deployment can
        download no other CivitAI link: create and update warn on any other, and
        check and cut refuse it. An optional baseImage names the curated base
        image (the CUDA/Python/torch runtime the build is built on) by id;
        omitted means the default, and an unrecognized id is rejected (only
        images we build are selectable, never an arbitrary ref). pipDependencies
        is a requirements.txt string (one requirement per line). A version pin
        (`numpy<2.5`) is applied as an override in the single dependency
        resolution, so it beats every other declaration of that package; it
        forces a version rather than adding a package, so use it to correct
        versions your nodes already bring in, and the build warns about a pin
        nothing else requires. A direct reference to an https wheel (`nunchaku @
        https://host/nunchaku-1.0.1-cp311-cp311-linux_x86_64.whl`) is instead a
        root of the resolution and adds that package, which is how an engine
        published only as a wheel outside PyPI gets in; an optional `#sha256=`
        fragment on the address is verified at install. Local paths, file: URLs,
        git+ references and addresses carrying credentials are dropped with a
        warning, and so is an address for a package a version pin in the same
        blob also names, whatever markers either line carries, because the pin
        would replace the address in the resolution. modelPolicy,
        partnerNodePolicy and customNodePolicy are allow/deny lists for which
        models, partner nodes and custom nodes the build permits: each is an
        object with a mode of "allowlist" (allow only the list) or "blocklist"
        (allow all except the list) plus a list of string ids. An optional
        uiOrigin string records which client flow authored the definition; the
        platform currently writes "desktop-snapshot" or "comfyui-bundle". It is
        attribution only: stored and read back as sent, never validated, and it
        changes nothing about the build (the worker reports it, truncated to 64
        characters, as ui_origin on its build analytics events).
      additionalProperties: true
    WorkflowImportReport:
      type: object
      description: Everything a workflow could not carry into its definition.
      required:
        - pinnedToLatest
        - comfyVersionRequired
      properties:
        unresolvedClasses:
          type: array
          description: >
            Node classes nothing installable provides and which the file did not
            claim were built in: either no pack claims them, or the pack that
            does publishes nothing to fetch. These are the ones a person has to
            act on: the graph will not run without them.
          items:
            type: string
        uncheckedClasses:
          type: array
          description: >
            Classes the registry never answered about, or was not asked about:
            the classes of stamped packs past the 16 one import looks up,
            unstamped classes past the first 16 sent to the class index, and
            every class the registry would be asked about when no registry is
            configured. Their packs are absent from the definition, and this
            says only that nothing confirmed they are missing, so a registry
            outage cannot read like a clean resolve.
          items:
            type: string
        packsWithoutVersion:
          type: array
          description: >
            Packs the registry knows but publishes no installable version of, by
            name. They are carried by repository instead, so they install from
            source rather than from a pinned release.
          items:
            type: string
        collidingPacks:
          type: array
          description: >
            Packs left out because another pack already claimed the directory
            they would install into. The cut refuses a definition carrying two
            of them, so keeping both would produce a build that cannot be cut.
          items:
            type: string
        models:
          type: array
          description: The model files the workflow names. Never part of the definition.
          items:
            $ref: '#/components/schemas/WorkflowModelNeed'
        unknownClasses:
          type: array
          description: >-
            Classes nothing attributes, with the packs their nearest known class
            names belong to and any `suggestedPack`. The detailed form of
            `unresolvedClasses`.
          items:
            $ref: '#/components/schemas/WorkflowUnknownClass'
        partnerClasses:
          type: object
          additionalProperties:
            type: string
          description: >-
            Classes served by a partner provider, mapped to that provider.
            Nothing to install, named so a caller sees the workflow needs
            partner access.
        comfyVersionRequired:
          type: boolean
          description: >-
            True when `baseComfyVersion` still has to be pinned before a cut. A
            workflow names no ComfyUI version and this service has no list to
            default from, so a fresh import always owes one.
        pinnedToLatest:
          type: boolean
          description: >
            True when any pack was pinned to the registry's newest published
            version. A workflow names no versions, so this is the normal case
            rather than an error, and it is the one way two imports of the same
            file can differ.
        packsFromStamps:
          type: array
          description: >
            Packs in the definition only because the file stamped them on a
            class the class map lacks and the registry's class index named the
            same pack, by name. The class map did not choose them, and the index
            lets any publisher list any class name, so agreement is not proof
            the pack is the one the author had installed.
          items:
            type: string
        classesFromStamps:
          type: array
          description: >
            Classes attributed to a pack only through the file's stamp, by class
            name, sorted: confirmed by the class index, carried along with a
            pack another class confirmed, or attached to a pack already going in
            by id or repository. Also every class with no registry stamp that
            the class index placed in a pack already going in, every class that
            runs only in the browser from a pack Comfy Cloud does not install,
            and every class Comfy Cloud hides, placed in the pack Cloud's config
            names for it, or in none for a ComfyUI built-in. The class map never
            placed them, and the map is what Comfy Cloud installs, so Cloud
            cannot be assumed to have them. They are absent from
            `unresolvedClasses` and `uncheckedClasses`, so a caller deciding
            whether Cloud runs the workflow as it is must read a non-empty list
            as no.
          items:
            type: string
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Machine-readable error code.
        message:
          type: string
          description: Human-readable detail.
    WorkflowModelNeed:
      type: object
      description: >
        One model file the workflow names and the definition cannot carry. A
        definition's model needs exactly one source and a workflow supplies
        neither, so this is handed back for the caller to resolve, typically
        through POST /v1/models/resolve, and save into the definition.
      required:
        - filename
        - status
      properties:
        filename:
          type: string
          description: The basename, which is what a catalog is searched by.
        raw:
          type: string
          description: >-
            The value as the file wrote it, subfolder prefix and all, so a
            person can recognise it even when the catalog cannot.
        directories:
          type: array
          description: >-
            With status matched, the catalog folders holding this exact name.
            Otherwise the Build folders the workflow's own models list names for
            it, else those its loaders read in Cloud's catalog. Absent means no
            folder is known.
          items:
            type: string
        suggestions:
          type: array
          description: >-
            Catalog names this might have meant, closest first. Offered for a
            person to judge, never applied: `v1-5-pruned` and `v2-1-pruned`
            score alike.
          items:
            $ref: '#/components/schemas/WorkflowModelSuggestion'
        status:
          type: string
          enum:
            - matched
            - suggested
            - missing
          description: Which answer this is, so a caller branches on a value.
        usedBy:
          type: array
          description: The node classes that referenced it.
          items:
            type: string
    WorkflowUnknownClass:
      type: object
      description: >-
        A class nothing attributes, with the packs its nearest known class names
        belong to, and the pack the registry or the file points to. A lead,
        never an answer.
      required:
        - classType
        - status
      properties:
        classType:
          type: string
        suggestions:
          type: array
          items:
            $ref: '#/components/schemas/WorkflowClassSuggestion'
        suggestedPack:
          $ref: '#/components/schemas/WorkflowSuggestedPack'
        status:
          type: string
          enum:
            - suggested
            - missing
          description: suggested when `suggestions` or `suggestedPack` holds a lead.
    WorkflowModelSuggestion:
      type: object
      description: One catalog name a model might have meant, and why.
      required:
        - filename
        - score
      properties:
        filename:
          type: string
          description: The catalog's name for it.
        directory:
          type: string
          description: A folder holding it, so a caller can say where it comes from.
        score:
          type: number
          format: double
          description: >-
            Similarity in [0, 1]. Ranks candidates; not confidence that two
            names mean the same weights.
    WorkflowClassSuggestion:
      type: object
      description: One pack offered for an unknown class, and the class that earned it.
      required:
        - packId
        - nearestClass
        - score
      properties:
        packId:
          type: string
        nearestClass:
          type: string
          description: The class in that pack whose name is closest.
        score:
          type: number
          format: double
    WorkflowSuggestedPack:
      type: object
      description: >-
        A pack the registry or the workflow file points to for an unknown class,
        which the definition does not install. The registry lets any publisher
        list any class name (its class index answers GetNode with an unrelated
        pack), so this is offered for a person to add and never added by the
        builder.
      required:
        - source
      properties:
        packId:
          type: string
          description: The registry id. Absent when `source` is `fileRepository`.
        name:
          type: string
          description: The registry's display name, when it has one.
        repository:
          type: string
          description: >-
            The pack's clone URL, shown so a person can see what they would add.
            Absent when the registry records none, or records one that is not an
            https URL.
        source:
          type: string
          enum:
            - classIndex
            - fileStamp
            - fileRepository
            - browserRegistration
          description: >-
            What pointed to the pack. classIndex: the registry's class index
            names it for the class. This is the weakest source: the index names
            whatever pack declared the name, so a generic name such as GetNode
            can name an unrelated pack, and a ComfyUI class newer than the class
            map can be offered one. fileStamp: the file's node names this
            registry pack (`cnr_id`) and the registry has it, but its class
            index does not list the class. fileRepository: the file's node names
            only a GitHub repository (`aux_id`), which the class index does not
            name for the class. browserRegistration: the pack's editor script
            registers the class, which runs only in the browser, but the
            registry's class index names another pack for the same name, so the
            pack is offered rather than added. The list is open: clients must
            accept a value not listed here, and treat it as a lead of unknown
            origin.
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        A workspace-scoped Cloud JWT. A missing or invalid token is 401
        UNAUTHORIZED in the Error body.
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >
        A workspace API key, sent alone. The service checks it on every request
        and acts as the key's user in the key's workspace. A request carrying a
        key and a Bearer token is 400 INVALID_REQUEST, and a value that is not a
        key's shape is 401 UNAUTHORIZED. A refused key answers 401
        (UNAUTHORIZED), 403 (FORBIDDEN), 404 (NOT_FOUND) or 429 (RATE_LIMITED)
        with its message and Retry-After; a 503 (SERVICE_UNAVAILABLE) means the
        key could not be checked right now, so retry. Each refusal answers the
        Error body.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.