Skip to content
Median
Esc
↑↓navigate↵open⌘Jpreview

List a session's messages

What was said, oldest first, and every tool call Mode’s replies made. A long session gives its newest 300 messages.

GET/mode/sessions/{id}/messages
Authorization
AuthorizationBearer token · headerrequired
`MEDIAN_KEY` from Settings under API, or an MCP OAuth access token. A key acts as the organization; a token acts as the person who approved it.
Path parameters
idstringrequired
A coding session id, or a link to its page.
Responses
200The conversation.
messagesModeMessage[]
Show properties
Array of ModeMessage
idstring
rolestring
Allowed:userassistant
bodystring
pendingboolean
True while Mode is still writing it.
outcomestring | null
Allowed:doneinterruptedfailednull
errorstring | null
authorNamestring | null
Who wrote a person's message. Null on Mode's replies.
attachmentsobject[]
The files sent with a person's message. Empty on Mode's replies.
Show properties
Array of object
namestring
sizeinteger
typestring
urlstring | null
Where to download it. Null once the file is gone.
createdAtinteger
actionsModeAction[]
Show properties
Array of ModeAction
idstring
messageIdstring
The reply that made the call.
namestring
The tool, such as Read, Edit or Bash.
inputstring
One line on what it was asked.
outputstring | null
The start of what came back.
statusstring
Allowed:runningdonefailed
401The bearer token is missing, revoked, or expired.
errorobject
Show properties
codestring
messagestring
404Not one of yours, or not there at all.
errorobject
Show properties
codestring
messagestring
429Too many requests. Wait the seconds in `Retry-After`. Limits depend on the plan. See [rate limits](/api/errors-and-limits#rate-limits).
errorobject
Show properties
codestring
messagestring
Request
curl -X GET "https://api.median.sh/v1/mode/sessions/string/messages" \
  -H "Authorization: Bearer YOUR_TOKEN"
Response
{
  "messages": [
    {
      "id": "string",
      "role": "user",
      "body": "string",
      "pending": true,
      "outcome": "done",
      "error": "string",
      "authorName": "string",
      "attachments": [
        {
          "name": "string",
          "size": 0,
          "type": "string",
          "url": "string"
        }
      ],
      "createdAt": 0
    }
  ],
  "actions": [
    {
      "id": "string",
      "messageId": "string",
      "name": "string",
      "input": "string",
      "output": "string",
      "status": "running"
    }
  ]
}