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

# Roll a deployment back to an earlier revision's release

> Moves the deployment back to the release an earlier revision ran, the revision before the current one unless toRevision names another, so a second rollback undoes the first. The deployment keeps its id and address, and the new revision records kind rollback and the revision it restored in fromRevision. baseRevision is the revision the caller last read: once another change has moved the deployment past it the answer is a 409 STALE_REVISION, and while an update waits it is a 409 PENDING_UPDATE_EXISTS. A stored next-start compute request returns 409 COMPUTE_INTENT_EXISTS; finish it or edit back to the serving placement. A ready source with a failed compute target can roll back, canceling that failed request. A deployment at revision 1 has nothing to return to, a 409 NO_EARLIER_REVISION; a toRevision that is not an earlier revision is a 400; and a target whose release was deleted is a 409 RELEASE_DELETED. A target whose release is already current answers 200 at the current revision with nothing written. A ready copy of the release becomes current at once, a 200. A stopped or failed copy starts again, and a release whose copy is gone gets a new one, under the same credit and plan checks an update takes (402, 429); the 202 carries the pendingUpdate, of kind rollback, and the deployment moves once that copy is ready. A rollback sent again at the same base answers as the first did.




## OpenAPI

````yaml /openapi-deploy.yaml post /v1/deployments/{id}/rollback
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/{id}/rollback:
    post:
      summary: Roll a deployment back to an earlier revision's release
      description: >
        Moves the deployment back to the release an earlier revision ran, the
        revision before the current one unless toRevision names another, so a
        second rollback undoes the first. The deployment keeps its id and
        address, and the new revision records kind rollback and the revision it
        restored in fromRevision. baseRevision is the revision the caller last
        read: once another change has moved the deployment past it the answer is
        a 409 STALE_REVISION, and while an update waits it is a 409
        PENDING_UPDATE_EXISTS. A stored next-start compute request returns 409
        COMPUTE_INTENT_EXISTS; finish it or edit back to the serving placement.
        A ready source with a failed compute target can roll back, canceling
        that failed request. A deployment at revision 1 has nothing to return
        to, a 409 NO_EARLIER_REVISION; a toRevision that is not an earlier
        revision is a 400; and a target whose release was deleted is a 409
        RELEASE_DELETED. A target whose release is already current answers 200
        at the current revision with nothing written. A ready copy of the
        release becomes current at once, a 200. A stopped or failed copy starts
        again, and a release whose copy is gone gets a new one, under the same
        credit and plan checks an update takes (402, 429); the 202 carries the
        pendingUpdate, of kind rollback, and the deployment moves once that copy
        is ready. A rollback sent again at the same base answers as the first
        did.
      operationId: rollbackDeployment
      parameters:
        - $ref: '#/components/parameters/PathID'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RollbackDeploymentRequest'
      responses:
        '200':
          description: The deployment runs the earlier revision's release now.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeploymentRollback'
        '202':
          description: >
            The release's copy is starting, or a new one is, and the deployment
            moves to it once it is ready. Nothing has moved yet, so revision,
            releaseId and kind describe the current revision, and pendingUpdate,
            of kind rollback, says what waits.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeploymentRollback'
        '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:
  parameters:
    PathID:
      name: id
      in: path
      required: true
      schema:
        type: string
  schemas:
    RollbackDeploymentRequest:
      type: object
      required:
        - baseRevision
      properties:
        baseRevision:
          type: integer
          description: >-
            The revision the caller last read. The rollback is refused once
            another change has moved the deployment past it.
        toRevision:
          type: integer
          description: >-
            The earlier revision whose release to return to; the revision before
            the current one when omitted.
    DeploymentRollback:
      type: object
      description: Where a rollback left the deployment.
      required:
        - id
        - revision
        - releaseId
        - kind
      properties:
        id:
          type: string
          description: The deployment's id, which a rollback never changes.
        revision:
          type: integer
          description: The deployment's current revision.
        releaseId:
          type: string
          description: The release the deployment runs at that revision.
        kind:
          type: string
          description: >-
            What made that revision: rollback, or, where the target release was
            already current, that revision's own kind. Open: clients tolerate
            values they do not know.
        fromRevision:
          type: integer
          description: The revision a rollback restored; absent on any other kind.
        pendingUpdate:
          $ref: '#/components/schemas/PendingUpdate'
    PendingUpdate:
      type: object
      nullable: true
      description: >-
        An update that waits for its release's running copy to be ready, or an
        unfinished cancellation of that copy. Cancellation keeps the original
        baseRevision and since so existing clients can retry stop/delete after
        dispatch failure. An unfinished cancellation reads failed, keeping its
        dismissal available even while the copy is stopping. Null after the move
        or cancellation finishes.
      required:
        - releaseId
        - baseRevision
        - status
        - since
      properties:
        releaseId:
          type: string
          description: The release the deployment moves to once it is ready.
        baseRevision:
          type: integer
          description: The revision the update was asked against.
        status:
          $ref: '#/components/schemas/DeploymentStatus'
        since:
          type: string
          format: date-time
          description: When the update was asked for.
        instanceGroupId:
          type: string
          description: The particular copy, distinguishing copies of the same release.
        computeConfig:
          $ref: '#/components/schemas/ComputeConfig'
        kind:
          type: string
          description: >-
            update, compute for a placement move, or rollback for a rollback
            waiting on its release's copy. Open: clients tolerate values they do
            not know.
        fromRevision:
          type: integer
          description: The revision a waiting rollback restores; absent on an update.
        waitingForBuild:
          type: string
          description: >-
            The release whose build the update's copy waits for before it
            starts. Present only while that copy is queued for the build; absent
            otherwise, and on an unfinished cancellation.
    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
    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
    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.
  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.