Skip to main content
Retrieve the full stored message history (direct and group conversations) for the connected number.

Endpoint

GET https://pilotstatus.com.br/v1/messages/history
Requires a number-scoped API key (ps_*) in the x-api-key header. Tenant-scoped keys return 403. You may also identify the key with x-api-key-id: <api_key_id>.All providers supported: this endpoint works for numbers connected via Evolution Go, Evolution v2, and Meta Cloud API.

Query parameters

startDate
string
ISO 8601 datetime. Filter messages with providerTimestamp on or after this date.
endDate
string
ISO 8601 datetime. Filter messages with providerTimestamp on or before this date.
page
integer
default:"1"
Page number (≥ 1).
pageSize
integer
default:"30"
Results per page (1–100).
Both startDate and endDate are optional individually. When supplied, each must be a valid ISO 8601 string and startDate must not be later than endDate; otherwise 400 INVALID_DATE_RANGE is returned. Results are ordered by providerTimestamp descending (newest first). The endpoint returns up to roughly one month of stored history, counted from the number’s connection date.

PII mode effect

The response depends on the PII mode configured for the number (set via PATCH /api/whatsapp-numbers/[id]):
PII modeEffect
STORE_INDEFINITE (default)All messages returned (subject to date filters).
STORE_X_DAYSOnly messages within the last N days are returned. The effective lower bound is max(startDate, now − piiRetentionDays). Messages outside the retention window have been hard-deleted by the daily job.
RELAY_ONLYReturns an empty list (messages: [], total: 0) and includes a notice: "PII_RELAY_ONLY" field. No message data is stored for this number.

Example

curl "https://pilotstatus.com.br/v1/messages/history?startDate=2026-06-01T00:00:00Z&endDate=2026-06-30T23:59:59Z&page=1&pageSize=30" \
  -H "x-api-key: ps_your_key_here"

Message object (ChatMessageDTO) fields

id
string
required
Pilot Status internal message ID.
conversationId
string
required
ID of the parent conversation (direct or group).
direction
string
required
"INBOUND" (received) or "OUTBOUND" (sent).
providerKind
string
required
Provider that handled the message (PILOT_STATUS, META, …).
externalMessageId
string | null
Provider message id (e.g. Meta wamid) when available.
status
string
required
Message status (QUEUED, SENT, DELIVERED, READ, FAILED, …).
messageType
string
required
text, image, audio, video, document, location, contacts, sticker, or reaction.
origin
string | null
Origin of an outbound message (e.g. APP, API) when available.
text
string | null
Message text or caption when available.
participantName
string | null
WhatsApp display name of the counterpart/sender when available.
participantPhone
string | null
Counterpart/sender in E.164 format when available.
repliedToExternalId
string | null
externalMessageId of the message this one replies to, when available.
media
object | null
Media descriptor { provider, id, url, mimeType, fileName } when the message carries media; null otherwise.
  • media.provider"META", "EVO", or "EVO_GO" — the provider that delivered the media.
  • media.idMeta media id. Set on META numbers — pass it to GET /v1/media/{mediaId} to download the bytes; null on Evolution.
  • media.url — Direct download URL when available. META inbound media is mirrored to S3 (so META messages usually carry both id and url); Evolution provides its own link. Best-effort — may be null.
  • media.mimeType — Media MIME type when known (may be null).
  • media.fileName — Media file name when known (may be null).
sentAt
string | null
ISO 8601 — when the message was sent.
deliveredAt
string | null
ISO 8601 — when the message was delivered.
readAt
string | null
ISO 8601 — when the message was read (only when read receipts are enabled).
providerTimestamp
string
required
ISO 8601 — provider’s timestamp for the message (sort key).
createdAt
string
required
ISO 8601 — when the record was created in Pilot Status.

Common errors

  • 400 INVALID_DATE_RANGEstartDate or endDate is not a valid ISO 8601 string, or startDate > endDate.
  • 400 NUMBER_NOT_FOUND — the API key is not bound to a WhatsApp number.
  • 401 — missing or invalid x-api-key header.
  • 403 — tenant-scoped key used (number-scoped key required).