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

# Query deployment statistics

For authentication and error responses, see the [Public API (V2) overview](https://docs.appsignal.com/api/v2/overview.md#deploys).

```yaml POST /api/v2/deploys/stats theme={null}
openapi: 3.1.0
info:
  title: AppSignal V2 API
  description: >-
    REST API for metrics, traces, logs, Kubernetes monitoring, and deployment
    tracking.
  license:
    name: ''
  version: 0.1.0
paths:
  /api/v2/deploys/stats:
    post:
      tags:
        - Deploys
      summary: Query deployment statistics
      operationId: stats
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StatsQuery'
            example:
              site_id: 6591f2705fa150d75339e232
              revision: abc-123
              namespace: web
        required: true
      responses:
        '200':
          description: Statistics for the revision, zero when nothing was recorded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeployStatsResult'
              example:
                throughput: 1001
                mean: 1.95
                error_rate: 1.05
        '400':
          description: Malformed request, or input the server cannot process.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Missing or invalid authentication token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Route or resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: External query concurrency limit exceeded; retry shortly.
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Unhandled server-side failure.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearer_auth: []
        - token_query: []
components:
  schemas:
    BadRequestResponse:
      type: object
      description: >-
        Standard body for HTTP 400 Bad Request responses. Branch on the stable
        `error` slug, display `message` as-is, and read per-error structured
        data from `details`.
      required:
        - error
        - message
      properties:
        error:
          type: string
          description: Stable, machine-readable slug identifying the specific error case.
        message:
          type: string
          description: Human-readable message. Safe to log or display to end users.
        details:
          description: >-
            Per-error structured payload. Shape varies by
            [`error`](Self::error).
    DeployStatsResult:
      type: object
      description: >-
        Aggregated metrics for one deployment. Without recorded samples,
        `throughput` is the

        error count, `error_rate` 100 (0 without errors) and `mean` 0.
      required:
        - throughput
        - mean
        - error_rate
      properties:
        throughput:
          type: integer
          format: u-int64
          description: Recorded requests and background jobs.
          minimum: 0
        mean:
          type: number
          format: double
          description: Mean duration in milliseconds.
        error_rate:
          type: number
          format: double
          description: Error rate as a percentage (0-100).
    ErrorResponse:
      type: object
      description: Error body returned for 401, 404 and 500 responses.
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message.
    StatsQuery:
      type: object
      description: >-
        Query for the aggregated metrics of one deployment revision, over all
        retained data.
      required:
        - site_id
        - revision
      properties:
        site_id:
          type: string
          description: Site identifier, as a BSON ObjectId.
        revision:
          type: string
          description: Git revision or deployment identifier.
        namespace:
          type:
            - string
            - 'null'
          description: >-
            Optional namespace filter (e.g., "web", "api"). Absent means all
            namespaces.
    TooManyRequestsResponse:
      type: object
      description: Error body returned for 429 responses.
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message.
        suggestion:
          type:
            - string
            - 'null'
          description: >-
            A cheaper way to write the request's filter. Only the trace list

            endpoints set it, and only for a filter with a known indexed
            rewrite.
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      description: '`Authorization: Bearer <token>`'
    token_query:
      type: apiKey
      in: query
      name: token
      description: >-
        Alternative to the Authorization header: pass the token as a
        `?token=<token>` query parameter.
```


## API Specification

The full API specification for this endpoint is available in the [documentation index](https://docs.appsignal.com/llms.txt).


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