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

# Cancel activation wait

> Ends a code request that is still `WAITING` — no body — so the next `POST /v1/phone-lines/{id}/activations` is accepted at once instead of answering `409 ACTIVATION_IN_PROGRESS` until the window closes.

Answers `200` with the request, now `TIMED_OUT` with `failureReason: "canceled_by_customer"`, sent with `Cache-Control: no-store`. The line is no longer watched for that request. Like any request that ends without a code, it sends `phone_line.code_failed` and `phone_line.code_received` (with `code: null`) once, with `canceled_by_customer`.

**A call that already arrived is never thrown away.** Once the call is captured the request is no longer `WAITING`, and the cancel answers `409 ACTIVATION_NOT_WAITING` — keep polling: its code is being read. The same 409 answers a request that already ended. Nothing changes in either case. `{id}` must be the line the request belongs to: a line that is not in your workspace answers `404 LINE_NOT_FOUND`; a request that is not on that line — or not in your workspace — answers `404 ACTIVATION_NOT_FOUND`.

**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).



## OpenAPI

````yaml openapi.json POST /v1/phone-lines/{id}/activations/{activationId}/cancel
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/{activationId}/cancel:
    post:
      tags:
        - Phone Lines
      summary: Cancel a wait
      description: >-
        Ends a code request that is still `WAITING` — no body — so the next
        `POST /v1/phone-lines/{id}/activations` is accepted at once instead of
        answering `409 ACTIVATION_IN_PROGRESS` until the window closes.


        Answers `200` with the request, now `TIMED_OUT` with `failureReason:
        "canceled_by_customer"`, sent with `Cache-Control: no-store`. The line
        is no longer watched for that request. Like any request that ends
        without a code, it sends `phone_line.code_failed` and
        `phone_line.code_received` (with `code: null`) once, with
        `canceled_by_customer`.


        **A call that already arrived is never thrown away.** Once the call is
        captured the request is no longer `WAITING`, and the cancel answers `409
        ACTIVATION_NOT_WAITING` — keep polling: its code is being read. The same
        409 answers a request that already ended. Nothing changes in either
        case. `{id}` must be the line the request belongs to: a line that is not
        in your workspace answers `404 LINE_NOT_FOUND`; a request that is not on
        that line — or not in your workspace — answers `404
        ACTIVATION_NOT_FOUND`.


        **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: post_phone_lines_id_activations_activationid_cancel
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          example: cmg5k2l1n0001pl8example9x
          description: >-
            The line the request belongs to. A request that is not on this line
            answers `404 ACTIVATION_NOT_FOUND`.
        - 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: >-
            Wait cancelled — the request is now `TIMED_OUT` with
            `canceled_by_customer`. 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
              example:
                activation:
                  id: cmg5k3a7c0002ac8example4q
                  lineId: cmg5k2l1n0001pl8example9x
                  status: TIMED_OUT
                  requestedAt: '2026-10-01T14:10:00.000Z'
                  pollDeadline: '2026-10-01T14:15:00.000Z'
                  code: null
                  capturedAt: null
                  transcribedAt: null
                  failureReason: canceled_by_customer
                  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: >-
            `LINE_NOT_FOUND` — no such line in your workspace;
            `ACTIVATION_NOT_FOUND` — no such request on that line in your
            workspace
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              examples:
                line_not_found:
                  summary: Line not in your workspace
                  value:
                    error: Line not found. | Linha não encontrada.
                    code: LINE_NOT_FOUND
                activation_not_found:
                  summary: Request not on that line, or not in your workspace
                  value:
                    error: Code request not found. | Pedido de código não encontrado.
                    code: ACTIVATION_NOT_FOUND
        '409':
          description: >-
            `ACTIVATION_NOT_WAITING` — the call was already captured (its code
            is being read: keep polling) or the request already ended. Nothing
            changed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: >-
                  This code request is no longer waiting for the call: the call
                  was already captured, or the request already ended. | Este
                  pedido de código não está mais esperando a ligação: a ligação
                  já foi capturada ou o pedido já terminou.
                code: ACTIVATION_NOT_WAITING
        '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.