Skip to main content
GET
Get messages or conversations for a messaging platform. Retrieval times differ on each social network. On Facebook, Instagram, and WhatsApp, messages are available via Ayrshare in real time. On X/Twitter, there is a delay of up to 3 minutes to see new message updates. Please contact support to learn more about the Enterprise Plan if you need real-time X/Twitter message access.
Response caching: For Facebook and Instagram, responses are cached for 60 seconds. For X/Twitter, responses are cached for 15 seconds to better support polling. WhatsApp reads messages already received through Meta webhooks, so a newly received message can appear as soon as Ayrshare processes its webhook. The response still includes lastUpdated and nextUpdate metadata.
Initial message history retrieval for Facebook and Instagram is limited to the last 20 messages. Please see the Message History Retrieval for Facebook and Instagram section for more information.
WhatsApp conversations are identified by the correspondent’s phone number (digits only, E.164 without the leading +). A stored outbound message may include a status value of sent, delivered, read, or failed.
WhatsApp messages sent through Send Message are not currently added to Get Messages history. Incoming WhatsApp messages received through webhooks are stored and returned here.

Header Parameters

Path Parameters

string
required
The platform to get the message: facebook, instagram, twitter, whatsapp

Query Parameters

string
default:"active"
required
Return active conversations or archived conversations. Values: active or archived.
string
Only return the specific conversation.
boolean
default:false
Return conversations instead of messages. For Facebook, Instagram, and WhatsApp, this returns one page. If true, conversationId is ignored.
When conversationsOnly=true, conversation details are returned in converstationsDetails. This spelling is part of the current API response.
integer
For Facebook, Instagram, and WhatsApp, this applies to messages and conversation lists: integer from 1 to 100, with a default and maximum of 100. For X/Twitter, supplying limit keeps the existing provider-pagination contract (1 to 100); omitting it keeps the existing unpaginated behavior.
string
Opaque cursor from meta.pagination.next. Pass it as next with the same profile, platform, and filters. For Facebook, Instagram, and WhatsApp, continue while meta.pagination.hasMore is true, even if a filtered page is short or empty; limit may be omitted on subsequent requests (defaults to 100). For X/Twitter, continue supplying limit with next under its existing provider-pagination contract.

Fetching the next page

Start with GET /api/messages/instagram?limit=100. To continue, URL-encode the returned meta.pagination.next value and send GET /api/messages/instagram?limit=100&next=<opaque cursor>. The parameter is next, not cursor. Keep the same Profile-Key and query filters throughout. Check meta.pagination.hasMore, not the number of results, to decide when to stop. A filtered request may return fewer than limit results, or an empty page with a continuation, because each request scans a bounded portion of history. Facebook, Instagram, and WhatsApp messages in stored history are ordered newest first, with document ID breaking ties. Conversation lists are ordered by document ID. Paging is not a frozen snapshot: new messages appear when you restart from the first page, and changing conversation statuses can change filtered results. Existing message fields, the converstationsDetails spelling, and X/Twitter’s existing behavior are unchanged. Facebook, Instagram, and WhatsApp integrations that previously expected all history from one request must follow the continuation cursor; increasing limit above 100 is not supported.