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

# Live event stream (SSE)

> Server-Sent Events stream of the job's live state. On connect the
client receives the current snapshot (a `status` event, the latest
`progress`, and the most recent `preview` if any), then future
updates. The stream ends after either the terminal `status` event
or a terminal `error` event (see the `error` event below).

Live push only — NOT a replayable log: events carry no `id`, there
is no `Last-Event-ID` resume, and frames emitted while disconnected
are gone. Each `progress` event is a complete snapshot, so a single
one fully re-syncs a reconnecting client; the authoritative state is
always `GET /api/v2/jobs/{id}`.




## OpenAPI

````yaml /openapi-v2.yaml get /api/v2/jobs/{id}/events
openapi: 3.0.3
info:
  title: Comfy API v2
  version: 2.0.0
  description: |
    The official, versioned HTTP API for running ComfyUI workflows from
    external applications: upload inputs, submit a workflow, observe
    execution, retrieve results.

    Design principles:
    - **Poll-first.** Every capability is reachable via plain GET polling;
      the SSE stream is a live enhancement, never the source of truth.
    - **Everything is resumable.** Submission is idempotent; job state and
      outputs are retrievable by ID until `expires_at`.
    - **UUID identity, content-addressed dedup.** Assets are UUID-identified
      records over blobs keyed by a server-computed blake3 hash. The hash is
      nullable and may be computed lazily.
    - **Follow links, don't build URLs.** Responses embed follow-up URLs.

    Additive changes only within v2; breaking changes require v3.
servers:
  - url: http://127.0.0.1:8189
    description: Self-hosted (comfy-api-proxy)
  - url: https://cloud.comfy.org
    description: Comfy Cloud
  - url: https://{deployment}.run.comfy.app
    description: Serverless deployment
    variables:
      deployment:
        description: >-
          DNS-safe deployment id (subdomain label). Staging uses
          {deployment}.stg.run.comfy.app.
        default: dep-1234abcd-56ef-7890-abcd-ef1234567890
security:
  - bearerAuth: []
  - {}
tags:
  - name: assets
    description: UUID-identified records over content-addressed blobs.
  - name: jobs
    description: One execution of a workflow — durable, pollable, cancelable.
paths:
  /api/v2/jobs/{id}/events:
    get:
      tags:
        - jobs
      summary: Live event stream (SSE)
      description: |
        Server-Sent Events stream of the job's live state. On connect the
        client receives the current snapshot (a `status` event, the latest
        `progress`, and the most recent `preview` if any), then future
        updates. The stream ends after either the terminal `status` event
        or a terminal `error` event (see the `error` event below).

        Live push only — NOT a replayable log: events carry no `id`, there
        is no `Last-Event-ID` resume, and frames emitted while disconnected
        are gone. Each `progress` event is a complete snapshot, so a single
        one fully re-syncs a reconnecting client; the authoritative state is
        always `GET /api/v2/jobs/{id}`.
      operationId: getJobEvents
      parameters:
        - $ref: '#/components/parameters/JobId'
      responses:
        '200':
          description: SSE stream; see `x-sse-events` for the event catalog.
          content:
            text/event-stream:
              schema:
                type: string
                description: >-
                  Stream of `event:`/`data:` frames. Data payloads are the JSON
                  schemas listed in x-sse-events.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          description: >-
            `too_many_streams` — the caller already has the maximum number of
            concurrent GET .../events streams open. Close an existing stream (or
            wait for one to reach a terminal status) before opening another; GET
            /api/v2/jobs/{id} remains available as a plain poll regardless of
            this limit. Or `rate_limited`, the caller past a request rate limit;
            retry after `Retry-After`.
          headers:
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '500':
          $ref: '#/components/responses/UpstreamError'
        '501':
          description: >-
            `not_implemented` — this deployment does not yet serve live event
            streaming. GET /api/v2/jobs/{id} remains available as a plain poll
            in the meantime.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
components:
  parameters:
    JobId:
      name: id
      in: path
      required: true
      schema:
        type: string
      example: 7f3d2c1b-9a8e-4d6f-b012-3c4d5e6f7a8b
  responses:
    Unauthorized:
      description: '`unauthorized` — missing or invalid credentials.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Forbidden:
      description: >-
        `forbidden` — authenticated but not allowed. On a serverless deployment,
        also `sso_required` — the key is valid, but the account must sign in
        through its organization's single sign-on, which does not accept this
        key; it can come back on any operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    NotFound:
      description: '`not_found`.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    UpstreamError:
      description: >-
        `upstream_error` — an unexpected failure reaching or processing the
        request in this implementation's backing services. The message is always
        a generic, safe-to-display string; implementation detail (the specific
        upstream, its error text, transport failures) is never included here —
        see each implementation's own error-mapping notes. Every operation in
        this contract can fail this way.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  headers:
    RetryAfter:
      schema:
        type: integer
      description: Seconds to wait before retrying.
  schemas:
    ErrorEnvelope:
      type: object
      description: >
        Shared error envelope with machine-readable codes. Core codes (v1):

        `invalid_workflow` (422), `workflow_format_ui` (422),

        `missing_asset` (422), `hash_mismatch` (409), `blob_not_found`

        (404), `idempotency_key_reuse` (422),

        `queue_full` (429 + Retry-After), `rate_limited` (429 + Retry-After:

        the caller is past a request rate limit; retry), `insufficient_credits`

        (402), `not_found` (404), `unauthorized` (401), `forbidden` (403).

        Deployment-scoped surfaces add: `deployment_not_ready` (429 +

        Retry-After — the deployment can still reach ready; retry),

        `deployment_unavailable` (429 + Retry-After: the deployment is ready

        but its GPU provider is not taking work on it yet; retry),

        `deployment_stopped` (422 — terminal deployment state; a retry

        cannot succeed without operator action), `invalid_request` (422:

        a malformed asset upload or asset-from-hash field), `content_blocked`
        (451:

        content moderation flagged the asset's bytes) and `sso_required` (403:

        the key is valid, but the account must sign in through its

        organization's single sign-on, which does not accept this key). A 429 is
        disambiguated

        by `error.code` alone; clients should treat any 429 + Retry-After

        as "back off and retry".
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: invalid_workflow
            message:
              type: string
              example: 'Node 12 (KSampler): required input ''model'' is not connected'
            details:
              type: object
              nullable: true
              additionalProperties: true
              description: >-
                Machine-readable detail for the code. When it carries
                `node_errors`, that is keyed by node id and each value is a
                `JobNodeError`, the same shape as a job's `error.node_errors`,
                whether the refusal came at submit (for example
                `unknown_node_class`, a node class the deployment's build does
                not contain) or from ComfyUI after dispatch.
              example:
                node_errors:
                  '12':
                    class_type: SomeCustomNode
                    errors:
                      - type: unknown_node_class
                        message: >-
                          this deployment's build does not contain the node
                          class SomeCustomNode.
                unknown_node_classes:
                  - SomeCustomNode
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        `Authorization: Bearer <credential>`. The credential is one of: an
        account-scoped API key (`comfyui-…`), accepted on Cloud and serverless;
        a Comfy Cloud session JWT; or an OAuth access token issued for the Comfy
        Cloud resource. Which kinds a given deployment accepts is deployment
        configuration — an API key always works on Cloud and serverless, and a
        deployment that does not accept JWT bearers answers `401` with a message
        saying so. Self-hosted accepts unauthenticated requests by default and
        can be configured with a static bearer token.

````

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