List messages
A conversation's history, newest first, both ways
A conversation's history, newest first, both ways: what the contact sent you and
what you sent them. This is how to read what was said before you were
streaming — the stream starts from now, or from an event id you already hold.
Catching up after a dropped connection is still
Last-Event-ID on the
stream, which replays every event, not only messages; to read every event back
across conversations, use GET /v1/events.
curl "https://api.mapier.ai/v1/conversations/a0000000-0000-4000-8000-000000000001/messages?limit=2" \
-H "Authorization: Bearer $MAPIER_API_KEY" \
-H "x-mapier-version: 2026-12-01"{
"messages": [
{
"conversationId": "a0000000-0000-4000-8000-000000000001",
"from": "+14155550100",
"text": "is it here yet?",
"externalId": "5D1B7E0A-2F3C-4B8E-9A61-1C2D3E4F5A6B",
"replyToExternalId": null,
"occurredAt": "2026-08-24T18:03:11.000Z",
"attachmentIds": [],
"attachments": [],
"messageId": "0192a7c4-6a02-7e11-8c4d-2b9f7e3a5d22",
"direction": "inbound",
"status": null,
"commandId": null
},
{
"conversationId": "a0000000-0000-4000-8000-000000000001",
"from": "+14155550142",
"text": "Your order is on its way.",
"externalId": "8C2E4A61-3B7D-4F90-A1C5-6D8E0F2B4A73",
"replyToExternalId": null,
"occurredAt": "2026-08-24T18:01:02.000Z",
"attachmentIds": [],
"attachments": [],
"messageId": "0192a7c4-5b1e-7c3d-9f2a-6e8d4b1c0a99",
"direction": "outbound",
"status": "delivered",
"commandId": "3f1a0c2e-8b47-4d19-9a5e-2c6f0b8d4e71"
}
],
"nextCursor": "eyJiZWZvcmUiOiIyMDI2LTEwLTExVDA5OjEyOjQwWiJ9"
}Parameters
Prop
Type
A conversationId comes from message events, command results, the
conversation.created event and GET /v1/conversations,
which lists a line's conversations.
GET /v1/conversations/{conversationId} reads the
conversation itself: a group's name, members and status.
Page with cursor: pass each answer's nextCursor back until it is null. A
cursor past the last page answers an empty page. A cursor is opaque: never
build or parse one.
Response
messages is one page, newest first, and nextCursor is the cursor for the
next, older page, or null on the last. Each row is the stream's
message event, with the same ids —
messageId is the one to reply to, and lineId the line the message is on (the
line an inbound one arrived on, or the one an outbound one went out from), plus
three fields.
An inbound row carries what its message event carried — addressed,
fromDisplayName, platform, replyTo, contactId and the rest — except
optedOut, which was the sender's choice at that moment, and an attachment's
isSticker. An older row may lack a field: there a missing addressed means it was not
recorded, not that the message was for your line. contactId is absent when
this project no longer has the sender as a contact.
Prop
Type
On a row, from is the contact's address for an inbound message and your
line's address for an outbound one, and empty when no sender address was
recorded.
How long history is kept
History is complete: messages are kept forever, where the stream replays 90 days of events.
Errors
| Status | Code | Cause |
|---|---|---|
400 | bad_request | With a personal access token, no x-mapier-project header |
401 | invalid_credentials | No key, or one that is unknown, revoked or expired |
403 | forbidden | A personal access token not made for this environment, or whose owner's role no longer allows this |
403 | insufficient_scope | The key does not carry the messages:read scope |
404 | not_found | A conversation this key cannot read — another project's — the same answer a made-up id gets |
409 | project_archived | The project is archived |
422 | validation_failed | A parameter outside the bounds above, or an x-mapier-version that is not a published version |
429 | rate_limited | Over 120 requests a minute for this key — see Rate limits |
500 | internal_error | An unexpected error on Mapier's side; quote the error's requestId to support |
503 | service_busy | Mapier was too busy to take the request and did nothing; wait details.retryAfter seconds and ask again |
503 | upstream_unavailable | A service behind Mapier did not answer; retry with backoff |