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

> ## Agent Instructions
> Integrating Pilot Status end to end? Follow https://docs.pilotstatus.com.br/guides/integrate-with-ai.md (pt-BR: https://docs.pilotstatus.com.br/pt-BR/guides/integrate-with-ai.md). No step requires contacting support: every credential is shown in the dashboard or in an API response, and a lost one is regenerated, not recovered.
> Webhook signing secret: shown ONCE in the Signing secret window right after creating the webhook on /webhooks, and in the `secret` field of the POST /v1/webhooks response (MCP: webhooks_create). Lost it: Edit Webhook → Generate a new secret, POST /v1/webhooks/{id}/rotate-secret, or webhooks_rotate_secret (the old one stops working at once). Verify `x-pilot-status-signature` = hex HMAC-SHA256 of the raw request body keyed with that secret.
> Meta verify token (number connected with the user's own Meta app credentials): Meta Number Created! window after connecting, then the number's card on Numbers (workspace Owner), or webhook.verifyToken in the POST /v1/numbers/meta response. It is not the webhook signing secret.
> REST auth: `x-api-key: ps_...` header, never Authorization: Bearer. MCP: https://mcp.pilotstatus.com.br/mcp (148 tools, OAuth 2.1 or x-api-key); Code Mode: https://mcp.pilotstatus.com.br/code. Destructive MCP tools return a preview and a confirm_token: show the preview and call again only after the user's explicit yes. Over OAuth, revealing or creating ps_ API keys is workspace Owner only.

# Obtener entrega del webhook de línea

> Devuelve `{ "delivery": { … } }`: los campos de la lista más `durationMs` y `responseBody` del último intento, y **`payload`: el cuerpo exacto que se envió por POST y se firmó, como string JSON**, para que puedas comprobar tu código de firma con él. ⚠️ Un payload `phone_line.code_received` lleva el **código de activación**, una credencial: la respuesta se envía con `Cache-Control: private, no-store`, no la registres en logs. Una entrega de otro webhook o workspace, o un id desconocido, responde **404 `WEBHOOK_DELIVERY_NOT_FOUND`**.

Permisos: con una clave de cuenta (`ps_account_`) o un token OAuth / MCP, el usuario debe ser **Owner o Admin** (`phone_lines:webhooks`); de lo contrario, `403 PERMISSION_DENIED`.

Todos los endpoints de `/v1/phone-lines` aceptan solo una clave **con alcance de tenant**: los webhooks de líneas telefónicas pertenecen al workspace, no a un número de WhatsApp, por lo que una clave con alcance de número (o una autorización OAuth por número) recibe `403 NUMBER_SCOPE_NOT_ALLOWED` antes de que se evalúe cualquier rol. Un `403 PERMISSION_DENIED` / `WORKSPACE_MEMBERSHIP_REQUIRED` se envía con `Cache-Control: no-store`.

Estos son los **webhooks de líneas telefónicas**, un registro separado de `/v1/webhooks`: reciben solo eventos `phone_line.*`, y un webhook de número nunca recibe ninguno.

**Requiere una clave con alcance de tenant.**

> [!WARNING]
>
> **El `payload` puede contener un código de activación**, que es una credencial: quien lo tenga puede registrar una cuenta de WhatsApp en la línea. No comparta ni registre esta respuesta en logs. Consulte [Webhooks de líneas telefónicas](https://docs.pilotstatus.com.br/es/api/phone-lines/webhooks.md).


## OpenAPI

````yaml openapi.es.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: >-
    API REST pública de Pilot Status. Autentícate con el encabezado `x-api-key:
    ps_...` (o `x-api-key-id`). URL base: 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: Obtener una entrega de webhook
      description: >-
        Devuelve `{ "delivery": { … } }`: los campos de la lista más
        `durationMs` y `responseBody` del último intento, y **`payload`: el
        cuerpo exacto que se envió por POST y se firmó, como string JSON**, para
        que puedas comprobar tu código de firma con él. ⚠️ Un payload
        `phone_line.code_received` lleva el **código de activación**, una
        credencial: la respuesta se envía con `Cache-Control: private,
        no-store`, no la registres en logs. Una entrega de otro webhook o
        workspace, o un id desconocido, responde **404
        `WEBHOOK_DELIVERY_NOT_FOUND`**.


        Permisos: con una clave de cuenta (`ps_account_`) o un token OAuth /
        MCP, el usuario debe ser **Owner o Admin** (`phone_lines:webhooks`); de
        lo contrario, `403 PERMISSION_DENIED`.


        Todos los endpoints de `/v1/phone-lines` aceptan solo una clave **con
        alcance de tenant**: los webhooks de líneas telefónicas pertenecen al
        workspace, no a un número de WhatsApp, por lo que una clave con alcance
        de número (o una autorización OAuth por número) recibe `403
        NUMBER_SCOPE_NOT_ALLOWED` antes de que se evalúe cualquier rol. Un `403
        PERMISSION_DENIED` / `WORKSPACE_MEMBERSHIP_REQUIRED` se envía con
        `Cache-Control: no-store`.


        Estos son los **webhooks de líneas telefónicas**, un registro separado
        de `/v1/webhooks`: reciben solo eventos `phone_line.*`, y un webhook de
        número nunca recibe ninguno.


        **Requiere una clave con alcance de tenant.**
      operationId: get_phone_lines_webhooks_id_deliveries_deliveryid
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          example: cmh1w8b2k0001wh8example3d
          description: >-
            El `id` del webhook (de `GET /v1/phone-lines/webhooks` o de la
            respuesta de creación).
        - name: deliveryId
          in: path
          required: true
          schema:
            type: string
          example: cmh1w9c4m0002dl8example5f
          description: >-
            El `id` de la entrega (de la lista de entregas, o el `id` que
            recibió tu endpoint).
        - name: x-workspace-id
          in: header
          required: false
          schema:
            type: string
          description: >-
            Solo con una clave de cuenta (`ps_account_`): el workspace sobre el
            que actuar, de `GET /v1/workspaces`. Sin él, una clave de cuenta
            recibe `400 WORKSPACE_ID_REQUIRED`.
          example: cmh2a9z8y0002ws8example1q
      responses:
        '200':
          description: La entrega completa
          content:
            application/json:
              schema:
                type: object
                properties:
                  delivery:
                    type: object
                    properties:
                      id:
                        type: string
                        description: >-
                          El id de la entrega: el mismo `id` (y encabezado
                          `Idempotency-Key`) que recibió tu endpoint.
                        example: cmh1w9c4m0002dl8example5f
                      event:
                        type: string
                        example: phone_line.code_received
                      status:
                        type: string
                        enum:
                          - PENDING
                          - DELIVERED
                          - FAILED
                        description: >-
                          `PENDING` (aún en intentos), `DELIVERED` o `FAILED`
                          (intentos agotados, o el webhook fue pausado).
                        example: DELIVERED
                      attempts:
                        type: integer
                        description: Intentos hasta ahora (como máximo 6).
                        example: 1
                      responseStatus:
                        type:
                          - integer
                          - 'null'
                        description: >-
                          Estado HTTP del último intento, `null` cuando no
                          obtuvo respuesta HTTP.
                        example: 200
                      lastError:
                        type:
                          - string
                          - 'null'
                        description: >-
                          Por qué falló el último intento, `null` cuando no
                          falló.
                        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: >-
                          Cuánto tardó el último intento, hasta los encabezados
                          de la respuesta. `null` cuando no hizo ninguna
                          solicitud.
                        example: 184
                      responseBody:
                        type:
                          - string
                          - 'null'
                        description: >-
                          El cuerpo de la respuesta del último intento, como
                          máximo 1000 caracteres. `null` cuando no obtuvo
                          respuesta HTTP.
                        example: ok
                      payload:
                        type: string
                        description: >-
                          El **cuerpo exacto que se envió por POST y se firmó**,
                          como **string** JSON: calcula el HMAC sobre él para
                          comprobar tu código de firma. ⚠️ Un payload
                          `phone_line.code_received` lleva el código de
                          activación, una credencial.
                        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: >-
            Credencial ausente o inválida (`x-api-key`, `x-api-key-id` o
            `Authorization: Bearer`). El cuerpo trae solo `error`, sin `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: >-
            Key limitada a un número (`NUMBER_SCOPE_NOT_ALLOWED`), token
            OAuth/MCP de un usuario que no es Owner ni Admin
            (`PERMISSION_DENIED`) o que ya no es miembro activo
            (`WORKSPACE_MEMBERSHIP_REQUIRED`), o workspace archivado
            (`WORKSPACE_ARCHIVED`). `TENANT_REQUIRED`: credencial no ligada a
            ningún 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 existe esa entrega en este webhook de tu 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: Falla inesperada (`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: Tu API key ps_
    apiKeyId:
      type: apiKey
      in: header
      name: x-api-key-id
      description: Id de la API key (alternativa a x-api-key)

````

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