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

# Activation code history

> Returns the line's code requests, **newest first**, codes included: `{ "activations": [ … ] }`. It works on suspended lines too — they keep their history. A line of another workspace answers `404 LINE_NOT_FOUND`, never an empty list.

A line that left your workspace — `RETURNED` or `CANCELED` — has its history **deleted**: its requests are still listed (`id`, `status`, timestamps, `failureReason`), but `code` is `null` and `hasAudio` turns `false` as the recordings are deleted. Sent with `Cache-Control: no-store`: the codes are credentials.

**Requires a tenant-scoped key** — a number-scoped key (or per-number OAuth grant) gets `403 NUMBER_SCOPE_NOT_ALLOWED`. Permission `phone_lines:read`: with an OAuth / MCP token the user must be an **Owner or Admin** (`403 PERMISSION_DENIED` otherwise).

> [!WARNING]
>
> **The activation code is a credential.** Whoever holds it can register a WhatsApp account on the line. Do not paste a response with a code anywhere public.


## OpenAPI

````yaml openapi.json GET /v1/phone-lines/{id}/activations
openapi: 3.1.0
info:
  title: Pilot Status API
  version: 1.0.0
  license:
    name: Pilot Status Terms of Service
    url: https://pilotstatus.com.br/terms
  description: >-
    Public REST API for Pilot Status. Authenticate with the `x-api-key: ps_...`
    header (or `x-api-key-id`). Base URL: https://pilotstatus.com.br
servers:
  - url: https://pilotstatus.com.br
security:
  - apiKey: []
  - apiKeyId: []
