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

# List calls

> Unified inbound + outbound call feed for the API-key tenant.

Requires scope **`calls:read`** (granted by default on new keys).

Use this for HMS call-log UIs and webhook catch-up. Each row includes `billingStatus` (`pending` | `charged` | `failed` | `skipped`). Credits are often still **pending** right after an inbound `call/end` — bill lands async via carrier hangup or inbound-billing.

Query params: `direction`, `status`, `agentId`, `campaignId`, `startedAfter`, `startedBefore`, `page`, `limit`.

See [Healthcare HMS integration](/get-started/guides/healthcare-hms-integration#usage--call-analytics).


## OpenAPI

````yaml openapi.json GET /api/v1/calls
openapi: 3.0.3
info:
  title: Ondial Public API
  version: 1.0.0
  description: >-
    Tenant API-key surface for lead ingest, contacts (including dial
    conversation + analysis), unified call analytics, credit ledger, tenant
    webhooks, events, inbound agents, company profiles, and knowledge-base
    documents.


    **Campaign definition is UI-only** — create and start an API-ingest campaign
    in the dashboard, then push leads here.


    **Auth:** `Authorization: Bearer ond_live_…` or `ond_test_…` (or
    `X-API-Key`). Keys are requested in **API Access** with a friendly **key
    name**, then approved by Super Admin (not self-serve). Tenants can rename
    keys later without rotating the secret.


    **Scopes:** Defaults include `calls:read`, `credits:read`, `webhooks:write`,
    plus lead/inbound. Opt-in at approval: `companies:*`, `knowledge:*`,
    `analytics:read`, `recordings:read`. Missing scope → `403 forbidden`.


    **Sandbox** keys never place PSTN dials or live WhatsApp/email and do not
    burn credits (KB upload skips debit).


    **Security:** Company responses never include SMTP/WhatsApp credentials. KB
    v1 is metadata-only — no file download. Recordings use short-TTL signed URLs
    only.


    **Kill switch:** Super Admin can disable all `/api/v1/*` (`503` /
    `api_globally_disabled`) without stopping UI CSV campaigns.


    **Compliance:** Call channel requires `consent.outboundCall: true` and phone
    not on tenant/platform DNC.
servers:
  - url: https://dashboard.ondial.ai
    description: Production
  - url: http://localhost:3001
    description: Local
security:
  - BearerAuth: []
tags:
  - name: Core
    description: Auth check and lead ingest
  - name: Contacts
    description: Status, dials/conversation/analysis, cancel, delete, follow-ups, list
  - name: Calls
    description: >-
      Unified inbound + outbound call feed, active calls, and signed recordings
      (scopes: calls:read, recordings:read)
  - name: Analytics
    description: 'Call aggregates by day/agent/campaign (scope: analytics:read)'
  - name: Credits
    description: 'Wallet balance and credit ledger (scope: credits:read)'
  - name: Webhooks
    description: 'Register HTTPS tenant webhooks (scope: webhooks:write)'
  - name: Events
    description: ERP event bus slice — eventType → campaign
  - name: Outbound
    description: >-
      Read-only campaign lookup for API / Custom CRM. Create and start campaigns
      in the dashboard.
  - name: Inbound agents
    description: Configure inbound agents; list/buy pool numbers; read credits
  - name: Companies
    description: >-
      Company profile CRUD (requires companies:read / companies:write scopes).
      Never returns SMTP or WhatsApp credentials.
  - name: Knowledge bases
    description: >-
      Knowledge document upload/list/delete (requires knowledge:read /
      knowledge:write scopes). Metadata only — no file download via API.
paths:
  /api/v1/calls:
    get:
      tags:
        - Calls
      summary: List unified calls
      description: >-
        Inbound + outbound call feed for the tenant. Billing may be pending
        after session end — poll again or wait for call.*.billed /
        credits.usage. Requires calls:read.
      operationId: listCalls
      parameters:
        - name: direction
          in: query
          schema:
            type: string
            enum:
              - inbound
              - outbound
        - name: status
          in: query
          schema:
            type: string
        - name: agentId
          in: query
          schema:
            type: string
        - name: campaignId
          in: query
          schema:
            type: string
        - name: startedAfter
          in: query
          schema:
            type: string
            format: date-time
        - name: startedBefore
          in: query
          schema:
            type: string
            format: date-time
        - name: page
          in: query
          schema:
            type: integer
            default: 1
        - name: limit
          in: query
          schema:
            type: integer
            default: 25
            maximum: 100
      responses:
        '200':
          description: Call list
          content:
            application/json:
              schema:
                type: object
                properties:
                  calls:
                    type: array
                    items:
                      $ref: '#/components/schemas/UnifiedCallSummary'
                  pagination:
                    type: object
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  schemas:
    UnifiedCallSummary:
      type: object
      properties:
        id:
          type: string
        direction:
          type: string
          enum:
            - inbound
            - outbound
        callId:
          type: string
          nullable: true
        callSessionId:
          type: string
          nullable: true
        callSid:
          type: string
          nullable: true
        status:
          type: string
          nullable: true
        outcome:
          type: string
          nullable: true
        startedAt:
          type: string
          nullable: true
        endedAt:
          type: string
          nullable: true
        durationSeconds:
          type: number
        fromNumber:
          type: string
          nullable: true
        toNumber:
          type: string
          nullable: true
        agentId:
          type: string
          nullable: true
        agentName:
          type: string
          nullable: true
        campaignId:
          type: string
          nullable: true
        contactId:
          type: string
          nullable: true
        billingStatus:
          type: string
          enum:
            - pending
            - charged
            - failed
            - skipped
        creditsCharged:
          type: number
          nullable: true
        creditsError:
          type: string
          nullable: true
        balanceAfter:
          type: number
          nullable: true
        hasTranscript:
          type: boolean
        hasAnalysis:
          type: boolean
        hasRecording:
          type: boolean
        summary:
          type: string
          nullable: true
    ErrorBody:
      type: object
      properties:
        error:
          type: string
        reasonCode:
          type: string
        missing:
          type: array
          items:
            type: string
  responses:
    Unauthorized:
      description: Missing, invalid, or inactive API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            error: Invalid or inactive API key
            reasonCode: unauthorized
    Forbidden:
      description: Missing required API key scope
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            error: Insufficient scope
            reasonCode: forbidden
            missing:
              - calls:read
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: ond_live | ond_test
      description: >-
        Paste only your API key (`ond_live_…` or `ond_test_…`). Do not type the
        word Bearer — the playground adds it.

````