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

# Message history

> Lists the linked number's full message history (direct and group), ordered by providerTimestamp (newest first). Works for all providers (Evolution Go, Evolution v2 and Meta). Paginated via page/pageSize. Filter by date with startDate/endDate (ISO 8601, over providerTimestamp). Returns up to ~1 month of stored history (from the connection date). The number's privacy (PII) mode applies: RELAY_ONLY → [] + notice:"PII_RELAY_ONLY"; STORE_X_DAYS clamps to the window max(startDate, now − retentionDays). Requires a number-scoped key.

**Requires a number-scoped key.**



## OpenAPI

````yaml openapi.json GET /v1/messages/history
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/history:
    get:
      tags:
        - Conversations
      summary: Message history
      description: >-
        Lists the linked number's full message history (direct and group),
        ordered by providerTimestamp (newest first). Works for all providers
        (Evolution Go, Evolution v2 and Meta). Paginated via page/pageSize.
        Filter by date with startDate/endDate (ISO 8601, over
        providerTimestamp). Returns up to ~1 month of stored history (from the
        connection date). The number's privacy (PII) mode applies: RELAY_ONLY →
        [] + notice:"PII_RELAY_ONLY"; STORE_X_DAYS clamps to the window
        max(startDate, now − retentionDays). Requires a number-scoped key.


        **Requires a number-scoped key.**
      operationId: get_messages_history
      parameters:
        - name: startDate
          in: query
          required: false
          description: >-
            Start of the date range (filters by providerTimestamp). Must be ≤
            endDate.
          schema:
            type: string
            description: (string (ISO 8601))
          example: '2026-06-01T00:00:00Z'
        - name: endDate
          in: query
          required: false
          description: End of the date range (filters by providerTimestamp).
          schema:
            type: string
            description: (string (ISO 8601))
          example: '2026-06-30T23:59:59Z'
        - 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: Message history
          content:
            application/json:
              example:
                messages:
                  - id: cm_01HZX...
                    conversationId: conv_01HZX...
                    direction: INBOUND
                    providerKind: PILOT_STATUS
                    externalMessageId: wamid.HBg...
                    status: DELIVERED
                    messageType: text
                    origin: null
                    text: Olá, ainda está disponível?
                    participantName: Ana
                    participantPhone: '+5511988887777'
                    repliedToExternalId: null
                    media: null
                    sentAt: null
                    deliveredAt: '2026-06-27T10:00:01.000Z'
                    readAt: null
                    providerTimestamp: '2026-06-27T10:00:00.000Z'
                    createdAt: '2026-06-27T10:00:00.500Z'
                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)

````