Get a coding session
The session, and what its working tree has changed so far.
GET
/mode/sessions/{id}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
idstringrequiredA coding session id, or a link to its page.
Responses
200The session.
idstringtitlestringstatusstringwaiting 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.
codebaseIdstringbaseBranchstringbaseShastring | nullThe commit it started from, once cloned.
errorstring | nullWhy it stopped, on a failed session.
createdAtintegerchangesobject | nullWhat the working tree changed, the last time Mode looked.
Show propertiesHide properties
filesobject[]Show propertiesHide properties
Array of
objectpathstringstatusstringAllowed:
addedmodifieddeletedrenamedadditionsintegerdeletionsintegerfromstringThe old path of a renamed file.
additionsintegerdeletionsintegeratinteger401The 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" \
-H "Authorization: Bearer YOUR_TOKEN"const response = await fetch("https://api.median.sh/v1/mode/sessions/string", {
method: "GET",
headers: {
"Authorization": "Bearer YOUR_TOKEN"
}
});Response
{
"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",
"codebaseId": "string",
"baseBranch": "string",
"baseSha": "string",
"error": "string",
"createdAt": 0,
"changes": {
"files": [
{
"path": "string",
"status": "added",
"additions": 0,
"deletions": 0,
"from": "string"
}
],
"additions": 0,
"deletions": 0,
"at": 0
}
}{
"error": {
"code": "string",
"message": "string"
}
}{
"error": {
"code": "string",
"message": "string"
}
}{
"error": {
"code": "string",
"message": "string"
}
}