Skip to main content
GET
Retrieve messages by AI contact with pagination

Overview

Retrieve a contact’s messages with pagination, newest first. This is the recommended endpoint for reading message history. Use this instead of v2: page is 1-based and echoed back unchanged, page_size is configurable, and the counters describe exactly what you receive.

Authentication

Include your API key in the request header:

Path Parameters

Query Parameters

Both parameters must be integers. page below 1, page_size outside 1–100, and fractional values are rejected with 400.

Response Structure

The counters are self-consistent: data never holds more than page_size items, and summing data across all pages equals total.

Message Object

This list is exhaustive and identical on every channel — the response carries these fields and nothing else:
v3 returns a fixed projection, so integrating once works for every channel. v2 instead returns the raw channel row — on WhatsApp that means the whole message record nested under whatsapp_message on top of the flattened fields, plus the ticket, summary and activity graph. If you depend on a field that only exists there, tell us and we will consider adding it to v3 rather than exposing the internal row.
Unlike v2, the response contains only real messages. The synthetic stage and interactive_note entries that v2 mixes into its list are not messages and are not returned here.

Example Request

Example Response

Fetching the Full History

Requesting a page past the last one is not an error: it returns an empty data with has_next_page: false.

Error Responses

Important Notes

  • Order is newest first. Page 1 holds the most recent messages.
  • Reading is side-effect free. Unlike v2, fetching messages here does not mark the conversation as read, so polling this endpoint never changes what your agents see as unread.
  • Deleted Instagram messages are excluded from data, total and pages.
  • Cross-channel: works for every channel a contact may use.

Headers

x-api-key
string
required

API key required to authorize the request

Path Parameters

aiContactId
string
required

ID of the AI contact

Query Parameters

page
number
default:1

Page number, 1-based. Page 1 returns the newest messages. Defaults to 1.

Required range: 1 <= x <= 9007199254740991
Example:

1

page_size
number
default:15

Messages per page, between 1 and 100. Defaults to 15.

Required range: 1 <= x <= 100
Example:

15

Response

Messages retrieved successfully.

data
object[]

Messages for this page, newest first. The shape below is exhaustive and identical across channels: no channel-specific or internal fields are returned.

page
number

The requested page, echoed back.

Example:

1

page_size
number
Example:

15

pages
number

Total number of pages. Valid values for page are 1..pages.

Example:

3

total
number

Total messages for this contact, across all pages.

Example:

45

has_next_page
boolean
Example:

true