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}/messagesAuthorization
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
idstringrequiredA coding session id, or a link to its page.
Responses
200The conversation.
messagesModeMessage[]Show propertiesHide properties
Array of
ModeMessageidstringrolestringAllowed:
userassistantbodystringpendingbooleanTrue while Mode is still writing it.
outcomestring | nullAllowed:
doneinterruptedfailednullerrorstring | nullauthorNamestring | nullWho 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 propertiesHide properties
Array of
objectnamestringsizeintegertypestringurlstring | nullWhere to download it. Null once the file is gone.
createdAtintegeractionsModeAction[]Show propertiesHide properties
Array of
ModeActionidstringmessageIdstringThe reply that made the call.
namestringThe tool, such as Read, Edit or Bash.
inputstringOne line on what it was asked.
outputstring | nullThe start of what came back.
statusstringAllowed:
runningdonefailed401The bearer token is missing, revoked, or expired.
errorobjectShow propertiesHide properties
codestringmessagestring404Not one of yours, or not there at all.
errorobjectShow propertiesHide properties
codestringmessagestring429Too many requests. Wait the seconds in `Retry-After`. Limits depend on the plan. See [rate limits](/api/errors-and-limits#rate-limits).
errorobjectShow propertiesHide properties
codestringmessagestringRequest
curl -X GET "https://api.median.sh/v1/mode/sessions/string/messages" \
-H "Authorization: Bearer YOUR_TOKEN"const response = await fetch("https://api.median.sh/v1/mode/sessions/string/messages", {
method: "GET",
headers: {
"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"
}
]
}{
"error": {
"code": "string",
"message": "string"
}
}{
"error": {
"code": "string",
"message": "string"
}
}{
"error": {
"code": "string",
"message": "string"
}
}