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
ISO 8601 datetime. Filter messages with
providerTimestamp on or after this date.ISO 8601 datetime. Filter messages with
providerTimestamp on or before this date.Page number (≥ 1).
Results per page (1–100).
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 viaPATCH /api/whatsapp-numbers/[id]):
| PII mode | Effect |
|---|---|
STORE_INDEFINITE (default) | All messages returned (subject to date filters). |
STORE_X_DAYS | Only 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_ONLY | Returns an empty list (messages: [], total: 0) and includes a notice: "PII_RELAY_ONLY" field. No message data is stored for this number. |
Example
Message object (ChatMessageDTO) fields
Pilot Status internal message ID.
ID of the parent conversation (direct or group).
"INBOUND" (received) or "OUTBOUND" (sent).Provider that handled the message (
PILOT_STATUS, META, …).Provider message id (e.g. Meta
wamid) when available.Message status (
QUEUED, SENT, DELIVERED, READ, FAILED, …).text, image, audio, video, document, location, contacts, sticker, or reaction.Origin of an outbound message (e.g.
APP, API) when available.Message text or caption when available.
WhatsApp display name of the counterpart/sender when available.
Counterpart/sender in E.164 format when available.
externalMessageId of the message this one replies to, when available.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.id— Meta media id. Set onMETAnumbers — pass it toGET /v1/media/{mediaId}to download the bytes;nullon Evolution.media.url— Direct download URL when available. META inbound media is mirrored to S3 (so META messages usually carry bothidandurl); Evolution provides its own link. Best-effort — may benull.media.mimeType— Media MIME type when known (may benull).media.fileName— Media file name when known (may benull).
ISO 8601 — when the message was sent.
ISO 8601 — when the message was delivered.
ISO 8601 — when the message was read (only when read receipts are enabled).
ISO 8601 — provider’s timestamp for the message (sort key).
ISO 8601 — when the record was created in Pilot Status.
Common errors
400 INVALID_DATE_RANGE—startDateorendDateis not a valid ISO 8601 string, orstartDate > endDate.400 NUMBER_NOT_FOUND— the API key is not bound to a WhatsApp number.401— missing or invalidx-api-keyheader.403— tenant-scoped key used (number-scoped key required).