List coding sessions
The newest 100 sessions, most recently moved first. hasAccess is false when the plan does not include Mode.
GET
/mode/sessionsAuthorization
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.
Responses
200The sessions.
hasAccessbooleansessionsModeSession[]Show propertiesHide properties
Array of
ModeSessionidstringtitlestringstatusstringwaiting is ready for a message. paused is asleep and wakes on the next one. ended and failed are over.
Allowed:
startingworkingwaitingpausedendedfailedpausedForstring | nullAllowed:
idlecreditsnullrepostring | nullowner/repo. Null once its codebase was disconnected.
signalIdstring | nullThe signal it was started to fix.
toolSuggestionIdstring | nullThe tool suggestion it was started to build.
pullRequestobject | nullThe pull request, once somebody asked for one.
Show propertiesHide properties
statestringAllowed:
openingopenfailednumberinteger | nullurlstring | nullerrorstring | nullWhy opening or updating it failed.
updatedAtintegerstartedByNamestring | nullupdatedAtintegerurlstringThe session's page in Median.
401The bearer token is missing, revoked, or expired.
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" \
-H "Authorization: Bearer YOUR_TOKEN"const response = await fetch("https://api.median.sh/v1/mode/sessions", {
method: "GET",
headers: {
"Authorization": "Bearer YOUR_TOKEN"
}
});Response
{
"hasAccess": true,
"sessions": [
{
"id": "string",
"title": "string",
"status": "starting",
"pausedFor": "idle",
"repo": "string",
"signalId": "string",
"toolSuggestionId": "string",
"pullRequest": {
"state": "opening",
"number": 0,
"url": "string",
"error": "string",
"updatedAt": 0
},
"startedByName": "string",
"updatedAt": 0,
"url": "string"
}
]
}{
"error": {
"code": "string",
"message": "string"
}
}{
"error": {
"code": "string",
"message": "string"
}
}