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

# Get campaign statistics

> Returns call counters for the campaign, computed from call records
at request time, plus the current (most recently created) run, if
one exists. `stats` is all zero when the campaign has no calls yet.
`current_run` is `null` when the campaign has never been started.




## OpenAPI

````yaml /api-reference/openapi.json get /v1/campaigns/{campaign_id}/stats
openapi: 3.0.3
info:
  title: TopCalls Voice API
  description: >
    TopCalls Voice Gateway API for creating and managing AI-powered phone calls.


    ## Authentication


    All API requests require authentication. Include your API key in the
    `Authorization` header:


    ```

    Authorization: Bearer tc_live_xxxxx

    ```


    ## Rate Limits


    Direct call creation via `POST /v1/calls` is limited to your account's

    `max_calls_per_minute` setting (default: 20) per minute. Exceeding it
    returns

    `429 Too Many Requests` with a `Retry-After` header.

    All endpoints are additionally subject to a flat limit of 120 requests per

    minute per account (all methods).


    On a `429`, wait for the number of seconds in the `Retry-After` header, then

    retry the same request. For automated clients, back off progressively on

    repeated `429`s. Limits are per account and are shared by all API keys.


    ## Error Format


    All errors follow RFC 7807 Problem+JSON format:


    ```json

    {
      "type": "https://api.topcalls.ai/errors/insufficient_quota",
      "title": "Insufficient Quota",
      "status": 402,
      "detail": "You need 5 minutes but have 3.5 remaining"
    }

    ```
  version: 1.0.0
  contact:
    name: TopCalls Support
    url: https://topcalls.ai
  license:
    name: Proprietary
servers:
  - url: https://api.topcalls.ai
    description: Production
security: []
tags:
  - name: Calls
    description: Create and manage phone calls
  - name: Phone Numbers
    description: Manage phone numbers and carriers
  - name: Account
    description: Account information and usage
  - name: Webhooks
    description: Webhook configuration and events
  - name: Configuration
    description: Available AI models, voices, and platform capabilities
paths:
  /v1/campaigns/{campaign_id}/stats:
    get:
      tags:
        - Campaigns
      summary: Get campaign statistics
      description: |
        Returns call counters for the campaign, computed from call records
        at request time, plus the current (most recently created) run, if
        one exists. `stats` is all zero when the campaign has no calls yet.
        `current_run` is `null` when the campaign has never been started.
      operationId: getCampaignStats
      parameters:
        - name: campaign_id
          in: path
          required: true
          description: Campaign UUID
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Campaign statistics
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CampaignStatsResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: Campaign not found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      security:
        - bearerAuth: []
components:
  schemas:
    CampaignStatsResponse:
      type: object
      description: >-
        Call counters for a campaign, computed from call records at request
        time, plus its most recent run.
      required:
        - campaign_id
        - stats
        - current_run
      properties:
        campaign_id:
          type: string
          format: uuid
        stats:
          type: object
          description: >-
            Computed live from the campaign's call records on every request; not
            a cached snapshot.
          required:
            - contacted_count
            - completed_count
            - success_count
            - failure_count
            - total_duration_seconds
            - updated_at
          properties:
            contacted_count:
              type: integer
              description: Number of calls that reached a contacted state.
            completed_count:
              type: integer
              description: Number of calls that completed.
            success_count:
              type: integer
              description: >-
                Number of calls whose disposition matches one of the campaign's
                configured conversion outcomes.
            failure_count:
              type: integer
              description: Number of calls that ended in a failed status.
            total_duration_seconds:
              type: integer
              description: Cumulative talk time across all calls, in seconds.
            updated_at:
              type: string
              format: date-time
              description: Timestamp when these counters were computed for this response.
        current_run:
          type: object
          nullable: true
          allOf:
            - $ref: '#/components/schemas/CampaignRun'
          description: >-
            The most recently created run for this campaign, or null if the
            campaign has never been started.
    Problem:
      type: object
      required:
        - status
        - title
      properties:
        type:
          type: string
          format: uri
          description: Error type URI
        title:
          type: string
          description: Error title
        status:
          type: integer
          description: HTTP status code
        detail:
          type: string
          description: Human-readable error detail
        code:
          type: string
          description: >
            Machine-readable error code for programmatic handling. Present on

            errors that carry a stable identifier (e.g. `PROMPT_SAFETY_FRAUD`,

            `job_not_found`, `too_many_ids`, `no_matches`). Distinct from the

            per-field `errors[].code` used for validation failures. Scenario-

            specific — see each endpoint's response examples for the exact
            value.
        instance:
          type: string
          format: uuid
          description: Request instance ID
        errors:
          type: array
          description: Validation errors (for 400 responses)
          items:
            type: object
            properties:
              path:
                type: string
                description: Field path (e.g., "phone_number", "metadata.from_number")
              message:
                type: string
                description: Error message
              code:
                type: string
                description: Error code (e.g., "invalid_string", "custom")
        details:
          type: string
          description: Additional error details (for provider errors)
    CampaignRun:
      type: object
      properties:
        id:
          type: string
          format: uuid
        status:
          type: string
          description: >-
            Free-form run status string (observed values include running,
            paused, stopped, completed).
        started_at:
          type: string
          format: date-time
          nullable: true
        paused_at:
          type: string
          format: date-time
          nullable: true
        completed_at:
          type: string
          format: date-time
          nullable: true
        leads_processed:
          type: integer
          nullable: true
        calls_per_minute:
          type: number
          nullable: true
        pause_reason:
          type: string
          nullable: true
  responses:
    Unauthorized:
      description: Unauthorized (missing or invalid API key)
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            status: 401
            title: Unauthorized
            detail: Invalid or missing API key
    Forbidden:
      description: Forbidden (missing required scope)
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            status: 403
            title: Forbidden
            detail: 'Missing required scope: calls:write'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |
        Use `Authorization: Bearer tc_live_xxxxx`

````