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

# Unread messages

> Lists the linked number's unread INBOUND messages (newest first). "total" is the TRUE unread count — the sum of Conversation.unreadCount (the same counter the dashboard shows), not a raw count of inbound messages. Each item carries conversationUnreadCount (the conversation's unread total). Paginated via page/pageSize (no date range). The number's privacy (PII) mode applies: RELAY_ONLY → [] + notice:"PII_RELAY_ONLY"; STORE_X_DAYS clamps to the retention window. Requires a number-scoped key.

**Requires a number-scoped key.**



## OpenAPI

````yaml openapi.json GET /v1/messages/unread
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:
    get:
      tags:
        - Conversations
      summary: Unread messages
      description: >-
        Lists the linked number's unread INBOUND messages (newest first).
        "total" is the TRUE unread count — the sum of Conversation.unreadCount
        (the same counter the dashboard shows), not a raw count of inbound
        messages. Each item carries conversationUnreadCount (the conversation's
        unread total). Paginated via page/pageSize (no date range). The number's
        privacy (PII) mode applies: RELAY_ONLY → [] + notice:"PII_RELAY_ONLY";
        STORE_X_DAYS clamps to the retention window. Requires a number-scoped
        key.


        **Requires a number-scoped key.**
      operationId: get_messages_unread
      parameters:
        - name: page
          in: query
          required: false
          description: Page (default 1).
          schema:
            type: string
            description: (integer (≥1))
          example: '1'
        - name: pageSize
          in: query
          required: false
          description: Items per page (default 30, max 100).
          schema:
            type: string
            description: (integer (1–100))
          example: '30'
      responses:
        '200':
          description: Unread messages
          content:
            application/json:
              example:
                messages:
                  - id: cm_01HZX...
                    conversationId: conv_01HZX...
                    direction: INBOUND
                    from: '+5511988887777'
                    fromName: Ana
                    userId: BR.13491208655302741918
                    username: ana
                    text: Olá, ainda está disponível?
                    createdAt: '2026-06-27T10:00:00.000Z'
                    readAt: null
                    conversationUnreadCount: 3
                total: 1
                page: 1
                pageSize: 30
                totalPages: 1
        '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
        '403':
          description: Tenant-scoped key used on a number-scoped endpoint
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Tenant-scoped keys cannot call number endpoints
                code: TENANT_SCOPE_NOT_ALLOWED
        '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)

````