> ## 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 deployment's named metrics over a window

> Beta. For the workspace's own Metrics tab: job outcomes, failure categories, submissions and timing over a window of up to 7 days. Nothing after the request time (readAt) is read, but the window is aligned to the step, so its last bucket can end after that time. A call with no parameters reads the last 24 hours at a 3,600-second step, every metric, summaries and series, and the previous total. Never cached: the response says `Cache-Control: private, no-store`.

The window comes from `range`, or from `start` and `end` together in UTC, and is aligned to the step: a range ends at now rounded up to the step, and an explicit start rounds down and end up. The answer echoes the window it used and lists each bucket's start once in `timestamps`; every series has one value per timestamp, null where nothing was counted or observed. Send each parameter once. Names and values are lowercase, a name repeated inside a list counts once, and unknown parameter names are ignored. Each of these answers 400 INVALID_REQUEST with a message naming the parameter: an unknown or empty value, a repeated parameter, `range` with `start` or `end`, one of `start` and `end` alone, a time not in UTC, `start` not before `end` (an `end` after now is cut to now first), a `step` longer than the window, a window under 60 seconds with no `step`, a window that, once aligned to the step, starts over 14 days before now, spans over 7 days or holds over 1,440 buckets.

A metric that could not be read is left out of `metrics` and listed in `unavailable`, `partial` is true, and the status stays 200.

Refuses an API key with 401, so only a signed-in workspace member reads it. Another workspace's deployment, a running copy's own id and an id that does not exist all answer 404, before anything is read.

Can be switched off per workspace with the same flag as the status route. Switched off, this is still a 200 with enabled false and no other field. The switch is read before the API key refusal, the ownership check and the parameter checks, so a valid API key and any id also get that 200.




## OpenAPI

````yaml /openapi-deploy.yaml get /v1/deployments/{id}/metrics
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}/metrics:
    get:
      summary: Read a deployment's named metrics over a window
      description: >
        Beta. For the workspace's own Metrics tab: job outcomes, failure
        categories, submissions and timing over a window of up to 7 days.
        Nothing after the request time (readAt) is read, but the window is
        aligned to the step, so its last bucket can end after that time. A call
        with no parameters reads the last 24 hours at a 3,600-second step, every
        metric, summaries and series, and the previous total. Never cached: the
        response says `Cache-Control: private, no-store`.


        The window comes from `range`, or from `start` and `end` together in
        UTC, and is aligned to the step: a range ends at now rounded up to the
        step, and an explicit start rounds down and end up. The answer echoes
        the window it used and lists each bucket's start once in `timestamps`;
        every series has one value per timestamp, null where nothing was counted
        or observed. Send each parameter once. Names and values are lowercase, a
        name repeated inside a list counts once, and unknown parameter names are
        ignored. Each of these answers 400 INVALID_REQUEST with a message naming
        the parameter: an unknown or empty value, a repeated parameter, `range`
        with `start` or `end`, one of `start` and `end` alone, a time not in
        UTC, `start` not before `end` (an `end` after now is cut to now first),
        a `step` longer than the window, a window under 60 seconds with no
        `step`, a window that, once aligned to the step, starts over 14 days
        before now, spans over 7 days or holds over 1,440 buckets.


        A metric that could not be read is left out of `metrics` and listed in
        `unavailable`, `partial` is true, and the status stays 200.


        Refuses an API key with 401, so only a signed-in workspace member reads
        it. Another workspace's deployment, a running copy's own id and an id
        that does not exist all answer 404, before anything is read.


        Can be switched off per workspace with the same flag as the status
        route. Switched off, this is still a 200 with enabled false and no other
        field. The switch is read before the API key refusal, the ownership
        check and the parameter checks, so a valid API key and any id also get
        that 200.
      operationId: getDeploymentMetrics
      parameters:
        - $ref: '#/components/parameters/PathID'
        - name: range
          in: query
          required: false
          style: form
          explode: true
          description: >-
            `1h`, `24h` or `7d`. The default, `24h`, applies when `start` and
            `end` are absent. Never sent with `start` or `end`.
          schema:
            type: array
            items:
              type: string
        - name: start
          in: query
          required: false
          style: form
          explode: true
          description: >-
            Window start, RFC 3339 in UTC, such as `2026-11-15T16:00:00Z`. Sent
            with `end`, never with `range`.
          schema:
            type: array
            items:
              type: string
        - name: end
          in: query
          required: false
          style: form
          explode: true
          description: >-
            Window end, RFC 3339 in UTC. Sent with `start`, never with `range`;
            an `end` after now is cut to now.
          schema:
            type: array
            items:
              type: string
        - name: step
          in: query
          required: false
          style: form
          explode: true
          description: >-
            Bucket width in seconds: `60`, `300`, `900`, `3600` or `21600`.
            Absent, the smallest step that gives at most 60 buckets over the
            window as sent.
          schema:
            type: array
            items:
              type: string
        - name: metrics
          in: query
          required: false
          style: form
          explode: true
          description: >-
            A comma-separated list from `jobs`, `failure_categories`,
            `expired_at_worker_maximum`, `submissions`, `job_duration`,
            `worker_maximum_waits` and `job_time_split`. Absent, those seven; a
            metric added later comes back only when named.


            `cold_start` is also accepted, outside those seven and only on its
            own: named with another metric it answers 400. It answers the cold
            start row alone, in seconds, as one summary item equal to the
            `cold_start` item of `job_duration`, and with `include=series` alone
            only its unit. It waits up to 10 seconds for the metrics store,
            where every other metric waits 1.8 seconds, and is listed
            `unavailable` as `datadog_slow` if the store has not answered by
            then. The call spends one request of the workspace's allowance, and
            `compare` does not apply to it.
          schema:
            type: array
            items:
              type: string
        - name: include
          in: query
          required: false
          style: form
          explode: true
          description: A comma-separated list from `summary` and `series`. Absent, both.
          schema:
            type: array
            items:
              type: string
        - name: compare
          in: query
          required: false
          style: form
          explode: true
          description: >-
            `previous` adds each count metric's previous total, over the window
            of the same length just before; `none` leaves it out. Absent,
            `previous`.
          schema:
            type: array
            items:
              type: string
      responses:
        '200':
          description: OK
          headers:
            Cache-Control:
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeploymentMetricsAnswer'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '503':
          $ref: '#/components/responses/KeyUnverified'
      security:
        - BearerAuth: []