paths:
  /v1/phone-lines/{id}/activations:
    get:
      tags:
        - Phone Lines
      summary: Code history of a line
      description: >-
        Returns the line's code requests, **newest first**, codes included: `{
        "activations": [ … ] }`. It works on suspended lines too — they keep
        their history. A line of another workspace answers `404 LINE_NOT_FOUND`,
        never an empty list.


        A line that left your workspace — `RETURNED` or `CANCELED` — has its
        history **deleted**: its requests are still listed (`id`, `status`,
        timestamps, `failureReason`), but `code` is `null` and `hasAudio` turns
        `false` as the recordings are deleted. Sent with `Cache-Control:
        no-store`: the codes are credentials.


        **Requires a tenant-scoped key** — a number-scoped key (or per-number
        OAuth grant) gets `403 NUMBER_SCOPE_NOT_ALLOWED`. Permission
        `phone_lines:read`: with an OAuth / MCP token the user must be an
        **Owner or Admin** (`403 PERMISSION_DENIED` otherwise).
      operationId: get_phone_lines_id_activations
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          example: cmg5k2l1n0001pl8example9x
          description: The line `id` (from `GET /v1/phone-lines`) — not the phone number.
        - name: limit
          in: query
          required: false
          description: >-
            1 to 100 (default 20). Anything else (0, 101, a decimal, text,
            empty) → `400 INVALID_LIMIT`.
          schema:
            type: string
            description: (integer (1–100))
          example: '20'
      responses:
        '200':
          description: >-
            The line's code requests, newest first. Sent with `Cache-Control:
            no-store`.
          headers:
            Cache-Control:
              description: '`no-store`'
              schema:
                type: string
                enum:
                  - no-store
          content:
            application/json:
              schema:
                type: object
                properties:
                  activations:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: The request id (`activationId`).
                        lineId:
                          type: string
                          description: The line the request belongs to.
                        status:
                          type: string
                          enum:
                            - WAITING
                            - CAPTURED
                            - TRANSCRIBED
                            - TIMED_OUT
                            - FAILED
                          description: >-
                            `WAITING`, `CAPTURED`, `TRANSCRIBED`, `TIMED_OUT` or
                            `FAILED`. Keep polling while `status` is `WAITING`,
                            or `CAPTURED` with `failureReason: null`; every
                            other combination is final.
                        requestedAt:
                          type: string
                          format: date-time
                          description: ISO 8601 — when the request was opened.
                        pollDeadline:
                          type: string
                          format: date-time
                          description: >-
                            ISO 8601 — end of the capture window, 5 minutes
                            after the request.
                        code:
                          type:
                            - string
                            - 'null'
                          description: >-
                            The 6-digit code, once `TRANSCRIBED` and found.
                            `null` otherwise. **A credential** — whoever holds
                            it can register a WhatsApp account on the line.
                        capturedAt:
                          type:
                            - string
                            - 'null'
                          format: date-time
                          description: ISO 8601 — when the call recording was stored.
                        transcribedAt:
                          type:
                            - string
                            - 'null'
                          format: date-time
                          description: ISO 8601 — when the transcription finished.
                        failureReason:
                          type:
                            - string
                            - 'null'
                          description: >-
                            Why a final request has no code:
                            `no_call_in_window`, `canceled_by_customer`,
                            `no_code_in_transcript`, `transcription_failed`,
                            `audio_download_failed`, `audio_store_failed`,
                            `poll_not_scheduled`, or `null`. Treat an unknown
                            value as a failure, since new ones may be added.
                        hasAudio:
                          type: boolean
                          description: >-
                            Whether a recording of the call is stored —
                            downloadable from `GET
                            /v1/phone-lines/activations/{activationId}/audio`
                            and playable in the dashboard.
                      required:
                        - id
                        - lineId
                        - status
                        - requestedAt
                        - pollDeadline
                        - code
                        - capturedAt
                        - transcribedAt
                        - failureReason
                        - hasAudio
                required:
                  - activations
              example:
                activations:
                  - id: cmg5k3a7c0002ac8example4q
                    lineId: cmg5k2l1n0001pl8example9x
                    status: TRANSCRIBED
                    requestedAt: '2026-10-01T14:10:00.000Z'
                    pollDeadline: '2026-10-01T14:15:00.000Z'
                    code: '123456'
                    capturedAt: '2026-10-01T14:11:42.000Z'
                    transcribedAt: '2026-10-01T14:11:51.000Z'
                    failureReason: null
                    hasAudio: true
                  - id: cmg5j9x2b0001ac8example7m
                    lineId: cmg5k2l1n0001pl8example9x
                    status: TIMED_OUT
                    requestedAt: '2026-10-01T13:40:00.000Z'
                    pollDeadline: '2026-10-01T13:45:00.000Z'
                    code: null
                    capturedAt: null
                    transcribedAt: null
                    failureReason: no_call_in_window
                    hasAudio: false
        '400':
          description: '`limit` is not an integer from 1 to 100'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: >-
                  limit must be an integer between 1 and 100. | limit deve ser
                  um inteiro entre 1 e 100.
                code: INVALID_LIMIT
        '401':
          description: >-
            Missing or invalid `x-api-key` / `x-api-key-id` header (the body
            carries only `error`)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Invalid API key
        '403':
          description: >-
            Number-scoped key or per-number OAuth grant
            (`NUMBER_SCOPE_NOT_ALLOWED`); OAuth/MCP token of a user who is not
            Owner or Admin (`PERMISSION_DENIED`) or no longer an active member
            (`WORKSPACE_MEMBERSHIP_REQUIRED`); archived workspace
            (`WORKSPACE_ARCHIVED`). `TENANT_REQUIRED`: credential not bound to
            any workspace
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              examples:
                number_scope_not_allowed:
                  summary: Number-scoped key
                  value:
                    error: This endpoint requires a tenant-scoped API key
                    code: NUMBER_SCOPE_NOT_ALLOWED
                permission_denied:
                  summary: Role without phone_lines:read
                  value:
                    error: >-
                      Your workspace role does not allow this action
                      (phone_lines:read).
                    code: PERMISSION_DENIED
                workspace_membership_required:
                  summary: No longer a member
                  value:
                    error: >-
                      The user behind this token is not an active member of this
                      workspace.
                    code: WORKSPACE_MEMBERSHIP_REQUIRED
                workspace_archived:
                  summary: Archived workspace
                  value:
                    error: >-
                      This workspace has been archived and its API is closed. |
                      Este workspace foi arquivado e sua API está encerrada.
                    code: WORKSPACE_ARCHIVED
                tenantRequired:
                  summary: Credential not bound to a workspace
                  value:
                    error: This credential is not bound to a workspace.
                    code: TENANT_REQUIRED
        '404':
          description: No such line in your workspace
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Line not found. | Linha não encontrada.
                code: LINE_NOT_FOUND
        '500':
          description: Unexpected failure
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Unexpected error. | Erro inesperado.
                code: INTERNAL_ERROR
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Your ps_ API key
    apiKeyId:
      type: apiKey
      in: header
      name: x-api-key-id
      description: API key id (alternative to x-api-key)

````

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