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

# Sync Flows from Meta

> Pulls the Flow catalogue of the key's WABA from Meta into Pilot Status now, instead of waiting for the hourly sync — useful after creating or editing Flows directly in Meta's Business Manager. `created` and `updated` count local rows, `seen` the Flows Meta listed. `truncated: true` means the WABA has more Flows than one sync reads (20 pages of 100); the rest arrive on the next run — it is not an error. Permission `flows:manage`.

It takes **no fields**: send no body or `{}`. A body that is not a JSON object is 400 `FLOW_BODY_INVALID`; `whatsappNumberId` / `wabaId` / `metaWabaId` are 400 `FLOW_NUMBER_FROM_KEY`; any other field is 400 `FLOW_UNKNOWN_FIELDS`.

⚠️ **One sync per number at a time.** A second request while one is running answers 429 `FLOW_SYNC_IN_PROGRESS` with `Retry-After: 120`.

**Requires a number-scoped key.** A tenant-scoped key must name the number with the `x-whatsapp-number-id` header, or it gets 403 `TENANT_SCOPE_NOT_ALLOWED`.



## OpenAPI

````yaml openapi.json POST /v1/flows/meta/sync
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/flows/meta/sync:
    post:
      tags:
        - Flows
      summary: Sync Flows from Meta
      description: >-
        Pulls the Flow catalogue of the key's WABA from Meta into Pilot Status
        now, instead of waiting for the hourly sync — useful after creating or
        editing Flows directly in Meta's Business Manager. `created` and
        `updated` count local rows, `seen` the Flows Meta listed. `truncated:
        true` means the WABA has more Flows than one sync reads (20 pages of
        100); the rest arrive on the next run — it is not an error. Permission
        `flows:manage`.


        It takes **no fields**: send no body or `{}`. A body that is not a JSON
        object is 400 `FLOW_BODY_INVALID`; `whatsappNumberId` / `wabaId` /
        `metaWabaId` are 400 `FLOW_NUMBER_FROM_KEY`; any other field is 400
        `FLOW_UNKNOWN_FIELDS`.


        ⚠️ **One sync per number at a time.** A second request while one is
        running answers 429 `FLOW_SYNC_IN_PROGRESS` with `Retry-After: 120`.


        **Requires a number-scoped key.** A tenant-scoped key must name the
        number with the `x-whatsapp-number-id` header, or it gets 403
        `TENANT_SCOPE_NOT_ALLOWED`.
      operationId: post_flows_meta_sync
      responses:
        '200':
          description: What the sync did
          content:
            application/json:
              example:
                created: 1
                updated: 4
                seen: 5
                truncated: false
        '400':
          description: >-
            `FLOW_BODY_INVALID`, `FLOW_NUMBER_FROM_KEY`, `FLOW_UNKNOWN_FIELDS`,
            or a refusal from Meta's Graph
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Portuguese half
                  errorEN:
                    type: string
                    description: English half
                  code:
                    type: string
              example:
                error: >-
                  Corpo inválido: este endpoint não recebe corpo. Envie nenhum
                  corpo, ou um objeto JSON vazio. Um corpo truncado não é
                  tratado como corpo vazio.
                errorEN: >-
                  Invalid body: this endpoint takes no body. Send no body at
                  all, or an empty JSON object. A truncated body is not treated
                  as an empty one.
                code: FLOW_BODY_INVALID
        '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: >-
            `TENANT_SCOPE_NOT_ALLOWED` — a workspace key, account key or OAuth
            token that did not name the number with `x-whatsapp-number-id`. For
            credentials that carry a user (OAuth tokens, `ps_account_` keys):
            `PERMISSION_DENIED` when that user's workspace role lacks the
            permission, `WORKSPACE_MEMBERSHIP_REQUIRED` when the user is no
            longer an active member. Number and workspace keys are not
            role-gated
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: >-
                  This endpoint acts on a single WhatsApp number: send the
                  x-whatsapp-number-id header naming the number to act on (its
                  id or instance id from GET /v1/numbers) | Este endpoint atua
                  sobre um único número de WhatsApp: envie o header
                  x-whatsapp-number-id indicando o número desejado (o id dele ou
                  o id da instância, obtidos em GET /v1/numbers)
                code: TENANT_SCOPE_NOT_ALLOWED
        '422':
          description: >-
            The key's number is not a Meta (Cloud API) number, or has no WABA
            behind it
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Portuguese half
                  errorEN:
                    type: string
                    description: English half
                  code:
                    type: string
              example:
                error: >-
                  Flows existem apenas em números Meta (API Oficial). O número
                  desta chave não é Meta ou não tem uma WABA associada — use uma
                  chave de um número Meta.
                errorEN: >-
                  Flows only exist on Meta (Cloud API) numbers. This key's
                  number is not a Meta number, or has no WABA behind it — use a
                  key bound to a Meta number.
                code: FLOW_REQUIRES_META_NUMBER
        '429':
          description: >-
            `FLOW_SYNC_IN_PROGRESS` — a sync of this number is already running.
            `Retry-After: 120`
          headers:
            Retry-After:
              description: Seconds to wait before retrying
              schema:
                type: integer
                example: 120
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Portuguese half
                  errorEN:
                    type: string
                    description: English half
                  code:
                    type: string
              example:
                error: >-
                  Já existe uma sincronia de Flows em andamento para o número
                  desta chave. Tente de novo em até 120 segundos (o cabeçalho
                  Retry-After traz o mesmo número). Sincronizar duas vezes o
                  mesmo número em paralelo faz as duas falharem.
                errorEN: >-
                  A Flows sync is already running for this key's number. Try
                  again in up to 120 seconds (the Retry-After header carries the
                  same number). Syncing one number twice in parallel makes both
                  attempts fail.
                code: FLOW_SYNC_IN_PROGRESS
        '500':
          description: >-
            Internal error. Never carries the internal message — that belongs in
            the log
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Portuguese half
                  errorEN:
                    type: string
                    description: English half
                  code:
                    type: string
              example:
                error: Erro interno do servidor.
                errorEN: Internal server error.
                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.