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 ascending and after:
-
ascending=truesorts in forward chronological order (oldest first).ascending=falsesorts in reverse chronological order (newest first), even whenafteris specified. -
When
ascendingis omitted andafteris not specified, the most recent messages are returned in reverse chronological order. This is equivalent to specifyingbeforeas NOW and leavingafterunspecified. -
When
ascendingis omitted andafteris specified, the results are sorted in forward chronological order.
Send the same ascending value on every page. The cursor marks where to
resume, not which direction to sort.
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.
Full membership matrix: Chat.
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, including an unparseable ascending value (invalid_parameter, param is ascending).
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.