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

# Unread counts per number

> Unread inbound count of each number, in one call — no message content. A number's `total` equals the `total` of GET /v1/messages/unread for it. Scope: a number-scoped key (or an account-wide key with `x-whatsapp-number-id`) sees its number; a token/account key restricted to some numbers sees those; an account-wide credential sees every number of the workspace. Unlike the list, an account-wide key is NOT refused. OAuth/MCP tokens and account keys need `chat:read`.



## OpenAPI

````yaml openapi.json GET /v1/messages/unread/counts
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/messages/unread/counts:
    get:
      tags:
        - Conversations
      summary: Unread counts per number
      description: >-
        Unread inbound count of each number, in one call — no message content. A
        number's `total` equals the `total` of GET /v1/messages/unread for it.
        Scope: a number-scoped key (or an account-wide key with
        `x-whatsapp-number-id`) sees its number; a token/account key restricted
        to some numbers sees those; an account-wide credential sees every number
        of the workspace. Unlike the list, an account-wide key is NOT refused.
        OAuth/MCP tokens and account keys need `chat:read`.
      operationId: get_messages_unread_counts
      parameters:
        - name: whatsappNumberIds
          in: query
          required: false
          description: >-
            Optional. Comma-separated (or repeated) WhatsAppNumber ids, max 100.
            Omitted: every number the credential reaches.
          schema:
            type: string
          example: cmnum_01,cmnum_02
      responses:
        '200':
          description: Counts
          content:
            application/json:
              schema:
                type: object
                properties:
                  byNumber:
                    type: array
                    items:
                      type: object
                      properties:
                        whatsappNumberId:
                          type: string
                        number:
                          type: string
                        displayName:
                          type:
                            - string
                            - 'null'
                        total:
                          type: integer
                  total:
                    type: integer
              example:
                byNumber:
                  - whatsappNumberId: cmnum_01
                    number: '5511999999999'
                    displayName: Suporte
                    total: 12
                  - whatsappNumberId: cmnum_02
                    number: '5511888888888'
                    displayName: null
                    total: 0
                total: 12
        '400':
          description: >-
            `TOO_MANY_NUMBERS`, `NUMBER_REQUIRED` (per-number grant without a
            number) or `NUMBER_NOT_FOUND` (credential bound to no number)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              examples:
                tooMany:
                  summary: TOO_MANY_NUMBERS
                  value:
                    error: >-
                      whatsappNumberIds accepts at most 100 ids |
                      whatsappNumberIds aceita no máximo 100 ids
                    code: TOO_MANY_NUMBERS
                numberRequired:
                  summary: NUMBER_REQUIRED
                  value:
                    error: >-
                      Provide x-whatsapp-number-id for a per-number connection |
                      Envie o header x-whatsapp-number-id para uma conexão por
                      número
                    code: NUMBER_REQUIRED
        '401':
          description: >-
            Missing or invalid credential (`x-api-key` / `x-api-key-id` / Bearer
            token)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Invalid API key
        '403':
          description: >-
            `NUMBER_NOT_IN_GRANT` (a named number is outside the credential's
            reach) or `PERMISSION_DENIED` (role without `chat:read`)
          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: A named number is not a number of this workspace
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: >-
                  whatsappNumberIds names a number that is not a WhatsApp number
                  of this account | whatsappNumberIds indica um número que não é
                  um número de WhatsApp desta conta
                code: NUMBER_NOT_FOUND
                whatsappNumberIds:
                  - cmnum_99
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.