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

# Get line webhook delivery

> Returns `{ "delivery": { … } }`: the list's fields plus the last attempt's `durationMs` and `responseBody`, and **`payload` — the exact body that was POSTed and signed, as a JSON string**, so you can check your signature code against it. ⚠️ A `phone_line.code_received` payload carries the **activation code**, a credential: the response is sent with `Cache-Control: private, no-store` — do not log it. A delivery of another webhook or workspace, or an unknown id, answers **404 `WEBHOOK_DELIVERY_NOT_FOUND`**.

Permissions: with an OAuth / MCP token, the user must be an **Owner or Admin** (`phone_lines:webhooks`) — `403 PERMISSION_DENIED` otherwise.

Every `/v1/phone-lines` endpoint takes a **tenant-scoped** key only: phone-line webhooks belong to the workspace, not to a WhatsApp number, so a number-scoped key (or a per-number OAuth grant) gets `403 NUMBER_SCOPE_NOT_ALLOWED` before any role is looked at. A `403 PERMISSION_DENIED` / `WORKSPACE_MEMBERSHIP_REQUIRED` is sent with `Cache-Control: no-store`.

These are the **phone-line webhooks** — a registry separate from `/v1/webhooks`: they receive only `phone_line.*` events, and a number webhook never receives one.

**Requires a tenant-scoped key.**

