> ## 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.

# Create a deployment

> Starts a deployment of a cut release in the caller's workspace and returns its id. Async: poll statusUrl until the status is ready or failed. An optional Idempotency-Key header dedupes retries; a retry naming a name other than the one the deployment holds is a 409.
An optional name labels the deployment within its build. Without one, the deployment is named production where its build has no live deployment, and otherwise deployment-N at the lowest N its build has free. A name a live deployment of the same build already holds is a 409 NAME_TAKEN, and a malformed one a 400 INVALID_NAME. A create with no name that concurrent creates in its build keep beating to the default is a 409 NAME_RACE, to send again.




## OpenAPI

````yaml /openapi-deploy.yaml post /v1/deployments
openapi: 3.0.3
info:
  title: Comfy Deploy API
  version: 0.1.0
  description: >
    Deploy takes an immutable release cut by Builder and runs it as a live
    autoscaling serverless endpoint.
servers:
  - url: https://platformapi.comfy.org/deploy
    description: Comfy Developer Platform
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /v1/deployments:
    post:
      summary: Create a deployment
      description: >
        Starts a deployment of a cut release in the caller's workspace and
        returns its id. Async: poll statusUrl until the status is ready or
        failed. An optional Idempotency-Key header dedupes retries; a retry
        naming a name other than the one the deployment holds is a 409.

        An optional name labels the deployment within its build. Without one,
        the deployment is named production where its build has no live
        deployment, and otherwise deployment-N at the lowest N its build has
        free. A name a live deployment of the same build already holds is a 409
        NAME_TAKEN, and a malformed one a 400 INVALID_NAME. A create with no
        name that concurrent creates in its build keep beating to the default is
        a 409 NAME_RACE, to send again.
      operationId: createDeployment
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDeploymentRequest'
      responses:
        '202':
          description: Accepted; poll statusUrl.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateDeploymentResult'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/ConcurrencyLimit'
        '503':
          $ref: '#/components/responses/KeyUnverified'
