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

# Actualizar webhook de línea

> ⚠️ **Efecto real.** Cambia los campos que envías y responde `{ "webhook": { … } }`; un campo ausente se deja como está. `active: false` **pausa** el webhook (no recibe entregas: una entrega que ya está en sus reintentos se marca como fallida en su siguiente intento) y `active: true` lo reanuda; los eventos ocurridos mientras estaba pausado nunca se envían.

El webhook resultante se valida como en la creación. **Solo una URL que cambia se vuelve a verificar** contra destinos internos, así que un webhook siempre se puede pausar o editar sus eventos. Un `name` enviado en blanco se convierte en el host de la URL (nueva o guardada). **Editar nunca cambia el secreto de firma**, y el secreto no se devuelve.

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



## OpenAPI

````yaml openapi.es.json PATCH /v1/phone-lines/webhooks/{id}
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}:
    patch:
      tags:
        - Phone Lines
      summary: Actualizar o pausar un webhook de línea telefónica
      description: >-
        ⚠️ **Efecto real.** Cambia los campos que envías y responde `{
        "webhook": { … } }`; un campo ausente se deja como está. `active: false`
        **pausa** el webhook (no recibe entregas: una entrega que ya está en sus
        reintentos se marca como fallida en su siguiente intento) y `active:
        true` lo reanuda; los eventos ocurridos mientras estaba pausado nunca se
        envían.


        El webhook resultante se valida como en la creación. **Solo una URL que
        cambia se vuelve a verificar** contra destinos internos, así que un
        webhook siempre se puede pausar o editar sus eventos. Un `name` enviado
        en blanco se convierte en el host de la URL (nueva o guardada). **Editar
        nunca cambia el secreto de firma**, y el secreto no se devuelve.


        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: patch_phone_lines_webhooks_id
      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: 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
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                name:
                  type: string
                  maxLength: 100
                  description: >-
                    Opcional, hasta 100 caracteres (`400 INVALID_WEBHOOK_NAME`
                    si se pasa). En blanco o ausente → el host de la URL.
                  example: Phone lines — production
                url:
                  type: string
                  description: >-
                    Debe ser `https` y apuntar a una dirección pública. Una URL
                    que apunta a una dirección de red interna o privada
                    (`localhost`, una IP de loopback o privada, un host sin
                    punto, o un nombre que resuelve a una de ellas) → `400
                    WEBHOOK_URL_REFUSED`.
                  example: https://hooks.example.com/pilot/phone-lines
                events:
                  type: array
                  minItems: 1
                  items:
                    type: string
                    enum:
                      - phone_line.purchased
                      - phone_line.audio_received
                      - phone_line.code_received
                      - phone_line.code_failed
                      - phone_line.renewed
                      - phone_line.payment_failed
                      - phone_line.suspended
                      - phone_line.returned
                      - phone_line.canceled
                      - phone_line.verification_updated
                      - '*'
                  description: >-
                    Uno o más de los eventos de líneas telefónicas, o `"*"` para
                    todos (dentro de este registro `"*"` significa todos los
                    eventos de líneas telefónicas, incluidos los que se agreguen
                    después). Los duplicados se eliminan. Una lista vacía o un
                    evento desconocido → `400 INVALID_WEBHOOK`.
                  example:
                    - '*'
                active:
                  type: boolean
                  description: '`false` pausa, `true` reanuda.'
                  example: false
            example:
              active: false
      responses:
        '200':
          description: El webhook después del cambio
          content:
            application/json:
              schema:
                type: object
                properties:
                  webhook:
                    type: object
                    properties:
                      id:
                        type: string
                        description: >-
                          El id del webhook. Úsalo en todas las rutas
                          `/v1/phone-lines/webhooks/{id}`.
                        example: cmh1w8b2k0001wh8example3d
                      name:
                        type: string
                        description: >-
                          Hasta 100 caracteres. **Nunca vacío:** si se crea o
                          edita en blanco, es el host de la URL
                          (`hooks.example.com`). No se envía en las entregas: el
                          `name` de una entrega es el de la línea.
                        example: hooks.example.com
                      url:
                        type: string
                        description: El destino `https`, normalizado.
                        example: https://hooks.example.com/pilot/phone-lines
                      events:
                        type: array
                        items:
                          type: string
                        description: >-
                          Los eventos suscritos, o `["*"]`: todos los eventos de
                          líneas telefónicas, incluidos los que se agreguen
                          después.
                        example:
                          - '*'
                      active:
                        type: boolean
                        description: '`false` = pausado: no recibe entregas.'
                        example: true
                      lastDeliveryAt:
                        type:
                          - string
                          - 'null'
                        format: date-time
                        description: >-
                          ISO 8601: la última entrega **exitosa**, `null` antes
                          de la primera. Un intento fallido no la cambia.
                        example: '2026-10-27T14:11:51.000Z'
                      lastStatusCode:
                        type:
                          - integer
                          - 'null'
                        description: >-
                          El último estado HTTP que respondió tu endpoint,
                          exitoso o no, `null` cuando no hay ninguno.
                        example: 200
                      createdAt:
                        type: string
                        format: date-time
                        description: 'ISO 8601: cuándo se creó el webhook.'
                        example: '2026-10-27T13:58:02.000Z'
              example:
                webhook:
                  id: cmh1w8b2k0001wh8example3d
                  name: hooks.example.com
                  url: https://hooks.example.com/pilot/phone-lines
                  events:
                    - '*'
                  active: false
                  lastDeliveryAt: '2026-10-27T14:11:51.000Z'
                  lastStatusCode: 200
                  createdAt: '2026-10-27T13:58:02.000Z'
        '400':
          description: >-
            Solicitud inválida: el cuerpo no es un objeto JSON (`INVALID_BODY`),
            campos distintos de `name`, `url`, `events` y `active`
            (`UNKNOWN_FIELDS`, `details.unknownFields`), un campo con el tipo
            JSON incorrecto (`INVALID_FIELD_TYPE`, `details.field` /
            `details.expected`), una URL que no es `https` o una lista de
            eventos vacía / desconocida (`INVALID_WEBHOOK`), un `name` de más de
            100 caracteres (`INVALID_WEBHOOK_NAME`), o una URL que apunta a una
            dirección de red interna o privada (`WEBHOOK_URL_REFUSED`)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                  details:
                    type: object
              examples:
                invalidBody:
                  summary: Body is not a JSON object
                  value:
                    error: >-
                      Send a JSON object: { "active": false }. | Envie um objeto
                      JSON: { "active": false }.
                    code: INVALID_BODY
                unknownFields:
                  summary: Unknown field
                  value:
                    error: >-
                      Unknown field(s): secret. Accepted: name, url, events,
                      active. | Campo(s) desconhecido(s): secret. Aceitos: name,
                      url, events, active.
                    code: UNKNOWN_FIELDS
                    details:
                      unknownFields:
                        - secret
                invalidFieldType:
                  summary: Field with the wrong type
                  value:
                    error: >-
                      "active" must be true or false. | "active" deve ser true
                      ou false.
                    code: INVALID_FIELD_TYPE
                    details:
                      field: active
                      expected: boolean
                invalidWebhook:
                  summary: Not https, or empty / unknown events
                  value:
                    error: >-
                      Invalid webhook: use an https URL and known events. |
                      Webhook inválido: use uma URL https e eventos conhecidos.
                    code: INVALID_WEBHOOK
                invalidName:
                  summary: Name over 100 characters
                  value:
                    error: >-
                      Invalid webhook name: use at most 100 characters. | Nome
                      do webhook inválido: use no máximo 100 caracteres.
                    code: INVALID_WEBHOOK_NAME
                urlRefused:
                  summary: Internal or private destination
                  value:
                    error: >-
                      Webhook URL refused: it points to an internal or private
                      network address, which we never call. Use a public
                      address. | URL do webhook recusada: ela aponta para um
                      endereço interno ou de rede privada, que nunca chamamos.
                      Use um endereço público.
                    code: WEBHOOK_URL_REFUSED
        '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 ese webhook en tu workspace (`WEBHOOK_NOT_FOUND`); un
            webhook de otro workspace responde igual
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Webhook not found. | Webhook não encontrado.
                code: WEBHOOK_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.