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

# Vincular una página de Lead Ads

> Vincula una página de Facebook a un número de WhatsApp del workspace, suscribe a Pilot Status a los leads de la página y empieza a traer en segundo plano sus leads de los últimos 90 días.

Cuerpo: `pageId` (el id numérico de la página de Facebook) y `whatsappNumberId`. `whatsappNumberId` solo se puede omitir cuando la credencial está ligada a un número (una key limitada a un número, o `x-whatsapp-number-id`); un número fuera del alcance de la credencial da `403 NUMBER_NOT_IN_GRANT`. Cualquier otro campo se rechaza con `400 UNKNOWN_FIELDS`.

La propiedad y los permisos se verifican antes de escribir nada: `409 PAGE_NOT_ELIGIBLE` (con `reason` cuando se conoce: `NO_OFFICIAL_NUMBER`, `PAGE_NOT_SHARED`, `PAGE_BUSINESS_MISMATCH`; sin `reason` cuando otro workspace ya la vinculó), `409 PAGE_MISSING_PERMISSION` (con `missingTasks`), `409 PAGE_ALREADY_LINKED` (con el `pageLinkId` existente). Si Meta rechaza la suscripción, el vínculo se crea de todos modos y el motivo se devuelve en `subscriptionError`; resync lo reintenta.

Los tokens OAuth/MCP necesitan `integrations:manage` (ADMIN u OWNER del workspace) en todos los verbos, incluidas las lecturas. Alcance: una key limitada a un número, o una credencial de toda la cuenta con `x-whatsapp-number-id`, actúa solo sobre los vínculos de ese número; una credencial de toda la cuenta sin el header ve todo el workspace.



## OpenAPI

````yaml openapi.es.json POST /v1/lead-pages
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/lead-pages:
    post:
      tags:
        - Ads
      summary: Vincular una página de Lead Ads
      description: >-
        Vincula una página de Facebook a un número de WhatsApp del workspace,
        suscribe a Pilot Status a los leads de la página y empieza a traer en
        segundo plano sus leads de los últimos 90 días.


        Cuerpo: `pageId` (el id numérico de la página de Facebook) y
        `whatsappNumberId`. `whatsappNumberId` solo se puede omitir cuando la
        credencial está ligada a un número (una key limitada a un número, o
        `x-whatsapp-number-id`); un número fuera del alcance de la credencial da
        `403 NUMBER_NOT_IN_GRANT`. Cualquier otro campo se rechaza con `400
        UNKNOWN_FIELDS`.


        La propiedad y los permisos se verifican antes de escribir nada: `409
        PAGE_NOT_ELIGIBLE` (con `reason` cuando se conoce: `NO_OFFICIAL_NUMBER`,
        `PAGE_NOT_SHARED`, `PAGE_BUSINESS_MISMATCH`; sin `reason` cuando otro
        workspace ya la vinculó), `409 PAGE_MISSING_PERMISSION` (con
        `missingTasks`), `409 PAGE_ALREADY_LINKED` (con el `pageLinkId`
        existente). Si Meta rechaza la suscripción, el vínculo se crea de todos
        modos y el motivo se devuelve en `subscriptionError`; resync lo
        reintenta.


        Los tokens OAuth/MCP necesitan `integrations:manage` (ADMIN u OWNER del
        workspace) en todos los verbos, incluidas las lecturas. Alcance: una key
        limitada a un número, o una credencial de toda la cuenta con
        `x-whatsapp-number-id`, actúa solo sobre los vínculos de ese número; una
        credencial de toda la cuenta sin el header ve todo el workspace.
      operationId: post_lead-pages
      parameters:
        - name: x-whatsapp-number-id
          in: header
          required: false
          description: >-
            Restringe una credencial de toda la cuenta a un número (su id o el
            id de instancia de `GET /v1/numbers`). Sin él, una credencial de
            toda la cuenta ve todo el workspace; una key limitada a un número
            siempre ve solo su propio número.
          schema:
            type: string
          example: num_01HZX...
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                pageId:
                  type: string
                  pattern: ^\d+$
                  description: Id numérico de la página de Facebook (de `candidates`).
                  example: '109876543210987'
                whatsappNumberId:
                  type: string
                  description: >-
                    Número que recibe los leads de la página. Opcional cuando la
                    credencial está ligada a un número.
                  example: num_01HZX...
              required:
                - pageId
              additionalProperties: false
      responses:
        '201':
          description: Página vinculada
          content:
            application/json:
              example:
                link:
                  pageLinkId: cmgpl0001ab12cd34ef56
                  pageId: '109876543210987'
                  pageName: MM Design Outlet
                  whatsappNumberId: num_01HZX...
                  subscribedAt: '2026-10-06T10:15:00.000Z'
                  subscriptionError: null
                  linkedAt: '2026-10-06T10:14:58.000Z'
                  leadsCount: 0
        '400':
          description: >-
            `INVALID_BODY`, `UNKNOWN_FIELDS` (con `unknownFields`),
            `VALIDATION_FAILED` (`pageId` no numérico, o sin `whatsappNumberId`
            en una credencial no ligada a un número), o `NUMBER_REQUIRED` (un
            permiso OAuth por número sin `x-whatsapp-number-id`) o
            `NUMBER_NOT_FOUND` (una key limitada a un número cuyo número fue
            eliminado)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Validation failed | Falha na validação
                code: VALIDATION_FAILED
        '401':
          description: Encabezado `x-api-key` / `x-api-key-id` ausente o inválido
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Unauthorized
        '403':
          description: >-
            El número está fuera del alcance de la credencial
            (`NUMBER_NOT_IN_GRANT`), o un token OAuth cuyo rol en el workspace
            no tiene `integrations:manage` (`PERMISSION_DENIED`)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: >-
                  This credential is not granted access to that WhatsApp number
                  | Esta credencial não tem acesso a esse número de WhatsApp
                code: NUMBER_NOT_IN_GRANT
        '404':
          description: '`whatsappNumberId` no es un número de este workspace'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: WhatsApp number not found | Número de WhatsApp não encontrado
                code: NUMBER_NOT_FOUND
        '409':
          description: >-
            `PAGE_ALREADY_LINKED` (con `pageLinkId`), `PAGE_NOT_ELIGIBLE` (con
            `reason` cuando se conoce) o `PAGE_MISSING_PERMISSION` (con
            `missingTasks`)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: >-
                  Pilot Status does not have the required permissions on this
                  Page yet. | A Pilot Status ainda não tem as permissões
                  necessárias nesta página.
                code: PAGE_MISSING_PERMISSION
                missingTasks:
                  - MANAGE_LEADS
        '500':
          description: Error interno
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Internal server error | Erro interno do servidor
                code: INTERNAL_ERROR
        '502':
          description: No se pudo contactar a Meta. Reintenta.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: >-
                  Could not reach Meta right now. Try again. | Não foi possível
                  consultar a Meta agora. Tente novamente.
                code: LEADS_LOOKUP_UNAVAILABLE
        '503':
          description: La captura de leads no está configurada en esta instalación
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: >-
                  Meta lead capture is not configured on this installation. |
                  Captura de leads da Meta não configurada nesta instalação.
                code: LEADS_NOT_CONFIGURED
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.