> ## 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.

# Poll activation

> One code request: its `status` and, once `TRANSCRIBED`, its `code`. Poll it after `POST /v1/phone-lines/{id}/activations` every few seconds — the status can only move after our next check of the line, about every 15 seconds.

**Do not stop polling at the first status that is not `WAITING`.** Keep polling while `status` is `WAITING`, or `CAPTURED` with `failureReason: null` (the call arrived and its code is being read — a failed transcription is retried from the stored recording, up to 3 attempts in all, so this can last a few minutes). `TRANSCRIBED` does not guarantee a code — check `code` (`null` with `no_code_in_transcript` when no 6-digit code was heard). `TIMED_OUT` is recorded at the first check after `pollDeadline`, up to about 15 seconds later; that check still reads the line one last time, so a request can also move from `WAITING` to `CAPTURED` just after its `pollDeadline`.

The recording is not in this answer: `hasAudio: true` says there is one, served by `GET /v1/phone-lines/activations/{activationId}/audio`. A request of another workspace answers `404 ACTIVATION_NOT_FOUND`, the same as one that does not exist. Sent with `Cache-Control: no-store`: the code is a credential.

**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/activations/{activationId}
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/activations/{activationId}:
    get:
      tags:
        - Phone Lines
      summary: Poll a code request
      description: >-
        One code request: its `status` and, once `TRANSCRIBED`, its `code`. Poll
        it after `POST /v1/phone-lines/{id}/activations` every few seconds — the
        status can only move after our next check of the line, about every 15
        seconds.


        **Do not stop polling at the first status that is not `WAITING`.** Keep
        polling while `status` is `WAITING`, or `CAPTURED` with `failureReason:
        null` (the call arrived and its code is being read — a failed
        transcription is retried from the stored recording, up to 3 attempts in
        all, so this can last a few minutes). `TRANSCRIBED` does not guarantee a
        code — check `code` (`null` with `no_code_in_transcript` when no 6-digit
        code was heard). `TIMED_OUT` is recorded at the first check after
        `pollDeadline`, up to about 15 seconds later; that check still reads the
        line one last time, so a request can also move from `WAITING` to
        `CAPTURED` just after its `pollDeadline`.


        The recording is not in this answer: `hasAudio: true` says there is one,
        served by `GET /v1/phone-lines/activations/{activationId}/audio`. A
        request of another workspace answers `404 ACTIVATION_NOT_FOUND`, the
        same as one that does not exist. Sent with `Cache-Control: no-store`:
        the code is a credential.


        **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_activations_activationid
      parameters:
        - name: activationId
          in: path
          required: true
          schema:
            type: string
          example: cmg5k3a7c0002ac8example4q
          description: >-
            The code request id (`activation.id`, returned by `POST
            /v1/phone-lines/{id}/activations`).
      responses:
        '200':
          description: 'The code request. 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:
                  activation:
                    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:
                  - activation
              examples:
                transcribed:
                  summary: TRANSCRIBED — code ready
                  value:
                    activation:
                      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
                waiting:
                  summary: WAITING — keep polling
                  value:
                    activation:
                      id: cmg5k3a7c0002ac8example4q
                      lineId: cmg5k2l1n0001pl8example9x
                      status: WAITING
                      requestedAt: '2026-10-01T14:10:00.000Z'
                      pollDeadline: '2026-10-01T14:15:00.000Z'
                      code: null
                      capturedAt: null
                      transcribedAt: null
                      failureReason: null
                      hasAudio: false
        '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 code request in your workspace
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Code request not found. | Pedido de código não encontrado.
                code: ACTIVATION_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.