Get chat messages
GET/chat.history
List messages in a chat, filtered by date range (after/before).
Messages with contentType of text, voice, or poll are returned. System messages and other content types are excluded.
Specify ONE of the following:
chatId- Fetch from an existing chat by its IDgroupId- Fetch from a group chatuserIds- Fetch from a DM or Multi-DM with the specified users
You must specify exactly one destination. Specifying multiple (e.g., both chatId and groupId) will return a 400 error.
The ordering of results depends on the filter specified:
-
When no parameters are provided, the most recent messages are returned, sorted in reverse chronological order. This is equivalent to specifying
beforeas NOW and leavingafterunspecified. -
If
afteris specified, the results are sorted in forward chronological order.
Either dates or datetimes may be specified. Date-only inputs (YYYY-MM-DD)
are interpreted in the caller's timezone (see
Timezone handling).
Access: Organization tokens need to be a member of the chat
(403 not_in_chat otherwise). Personal tokens can read any chat the
owner can, including public groups in their roam they have not joined.
Required scope: chat:history
Every returned sender includes userId plus userType. The ID resolves
through user.info with the same credentials.
OpenAPI Spec: chat-v1.json
Request
Responses
- 200
- 400
- 401
- 403
- 405
- 500
Messages retrieved successfully
Bad request.
Presented invalid authentication credentials.
Organization token is not a member of this chat (not_in_chat).
Personal tokens receive this only when the owner cannot read the chat
(private / DM they are not in).
An unsupported method was requested.
An internal error occurred, including a stored sender that cannot resolve as a visible principal. The endpoint does not return a partial page.