sessions module route (requires sessions:run:read)
const url = 'https://example.com/v1/m/sessions/runs/example/messages?role=user&order=asc&text=1';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://example.com/v1/m/sessions/runs/example/messages?role=user&order=asc&text=1' \ --header 'Authorization: Bearer <token>'Lists, searches and anchors by time the messages of one Claude Code or Codex session, read from the transcript its tool keeps: the person’s own messages (the tool’s answers with role=all), each with its id, time and first line, in pages from either end, narrowed by a phrase or a start time; one message whole by id; read-only.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”Path parameter ref.
Header Parameters
Section titled “ Header Parameters ”Target tenant id; required when the principal can act in more than one tenant.
Query Parameters
Section titled “ Query Parameters ”User (default) lists what the person sent; all adds the tool’s answers.
Asc (default) pages from the first message, desc from the newest. Items are always oldest first.
Keeps messages with this phrase anywhere in them, case-insensitive.
Keeps messages at or after this time.
Page size; default 50, at most 200.
The id a page continues from: next of the previous page.
Reads one message whole, with text and later_same; the filters do not apply.
1: every item of the page carries its whole text, bounded at 64 KiB per message as a read by id is, and the page holds at most 50 messages; later_same is not added.
Responses
Section titled “ Responses ”OK
object
Example generated
{}Bad request
object
Example generated
{}Unauthenticated
object
Example generated
{}Forbidden
object
Example generated
{}Not found
object
Example generated
{}Conflict / setup required
object
Example generated
{}Rate limited
object
Example generated
{}