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

# Configurar un formulario instantáneo

> Crea o reemplaza la configuración de un formulario: qué casilla de consentimiento significa "puede enviarme mensajes por WhatsApp", y si cada lead nuevo del formulario recibe un **mensaje automático de WhatsApp**, enviado por Pilot Status sin intervención humana, así que una configuración que este endpoint acepta enviará mensajes a los leads.

Envía el objeto completo. Reglas: el envío automático requiere `consentDisclaimerKey` (`400 CONSENT_REQUIRED`). En un número **oficial**, el mensaje es una plantilla APPROVED del número (`templateId`; `400 TEMPLATE_REQUIRED`, `TEMPLATE_NOT_ELIGIBLE`, `FREE_TEXT_NOT_ALLOWED`). En un número **no oficial**, es `freeText` con marcadores `{{name}}` (`400 FREE_TEXT_REQUIRED`, `TEMPLATE_NOT_ALLOWED`; un marcador con espacios se rechaza como `VALIDATION_FAILED` con `INVALID_PLACEHOLDER`). Cada variable debe estar mapeada en `variableMap` a una respuesta del formulario (`{ "source": "field", "key": "<question key>" }`) o a un valor fijo (`{ "source": "static", "value": "..." }`); de lo contrario, `400 VARIABLES_UNMAPPED` con `missingVariables`. Las reglas del mensaje solo se aplican con `autoSendEnabled: true`, así que puedes guardar primero la casilla de consentimiento y un borrador.

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 PUT /v1/lead-pages/{pageLinkId}/forms/{formId}
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/{pageLinkId}/forms/{formId}:
    put:
      tags:
        - Ads
      summary: Configurar un formulario instantáneo
      description: >-
        Crea o reemplaza la configuración de un formulario: qué casilla de
        consentimiento significa "puede enviarme mensajes por WhatsApp", y si
        cada lead nuevo del formulario recibe un **mensaje automático de
        WhatsApp**, enviado por Pilot Status sin intervención humana, así que
        una configuración que este endpoint acepta enviará mensajes a los leads.


        Envía el objeto completo. Reglas: el envío automático requiere
        `consentDisclaimerKey` (`400 CONSENT_REQUIRED`). En un número
        **oficial**, el mensaje es una plantilla APPROVED del número
        (`templateId`; `400 TEMPLATE_REQUIRED`, `TEMPLATE_NOT_ELIGIBLE`,
        `FREE_TEXT_NOT_ALLOWED`). En un número **no oficial**, es `freeText` con
        marcadores `{{name}}` (`400 FREE_TEXT_REQUIRED`, `TEMPLATE_NOT_ALLOWED`;
        un marcador con espacios se rechaza como `VALIDATION_FAILED` con
        `INVALID_PLACEHOLDER`). Cada variable debe estar mapeada en
        `variableMap` a una respuesta del formulario (`{ "source": "field",
        "key": "<question key>" }`) o a un valor fijo (`{ "source": "static",
        "value": "..." }`); de lo contrario, `400 VARIABLES_UNMAPPED` con
        `missingVariables`. Las reglas del mensaje solo se aplican con
        `autoSendEnabled: true`, así que puedes guardar primero la casilla de
        consentimiento y un borrador.


        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: put_lead-page-form
      parameters:
        - name: pageLinkId
          in: path
          required: true
          description: >-
            El id del vínculo (`linked[].pageLinkId` de `GET /v1/lead-pages`),
            no el id de la página de Facebook.
          schema:
            type: string
          example: cmgpl0001ab12cd34ef56
        - name: formId
          in: path
          required: true
          description: Id numérico del formulario instantáneo (`forms[].formId`).
          schema:
            type: string
          example: '987654321098765'
        - 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:
                consentDisclaimerKey:
                  type:
                    - string
                    - 'null'
                  description: >-
                    `key` de la casilla de consentimiento
                    (`consentCheckboxes[].key`). Obligatorio para el envío
                    automático.
                  example: whatsapp_optin
                autoSendEnabled:
                  type: boolean
                  description: >-
                    Enviar un mensaje automáticamente a cada lead nuevo del
                    formulario.
                  example: true
                templateId:
                  type:
                    - string
                    - 'null'
                  description: >-
                    Números oficiales: una plantilla APPROVED del número
                    (`templates[].id`). Debe ser `null` en números no oficiales.
                  example: null
                freeText:
                  type:
                    - string
                    - 'null'
                  maxLength: 4096
                  description: >-
                    Números no oficiales: el mensaje, con marcadores `{{name}}`.
                    Debe ser `null` en números oficiales.
                  example: Olá {{nome}}, recebemos seu pedido de orçamento!
                variableMap:
                  type: object
                  description: >-
                    Valor de cada variable de la plantilla o marcador: `{
                    "source": "field", "key": "<question key>" }` o `{ "source":
                    "static", "value": "..." }`. Por defecto es `{}`.
                  additionalProperties:
                    type: object
                  example:
                    nome:
                      source: field
                      key: full_name
                formName:
                  type:
                    - string
                    - 'null'
                  maxLength: 255
                  description: Etiqueta opcional para mostrar el formulario.
                  example: Orçamento — Outubro
              required:
                - consentDisclaimerKey
                - autoSendEnabled
                - templateId
                - freeText
              additionalProperties: false
      responses:
        '200':
          description: Configuración guardada
          content:
            application/json:
              example:
                config:
                  formId: '987654321098765'
                  formName: Orçamento — Outubro
                  consentDisclaimerKey: whatsapp_optin
                  autoSendEnabled: true
                  templateId: null
                  freeText: Olá {{nome}}, recebemos seu pedido de orçamento!
                  variableMap:
                    nome:
                      source: field
                      key: full_name
                  updatedAt: '2026-10-21T09:30:00.000Z'
        '400':
          description: >-
            `INVALID_BODY`, `UNKNOWN_FIELDS`, `VALIDATION_FAILED` (`formId` o
            cuerpo inválido, con `details`), o un rechazo por regla:
            `CONSENT_REQUIRED`, `TEMPLATE_REQUIRED`, `TEMPLATE_NOT_ELIGIBLE`,
            `TEMPLATE_NOT_ALLOWED`, `FREE_TEXT_REQUIRED`,
            `FREE_TEXT_NOT_ALLOWED`, `VARIABLES_UNMAPPED` (con
            `missingVariables`); también `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: >-
                  Every variable in the text needs a value. | Todas as variáveis
                  do texto precisam de um valor.
                code: VARIABLES_UNMAPPED
                missingVariables:
                  - cidade
        '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: >-
            Vínculo de página no encontrado: nunca se vinculó, ya se desvinculó
            o es de otro workspace
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Page link not found | Vínculo de página não encontrado
                code: NOT_FOUND
        '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
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.