> [!WARNING]
>
> **The `payload` may contain an activation code**, which is a credential: whoever has it can register a WhatsApp account on the line. Do not share or log this response. See [Phone line webhooks](https://docs.pilotstatus.com.br/api/phone-lines/webhooks.md).


## OpenAPI

````yaml openapi.json GET /v1/phone-lines/webhooks/{id}/deliveries/{deliveryId}
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/webhooks/{id}/deliveries/{deliveryId}:
    get:
      tags:
        - Phone Lines
      summary: Get a webhook delivery
      description: >-
        Returns `{ "delivery": { … } }`: the list's fields plus the last
        attempt's `durationMs` and `responseBody`, and **`payload` — the exact
        body that was POSTed and signed, as a JSON string**, so you can check
        your signature code against it. ⚠️ A `phone_line.code_received` payload
        carries the **activation code**, a credential: the response is sent with
        `Cache-Control: private, no-store` — do not log it. A delivery of
        another webhook or workspace, or an unknown id, answers **404
        `WEBHOOK_DELIVERY_NOT_FOUND`**.


        Permissions: with an OAuth / MCP token, the user must be an **Owner or
        Admin** (`phone_lines:webhooks`) — `403 PERMISSION_DENIED` otherwise.


        Every `/v1/phone-lines` endpoint takes a **tenant-scoped** key only:
        phone-line webhooks belong to the workspace, not to a WhatsApp number,
        so a number-scoped key (or a per-number OAuth grant) gets `403
        NUMBER_SCOPE_NOT_ALLOWED` before any role is looked at. A `403
        PERMISSION_DENIED` / `WORKSPACE_MEMBERSHIP_REQUIRED` is sent with
        `Cache-Control: no-store`.


        These are the **phone-line webhooks** — a registry separate from
        `/v1/webhooks`: they receive only `phone_line.*` events, and a number
        webhook never receives one.


        **Requires a tenant-scoped key.**
      operationId: get_phone_lines_webhooks_id_deliveries_deliveryid
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          example: cmh1w8b2k0001wh8example3d
          description: >-
            The webhook's `id` (from `GET /v1/phone-lines/webhooks` or the
            create response).
        - name: deliveryId
          in: path
          required: true
          schema:
            type: string
          example: cmh1w9c4m0002dl8example5f
          description: >-
            The delivery's `id` (from the deliveries list, or the `id` your
            endpoint received).
      responses:
        '200':
          description: The delivery in full
          content:
            application/json:
              schema:
                type: object
                properties:
                  delivery:
                    type: object
                    properties:
                      id:
                        type: string
                        description: >-
                          The delivery id — the same `id` (and `Idempotency-Key`
                          header) your endpoint received.
                        example: cmh1w9c4m0002dl8example5f
                      event:
                        type: string
                        example: phone_line.code_received
                      status:
                        type: string
                        enum:
                          - PENDING
                          - DELIVERED
                          - FAILED
                        description: >-
                          `PENDING` (still being attempted), `DELIVERED` or
                          `FAILED` (attempts exhausted, or the webhook was
                          paused).
                        example: DELIVERED
                      attempts:
                        type: integer
                        description: Attempts so far (at most 6).
                        example: 1
                      responseStatus:
                        type:
                          - integer
                          - 'null'
                        description: >-
                          HTTP status of the last attempt, `null` when it got no
                          HTTP answer.
                        example: 200
                      lastError:
                        type:
                          - string
                          - 'null'
                        description: Why the last attempt failed, `null` when it did not.
                        example: null
                      createdAt:
                        type: string
                        format: date-time
                        example: '2026-10-27T14:11:51.000Z'
                      deliveredAt:
                        type:
                          - string
                          - 'null'
                        format: date-time
                        example: '2026-10-27T14:11:52.000Z'
                      durationMs:
                        type:
                          - integer
                          - 'null'
                        description: >-
                          How long the last attempt took, up to the response
                          headers. `null` when it made no request.
                        example: 184
                      responseBody:
                        type:
                          - string
                          - 'null'
                        description: >-
                          The last attempt's response body, at most 1000
                          characters. `null` when it got no HTTP answer.
                        example: ok
                      payload:
                        type: string
                        description: >-
                          The **exact body that was POSTed and signed**, as a
                          JSON **string** — compute the HMAC over it to check
                          your signature code. ⚠️ A `phone_line.code_received`
                          payload carries the activation code, a credential.
                        example: >-
                          {"id":"cmh1w9c4m0002dl8example5f","event":"phone_line.code_received","createdAt":"2026-10-27T14:11:51.000Z","data":{"lineId":"cmg5k2l1n0001pl8example9x","number":"551148637200","name":"Suporte
                          SP","activationId":"cmg5k3a7c0002ac8example4q","code":"123456","failureReason":null,"audioUrl":"https://pilotstatus.com.br/v1/phone-lines/activations/cmg5k3a7c0002ac8example4q/audio"}}
              example:
                delivery:
                  id: cmh1w9c4m0002dl8example5f
                  event: phone_line.code_received
                  status: DELIVERED
                  attempts: 1
                  responseStatus: 200
                  lastError: null
                  createdAt: '2026-10-27T14:11:51.000Z'
                  deliveredAt: '2026-10-27T14:11:52.000Z'
                  durationMs: 184
                  responseBody: ok
                  payload: >-
                    {"id":"cmh1w9c4m0002dl8example5f","event":"phone_line.code_received","createdAt":"2026-10-27T14:11:51.000Z","data":{"lineId":"cmg5k2l1n0001pl8example9x","number":"551148637200","name":"Suporte
                    SP","activationId":"cmg5k3a7c0002ac8example4q","code":"123456","failureReason":null,"audioUrl":"https://pilotstatus.com.br/v1/phone-lines/activations/cmg5k3a7c0002ac8example4q/audio"}}
          headers:
            Cache-Control:
              schema:
                type: string
              example: no-store
        '401':
          description: >-
            Missing or invalid credential (`x-api-key`, `x-api-key-id` or
            `Authorization: Bearer`). The body carries only `error`, no `code`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              examples:
                missing:
                  summary: No credential
                  value:
                    error: >-
                      Missing x-api-key, x-api-key-id or Authorization Bearer
                      token
                invalid:
                  summary: Invalid API key
                  value:
                    error: Invalid API key
        '403':
          description: >-
            Number-scoped key (`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`), or 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:
                numberScope:
                  summary: Number-scoped key
                  value:
                    error: This endpoint requires a tenant-scoped API key
                    code: NUMBER_SCOPE_NOT_ALLOWED
                permissionDenied:
                  summary: OAuth/MCP user who is not Owner or Admin
                  value:
                    error: >-
                      Your workspace role does not allow this action
                      (phone_lines:webhooks).
                    code: PERMISSION_DENIED
                notMember:
                  summary: OAuth/MCP user no longer a member
                  value:
                    error: >-
                      The user behind this token is not an active member of this
                      workspace.
                    code: WORKSPACE_MEMBERSHIP_REQUIRED
                archived:
                  summary: Workspace archived
                  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 delivery on this webhook of your workspace
            (`WEBHOOK_DELIVERY_NOT_FOUND`)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: >-
                  Webhook delivery not found. | Entrega do webhook não
                  encontrada.
                code: WEBHOOK_DELIVERY_NOT_FOUND
        '500':
          description: Unexpected failure (`INTERNAL_ERROR`).
          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.