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

# Complete Embedded Signup (Meta)

> Completes a hosted Embedded Signup: the token (minted by POST /api/v1/numbers/remote-pairing { provider: META }) carries the tenant, so the browser flow needs no ps_ key. Called by the /connect/<token> page once Facebook returns the chosen phoneNumberId/wabaId/code. Real side effect: creates the Meta number. 401 INVALID_SESSION if the token expires.



## OpenAPI

````yaml openapi.json POST /v1/meta-embedded/{token}/complete
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/meta-embedded/{token}/complete:
    post:
      tags:
        - Meta Onboarding
      summary: Complete Embedded Signup (Meta)
      description: >-
        Completes a hosted Embedded Signup: the token (minted by POST
        /api/v1/numbers/remote-pairing { provider: META }) carries the tenant,
        so the browser flow needs no ps_ key. Called by the /connect/<token>
        page once Facebook returns the chosen phoneNumberId/wabaId/code. Real
        side effect: creates the Meta number. 401 INVALID_SESSION if the token
        expires.
      operationId: post_meta-embedded_token_complete
      parameters:
        - name: token
          in: path
          required: true
          description: Embedded Signup session token.
          schema:
            type: string
          example: eyJ...
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                code:
                  type: string
                  description: Authorization code returned by Facebook.
                  example: AQB...
                phoneNumberId:
                  type: string
                  description: Chosen Phone Number ID.
                  example: '123456789012345'
                wabaId:
                  type: string
                  description: Chosen WABA ID.
                  example: '987654321098765'
                businessId:
                  type: string
                  description: Business ID (optional).
                  example: '111222333444555'
              required:
                - code
                - phoneNumberId
                - wabaId
            example:
              code: AQB...
              phoneNumberId: '123456789012345'
              wabaId: '987654321098765'
      responses:
        '201':
          description: Complete signup
          content:
            application/json:
              example:
                number:
                  id: num_01HZX...
                  number: '5511999999999'
                  provider: META
                  isFullyConnected: true
                redirectUrl: https://app.acme.com/done
        '400':
          description: Invalid payload or parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Validation error
        '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
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Too many requests
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)

````