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

# Configure an Instant Form

> Creates or replaces one form's configuration: which consent checkbox means "may message me on WhatsApp", and whether every new lead of the form gets an **automatic WhatsApp message** — sent by Pilot Status without a human, so a configuration this endpoint accepts will message leads.

Send the whole object. Rules: auto-send requires `consentDisclaimerKey` (`400 CONSENT_REQUIRED`). On an **official** number the message is an APPROVED template of the number (`templateId`; `400 TEMPLATE_REQUIRED`, `TEMPLATE_NOT_ELIGIBLE`, `FREE_TEXT_NOT_ALLOWED`). On an **unofficial** number it is `freeText` with `{{name}}` placeholders (`400 FREE_TEXT_REQUIRED`, `TEMPLATE_NOT_ALLOWED`; a placeholder with spaces is refused as `VALIDATION_FAILED` with `INVALID_PLACEHOLDER`). Every variable must be mapped in `variableMap` to a form answer (`{ "source": "field", "key": "<question key>" }`) or a fixed value (`{ "source": "static", "value": "..." }`) — otherwise `400 VARIABLES_UNMAPPED` with `missingVariables`. The message rules apply only with `autoSendEnabled: true`, so you can save the consent checkbox and a draft first.

OAuth/MCP tokens need `integrations:manage` (workspace ADMIN or OWNER) on every verb, reads included. Scope: a number-scoped key, or an account-wide credential with `x-whatsapp-number-id`, acts only on that number's links; an account-wide credential without the header sees the whole workspace.



## OpenAPI

````yaml openapi.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: >-
    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/lead-pages/{pageLinkId}/forms/{formId}:
    put:
      tags:
        - Ads
      summary: Configure an Instant Form
      description: >-
        Creates or replaces one form's configuration: which consent checkbox
        means "may message me on WhatsApp", and whether every new lead of the
        form gets an **automatic WhatsApp message** — sent by Pilot Status
        without a human, so a configuration this endpoint accepts will message
        leads.


        Send the whole object. Rules: auto-send requires `consentDisclaimerKey`
        (`400 CONSENT_REQUIRED`). On an **official** number the message is an
        APPROVED template of the number (`templateId`; `400 TEMPLATE_REQUIRED`,
        `TEMPLATE_NOT_ELIGIBLE`, `FREE_TEXT_NOT_ALLOWED`). On an **unofficial**
        number it is `freeText` with `{{name}}` placeholders (`400
        FREE_TEXT_REQUIRED`, `TEMPLATE_NOT_ALLOWED`; a placeholder with spaces
        is refused as `VALIDATION_FAILED` with `INVALID_PLACEHOLDER`). Every
        variable must be mapped in `variableMap` to a form answer (`{ "source":
        "field", "key": "<question key>" }`) or a fixed value (`{ "source":
        "static", "value": "..." }`) — otherwise `400 VARIABLES_UNMAPPED` with
        `missingVariables`. The message rules apply only with `autoSendEnabled:
        true`, so you can save the consent checkbox and a draft first.


        OAuth/MCP tokens need `integrations:manage` (workspace ADMIN or OWNER)
        on every verb, reads included. Scope: a number-scoped key, or an
        account-wide credential with `x-whatsapp-number-id`, acts only on that
        number's links; an account-wide credential without the header sees the
        whole workspace.
      operationId: put_lead-page-form
      parameters:
        - name: pageLinkId
          in: path
          required: true
          description: >-
            The link id (`linked[].pageLinkId` from `GET /v1/lead-pages`), not
            the Facebook Page id.
          schema:
            type: string
          example: cmgpl0001ab12cd34ef56
        - name: formId
          in: path
          required: true
          description: Numeric Instant Form id (`forms[].formId`).
          schema:
            type: string
          example: '987654321098765'
        - name: x-whatsapp-number-id
          in: header
          required: false
          description: >-
            Narrows an account-wide credential to one number (its id or instance
            id from `GET /v1/numbers`). Without it, an account-wide credential
            sees the whole workspace; a number-scoped key always sees only its
            own number.
          schema:
            type: string
          example: num_01HZX...
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                consentDisclaimerKey:
                  type:
                    - string
                    - 'null'
                  description: >-
                    `key` of the consent checkbox (`consentCheckboxes[].key`).
                    Required for auto-send.
                  example: whatsapp_optin
                autoSendEnabled:
                  type: boolean
                  description: Message every new lead of the form automatically.
                  example: true
                templateId:
                  type:
                    - string
                    - 'null'
                  description: >-
                    Official numbers: an APPROVED template of the number
                    (`templates[].id`). Must be `null` on unofficial numbers.
                  example: null
                freeText:
                  type:
                    - string
                    - 'null'
                  maxLength: 4096
                  description: >-
                    Unofficial numbers: the message, with `{{name}}`
                    placeholders. Must be `null` on official numbers.
                  example: Olá {{nome}}, recebemos seu pedido de orçamento!
                variableMap:
                  type: object
                  description: >-
                    Value of each template variable or placeholder: `{ "source":
                    "field", "key": "<question key>" }` or `{ "source":
                    "static", "value": "..." }`. Defaults to `{}`.
                  additionalProperties:
                    type: object
                  example:
                    nome:
                      source: field
                      key: full_name
                formName:
                  type:
                    - string
                    - 'null'
                  maxLength: 255
                  description: Optional display label for the form.
                  example: Orçamento — Outubro
              required:
                - consentDisclaimerKey
                - autoSendEnabled
                - templateId
                - freeText
              additionalProperties: false
      responses:
        '200':
          description: Configuration saved
          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` (bad `formId`
            or body, with `details`), or a rule refusal: `CONSENT_REQUIRED`,
            `TEMPLATE_REQUIRED`, `TEMPLATE_NOT_ELIGIBLE`,
            `TEMPLATE_NOT_ALLOWED`, `FREE_TEXT_REQUIRED`,
            `FREE_TEXT_NOT_ALLOWED`, `VARIABLES_UNMAPPED` (with
            `missingVariables`); also `NUMBER_REQUIRED` (a per-number OAuth
            grant without `x-whatsapp-number-id`) or `NUMBER_NOT_FOUND` (a
            number-scoped key whose number was deleted)
          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: Missing or invalid `x-api-key` / `x-api-key-id` header
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Unauthorized
        '403':
          description: >-
            The number is outside the credential's scope
            (`NUMBER_NOT_IN_GRANT`), or an OAuth token whose workspace role
            lacks `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: >-
            Page link not found: never linked, already unlinked, or another
            workspace's
          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: Internal error
          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: 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.