components:
  schemas:
    CreateDeploymentRequest:
      type: object
      required:
        - computeConfig
        - releaseId
      properties:
        releaseId:
          type: string
          description: The cut release to run.
        computeConfig:
          $ref: '#/components/schemas/ComputeConfig'
        name:
          type: string
          minLength: 1
          maxLength: 40
          pattern: ^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$
          description: >-
            The deployment's name, unique among its build's live deployments: 1
            to 40 of a-z, 0-9 and -, starting and ending with a letter or a
            digit and never with dep-, so no name reads as an id. Omitted,
            production where the build has no live deployment, else deployment-N
            at the lowest free N.
        editor:
          type: boolean
          description: >-
            Whether the deployment keeps a CPU server answering its custom
            nodes' own routes while it is edited in the editor. Omitted, true.
    CreateDeploymentResult:
      type: object
      required:
        - id
        - status
        - statusUrl
      properties:
        id:
          type: string
          description: Deployment id (dep-...).
        name:
          type: string
          nullable: true
          description: >-
            The deployment's name, unique among its build's live deployments;
            null on a deployment created before names until it is given one.
        status:
          $ref: '#/components/schemas/DeploymentStatus'
        statusUrl:
          type: string
    ComputeConfig:
      type: object
      description: >
        The requested serverless shape. The endpoint autoscales between min and
        max workers on demand (min 0 scales to zero when idle). region names
        where the deployment runs, at any level the catalog lists: the endpoint
        and its network volume stay bound to that placement. Changing GPU class
        or region creates a separate copy while preserving the deployment id and
        URL. Deployment reads report serving settings while ready;
        stopped/failed reads report accepted next-start settings when a compute
        request is stored.
      required:
        - gpuClass
        - region
      properties:
        gpuClass:
          type: string
          description: >
            GPU class the deployment runs on, as the catalog publishes it (e.g.
            rtx-pro-6000-server). Creating a deployment accepts a provider's own
            card id too and records the class covering it. Editing one does not
            translate either value: it compares what you send against what the
            deployment stores, so send back the class that deployment reports.
        region:
          type: string
          description: >
            Location the deployment runs in, at any level the catalog lists
            (e.g. north-america, us-central). It is recorded exactly as sent and
            fixes where each copy's models volume is created and staged.
            Changing it prepares a separate copy while preserving the deployment
            id and URL.
        min:
          type: integer
          minimum: 0
          description: Minimum warm workers; 0 scales to zero when idle.
        max:
          type: integer
          minimum: 1
          description: Maximum workers the endpoint scales up to.
        keepWarmSeconds:
          type: integer
          minimum: 30
          maximum: 1200
          description: >
            Seconds a worker stays up after its last job before it is released,
            so a job arriving inside the window meets a warm worker instead of a
            cold start. That idle time is billed. Defaults to 180 when omitted,
            and a read reports 180 for a deployment that never set it. A value
            outside 30 to 1200 is refused with a 400; twenty minutes is the
            longest window every GPU provider can hold. Applied when compute is
            provisioned, so changing it on a ready deployment is refused: edit
            while stopped, or stop and start. On an update, omitting the field
            keeps the stored value.
        startupArgs:
          type: array
          maxItems: 16
          items:
            type: string
            maxLength: 64
          description: >
            Extra ComfyUI command-line flags the worker adds to its main.py
            launch, one token per item (e.g. ["--highvram"] or
            ["--reserve-vram", "2"]). Only the service's allowlist is accepted:
            the VRAM strategy (--gpu-only, --highvram, --lowvram, --novram,
            --reserve-vram N, --vram-headroom N, --disable-smart-memory,
            --async-offload [N], --disable-async-offload, --enable-dynamic-vram,
            --disable-dynamic-vram, --disable-pinned-memory, --fast-disk,
            --mmap-torch-files, --disable-mmap), precision (--force-fp32,
            --force-fp16, --fp32-unet, --fp64-unet, --bf16-unet, --fp16-unet,
            --fp8_e4m3fn-unet, --fp8_e5m2-unet, --fp8_e8m0fnu-unet, --fp16-vae,
            --fp32-vae, --bf16-vae, --cpu-vae, --fp16-text-enc, --fp32-text-enc,
            --bf16-text-enc, --fp8_e4m3fn-text-enc, --fp8_e5m2-text-enc,
            --fp16-intermediates, --force-channels-last), the attention backend
            (--use-pytorch-cross-attention, --use-sage-attention,
            --use-flash-attention, --use-split-cross-attention,
            --use-quad-cross-attention, --disable-xformers,
            --force-upcast-attention, --dont-upcast-attention), the node cache
            (--cache-classic, --cache-none, --cache-lru N, --cache-ram [GB
            [GB]]) and performance (--fast [features], --deterministic,
            --cuda-malloc, --disable-cuda-malloc, --disable-cuda-graphs).
            Anything else, including a flag that changes where ComfyUI listens
            or reads files, is refused with a 400 naming the token. Values are
            checked too: gigabyte amounts (--reserve-vram, --vram-headroom,
            --cache-ram) are decimal numbers, counts (--cache-lru,
            --async-offload) are whole numbers, and --fast takes ComfyUI's
            feature names. The field is accepted only where the environment has
            enabled it, once the worker that reads it is live. The flag must
            exist in the build's own ComfyUI version, or the worker fails to
            boot and the deployment fails; ComfyUI's own error is then readable
            from GET /v1/deployments/{id}/logs. Applied when compute is
            provisioned, so changing it on a ready deployment is refused: edit
            while stopped, or stop and start. On an update, omitting the field
            keeps the stored flags and an empty array clears them.
    DeploymentStatus:
      type: string
      description: >-
        Lifecycle state. unhealthy is a recoverable post-ready state: the
        deployment was serving but its endpoint degraded or vanished, and the
        control plane will move it back to ready if it recovers. stop_failed
        means a stop ran but could not release the compute, so the deployment
        may still be holding (and billing for) its endpoint; it is not terminal,
        and stopping it again retries the release. stopped and failed are
        terminal.
      enum:
        - queued
        - provisioning
        - starting
        - ready
        - unhealthy
        - stopping
        - stop_failed
        - stopped
        - failed
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Machine-readable error code.
        message:
          type: string
          description: Human-readable detail.
    PaymentRequiredError:
      type: object
      description: >
        A 402 body. error is always PAYMENT_REQUIRED; reason says which gate
        refused, because the two are acted on differently and a status alone
        cannot tell them apart.
      required:
        - error
        - reason
      properties:
        error:
          type: string
          description: Machine-readable error code. Always PAYMENT_REQUIRED.
        message:
          type: string
          description: Human-readable detail.
        reason:
          type: string
          description: >
            no_credit_balance: the workspace has neither an active subscription
            nor a positive credit balance, so subscribing or topping up clears
            it. spend_blocked: the spend gate refused this workspace -- a manual
            block or an exhausted workspace/project/user spend cap -- which
            topping up alone may not clear. capacity_limit: a compute move would
            exceed the workspace deployment or worker limit.
          enum:
            - no_credit_balance
            - spend_blocked
            - capacity_limit
  responses:
    BadRequest:
      description: >
        Invalid request (INVALID_REQUEST), or RELEASE_AND_SOURCE_BOTH when an
        update names both a release and a source deployment.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid token (UNAUTHORIZED)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    PaymentRequired:
      description: >
        The request was refused on billing grounds (PAYMENT_REQUIRED). Two
        different gates answer with this status, so the body carries a reason
        naming which one.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PaymentRequiredError'
    Forbidden:
      description: >
        Caller's workspace does not own the resource (FORBIDDEN), or an API key
        was refused because its user may not use it, its workspace was deleted
        or blocked, or its account is on the free tier or is being deleted. The
        message says which.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: >
        Unknown id, or not in the caller's workspace (NOT_FOUND). An API key
        also gets this when its workspace no longer exists or its user is no
        longer a member.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Conflict:
      description: >
        The resource's current state forbids this request. The body's error
        names which state: CONFLICT, MODEL_STORAGE_EXCEEDED when the release's
        models need more storage than the deployment can be given,
        RELEASE_DELETED when the release the request names has been deleted,
        STALE_REVISION when another change moved the deployment past the
        revision an update was asked against, PENDING_UPDATE_EXISTS while
        another update waits, NO_EARLIER_REVISION when a deployment at revision
        1 is rolled back, CURRENT_RELEASE when a request to stop or delete one
        kept release names the release the deployment serves, or one of the
        models route's codes (MODEL_POLICY, MODEL_NAME_TAKEN, DEPLOYMENT_BUSY,
        MODEL_LIST_TOO_LARGE, VOLUME_SHARED).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ConcurrencyLimit:
      description: Workspace concurrency cap reached (CONCURRENCY_LIMIT)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    KeyUnverified:
      description: >
        The request could not be served now (SERVICE_UNAVAILABLE), and the same
        request may succeed if retried. Either a workspace API key could not be
        verified, because the key check gave no answer, or because the service
        was already checking as many keys as it will at once, overall or from
        the caller's address, which carries Retry-After; or the request ran past
        the service's request deadline, 30 seconds by default and 120 for a
        model add, and was cut off; or a model add could not read another
        deployment's storage to check which disk it mounts. The body's message
        says which.
      headers:
        Retry-After:
          description: >
            Seconds to wait before retrying; sent when the service refused the
            key check because too many were in flight.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: A workspace-scoped Cloud JWT.
    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, and a value that is not a key's shape is
        401. A refused key answers 401, 403 or 404 with its message; a 503 means
        the key could not be checked right now, so retry.

````

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