Returning.AIDocs
v1

API reference / Messaging

.md

Get messages

Get the newest messages in your community, optionally from one channel or one trader, as plain text with the sender and channel.

Last updated 28 Oct 2026API v1

Method
GET
Path
https://api.returning.ai/v1/messages
Permission
getMessages
Retries
Read-only; exact retries are safe

When to use this

  • You watch a channel from your own system and want the latest messages.
  • You want to see what one trader has posted recently.
  • You need a message ID so you can reply to it or react to it.

Authentication#

Header
Authorization: Bearer <API_KEY>
Permission
getMessagesShown in the dashboard as “Get Messages”

Use a Community API key with getMessages, and keep it on your server. The key decides the community, so you only read that community's messages and never send a community ID.

Behaviour#

Messages come newest first, by the time they were posted. Without channel_id you get the newest messages from every channel in your community. Direct messages and deleted messages aren't included.

data.messages.message is plain text: formatting is removed and mentions read @Display Name. A message with a file reads Attached File, a GIF reads GIF Message, and a message with no text that can be shown reads -. Messages the community bot posted have user_id 0 and email Bot. There is no cursor or page parameter, so to catch up after a gap, read with a higher count and skip IDs you have already seen.

Request#

Query parameters#

channel_id#stringOPTIONAL
Only messages from this channel, from List integration channels. Omit it for messages from every channel.

RuleChannel ID in your community

Eg"66f000000000000000000a11"

count#integerOPTIONAL
How many of the newest messages to return.

Rule1-100, default 50

Eg20

user_id#stringOPTIONAL
Only messages posted by this trader, by platform user ID. Send this or email, not both.

Eg"3247779"

email#stringOPTIONAL
Only messages posted by the trader with this email. Send this or user_id, not both.

Eg"trader@example.com"

Headers#

Authorization#stringREQUIRED
Community API key with getMessages.

RuleBearer <API_KEY>

curl --request GET \
  --url 'https://api.returning.ai/v1/messages?channel_id=66f000000000000000000a11&count=20' \
  --header 'Authorization: Bearer <API_KEY>'

Response#

A 200 returns up to count messages in data.messages. data.total counts the messages in this response only. A channel with no messages returns an empty list.

status#stringALWAYS
Result of the request.

Rulesuccess

message#stringALWAYS
Human-readable summary. Do not branch on it.

Eg"messages fetched successfully"

data#objectALWAYS
The messages.

Eg{ ... }

total#integerALWAYS
Number of messages in this response, not the total in the channel.

Eg1

messages#object[]ALWAYS
Up to count messages, newest first. Deleted messages aren't included.

Eg[ ... ]

id#stringALWAYS
The message ID. Use it as messageId to reply or react.

Eg"66f000000000000000000a21"

message#stringALWAYS
The message as plain text. Attachments read Attached File and GIFs read GIF Message. A message with no text that can be shown reads -.

Eg"Is the gold webinar still on for Friday?"

user#objectALWAYS
Who posted the message.

Eg{"user_id": "3247779", "email": "trader@example.com"}

user_id#stringALWAYS
The sender's platform user ID, as a string. Messages posted by the community bot have the number 0, and a message with no recorded sender has null.

Eg"3247779"

email#stringALWAYS
The sender's email. Bot for the community bot, and null when the sender's account can't be found.

Eg"trader@example.com"

channel#objectALWAYS
Where the message was posted.

Eg{"channel_id": "66f000000000000000000a11", "name": "general"}

channel_id#stringALWAYS
The channel ID. null if the message has no valid channel.

Eg"66f000000000000000000a11"

name#stringALWAYS
The channel's name. null if the channel no longer exists.

Eg"general"

timestamp#stringALWAYS
When the message was posted.

Eg"2026-09-26T08:30:00.000Z"

{
  "status": "success",
  "message": "messages fetched successfully",
  "data": {
    "total": 1,
    "messages": [
      {
        "id": "66f000000000000000000a21",
        "message": "Is the gold webinar still on for Friday?",
        "user": {
          "user_id": "3247779",
          "email": "trader@example.com"
        },
        "channel": {
          "channel_id": "66f000000000000000000a11",
          "name": "general"
        },
        "timestamp": "2026-09-26T08:30:00.000Z"
      }
    ]
  }
}

Errors#

Validation errors put the reason in detail, and detail.fields names the bad parameter. Other errors carry only message, or message and detail. None has a machine-readable code, so branch on the HTTP status.

Fix the request03

400Fix the request
A query value is invalid: count outside 1-100 or not a whole number, both user_id and email, an email that isn't an email address, or a parameter this endpoint doesn't accept. detail.fields names it.
401Fix the request
The key is missing (Invalid token), unknown (Invalid API key) or expired, or it lacks getMessages (Your api key does not have permission to access this action). Personal user API keys can't read messages. Add the permission in Settings > Integration > API Keys.
403Fix the request
The trader in user_id or email can't see the channel in channel_id. Drop one of the two filters, or pick a channel the trader can see.

Fix the data01

404Fix the data
detail says which. Channel not found: channel_id isn't a channel in your community, or isn't a 24-character channel ID; get it from List integration channels. User not found: user_id or email doesn't match a member of your community; check the value with Get User Data.

Retry with backoff01

500Retry with backoff
The key could not be checked (Authentication failed), or the messages could not be read (detail of Unable to fetch messages). Retry with backoff.

Retries

This endpoint is read-only, so retrying the exact same request is safe after a network error or a 500. Use bounded exponential backoff. Over the rate limit, requests return 429; wait for the window to reset, then retry.

{
  "meta": {
    "status": "error",
    "statusCode": 400
  },
  "message": "Get Messages Query Validation error.",
  "detail": {
    "message": "Invalid request query",
    "fields": ["count"]
  },
  "solution": "Check your query in request and try again"
}

Next step#

Reply messagePOST/v1/messages/replyAnswer a message you just read, using its id as messageId.