components:
  parameters:
    PathID:
      name: id
      in: path
      required: true
      schema:
        type: string
  schemas:
    DeploymentMetricsAnswer:
      description: >
        The metrics of a deployment, as one of two bodies told apart by enabled:
        the whole answer when it is true, and enabled false alone when the
        workspace's kill switch is on.
      oneOf:
        - $ref: '#/components/schemas/DeploymentMetricsOff'
        - $ref: '#/components/schemas/DeploymentMetricsOn'
    DeploymentMetricsOff:
      type: object
      description: >
        Deployment metrics are turned off for the workspace. A client shows no
        metrics and says nothing about it.
      required:
        - enabled
      properties:
        enabled:
          type: boolean
          enum:
            - false
    DeploymentMetricsOn:
      type: object
      required:
        - enabled
        - window
        - readAt
        - timestamps
        - metrics
        - partial
        - unavailable
        - retryAfterSeconds
      properties:
        enabled:
          type: boolean
          enum:
            - true
        window:
          $ref: '#/components/schemas/DeploymentMetricsWindow'
        readAt:
          type: string
          format: date-time
          description: >-
            When the request was taken, to the second. Nothing after it is read,
            so the last bucket of a window ending in the future is partial.
        timestamps:
          type: array
          description: >-
            The start of each bucket of the window, once, oldest first. Every
            series holds one value for each.
          items:
            type: string
            format: date-time
        metrics:
          type: object
          description: >-
            Each metric that was read, by name. A metric listed in `unavailable`
            is absent.
          additionalProperties:
            $ref: '#/components/schemas/DeploymentMetric'
        partial:
          type: boolean
          description: True whenever `unavailable` is not empty.
        unavailable:
          type: array
          items:
            $ref: '#/components/schemas/DeploymentMetricUnavailable'
        retryAfterSeconds:
          type: integer
          nullable: true
          description: >-
            Seconds to wait before asking again, set when a metric is
            unavailable for `rate_limited` or `datadog_refused`; null otherwise.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Machine-readable error code.
        message:
          type: string
          description: Human-readable detail.
    DeploymentMetricsWindow:
      type: object
      description: The window the answer covers, aligned to its step.
      required:
        - start
        - end
        - step
      properties:
        start:
          type: string
          format: date-time
        end:
          type: string
          format: date-time
          description: The aligned end, which can lie after `readAt`.
        step:
          type: integer
          description: Seconds in each bucket.
    DeploymentMetric:
      type: object
      required:
        - unit
      properties:
        unit:
          type: string
          description: >-
            The unit of the values, totals, previous total, p50, p95 and means.
            `count`, `coldCount` and `excluded` are numbers of timings or jobs,
            and a field ending in `Share` is a fraction from 0 to 1.
        previousTotal:
          type: number
          format: double
          description: Absent with `compare=none` and without the summary.
        summary:
          type: array
          description: >-
            Absent without the summary. A `job_duration` summary leaves out its
            `cold_start` item when that item's read, which waits 1.8 seconds,
            was slow, refused or failed, and lists its other items; the metric
            is then not unavailable. The `cold_start` metric read on its own
            holds that item alone, and is unavailable when its read, which waits
            10 seconds, was slow, refused or failed.
          items:
            $ref: '#/components/schemas/DeploymentMetricSummary'
        series:
          type: array
          description: Absent without the series.
          items:
            $ref: '#/components/schemas/DeploymentMetricSeries'
    DeploymentMetricUnavailable:
      type: object
      required:
        - metric
        - reason
      properties:
        metric:
          type: string
        reason:
          type: string
          description: >-
            Why it was not read: `rate_limited`, `busy`, `datadog_refused`,
            `datadog_error` or `datadog_slow`. The list is open; a client
            tolerates a value it does not know.
    DeploymentMetricSummary:
      type: object
      required:
        - labels
      properties:
        labels:
          type: object
          additionalProperties:
            type: string
        total:
          type: number
          format: double
        p50:
          type: number
          format: double
        p95:
          type: number
          format: double
          description: Over fewer than 20 timings, the slowest timing.
        count:
          type: integer
        coldCount:
          type: integer
          description: >-
            Only on the item labeled phase `cold_start`, in `job_duration` or in
            the `cold_start` metric, whose `count`, `p50` and `p95` read over
            every job whose cold start was decided, a job that started warm
            counting 0 seconds. The jobs among them whose cold wait was
            recorded. A cold job whose cold wait was never recorded, such as one
            its customer canceled before its worker came up, counts in `count`
            at 0 seconds and not here. Over fewer than 20 jobs, `p95` is the
            slowest of their timings.
        queueTimeShare:
          type: number
          format: double
        excluded:
          type: integer
    DeploymentMetricSeries:
      type: object
      required:
        - labels
        - values
      properties:
        labels:
          type: object
          additionalProperties:
            type: string
        values:
          type: array
          description: One value per timestamp, null where nothing was counted or observed.
          items:
            type: number
            format: double
            nullable: true
  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'
    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'
    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.