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

# Conectar o Chatwoot

> Conecta o número a uma conta Chatwoot: valida as credenciais contra a instância, cria a inbox e inicia o espelhamento. Dica: faça um dry-run com POST /v1/chatwoot/test antes. O token de acesso NUNCA é retornado.



## OpenAPI

````yaml openapi.pt.json POST /v1/chatwoot
openapi: 3.1.0
info:
  title: API Pilot Status
  version: 1.0.0
  license:
    name: Pilot Status Terms of Service
    url: https://pilotstatus.com.br/terms
  description: >-
    API REST pública do Pilot Status. Autentique com o header `x-api-key:
    ps_...` (ou `x-api-key-id`). Base URL: https://pilotstatus.com.br
servers:
  - url: https://pilotstatus.com.br
security:
  - apiKey: []
  - apiKeyId: []
paths:
  /v1/chatwoot:
    post:
      tags:
        - Chatwoot
      summary: Conectar o Chatwoot
      description: >-
        Conecta o número a uma conta Chatwoot: valida as credenciais contra a
        instância, cria a inbox e inicia o espelhamento. Dica: faça um dry-run
        com POST /v1/chatwoot/test antes. O token de acesso NUNCA é retornado.
      operationId: post_chatwoot
      parameters:
        - name: x-whatsapp-number-id
          in: header
          required: false
          description: >-
            Scopes to a single number (required for tenant keys / per-number
            OAuth grants).
          schema:
            type: string
          example: num_01HZX...
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - instanceUrl
                - accountId
                - userAccessToken
              properties:
                instanceUrl:
                  type: string
                  description: URL base da instância Chatwoot.
                  example: https://app.chatwoot.com
                accountId:
                  type: string
                  description: Id da conta Chatwoot (string numérica).
                  example: '1'
                userAccessToken:
                  type: string
                  description: >-
                    Token de acesso do usuário Chatwoot (api_access_token de
                    agente/admin).
                  example: cw_xxx
                channelMode:
                  type: string
                  enum:
                    - auto
                    - api
                    - native
                  description: >-
                    Preferência de canal: auto (padrão), api (força inbox
                    mirror), native (força inbox whatsapp_cloud quando
                    elegível).
                  example: auto
      responses:
        '200':
          description: Status da integração Chatwoot
          content:
            application/json:
              example:
                connected: true
                status: connected
                enabled: true
                inboxId: '42'
                instanceUrl: https://app.chatwoot.com
                accountId: '1'
                hasToken: true
                channelMode: auto
                lastError: null
                lastErrorCode: null
                lastSyncAt: '2026-07-13T12:00:00.000Z'
        '400':
          description: Erro de validação, ou o Chatwoot rejeitou as credenciais
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Invalid Chatwoot credentials.
                code: CHATWOOT_AUTH_INVALID
        '401':
          description: Header `x-api-key` / `x-api-key-id` ausente ou inválido
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Unauthorized
        '404':
          description: O número não pertence a este tenant
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: WhatsApp number not found
                code: NUMBER_NOT_FOUND
        '429':
          description: Limite de requisições excedido
          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: Sua chave de API ps_
    apiKeyId:
      type: apiKey
      in: header
      name: x-api-key-id
      description: Id da chave de API (alternativa ao x-api-key)

````