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

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
idstringrequired
A coding session id, or a link to its page.
Responses
200The session.
idstring
titlestring
statusstring
waiting is ready for a message. paused is asleep and wakes on the next one. ended and failed are over.
Allowed:startingworkingwaitingpausedendedfailed
pausedForstring | null
Allowed:idlecreditsnull
repostring | null
owner/repo. Null once its codebase was disconnected.
signalIdstring | null
The signal it was started to fix.
toolSuggestionIdstring | null
The tool suggestion it was started to build.
pullRequestobject | null
The pull request, once somebody asked for one.
Show properties
statestring
Allowed:openingopenfailed
numberinteger | null
urlstring | null
errorstring | null
Why opening or updating it failed.
updatedAtinteger
startedByNamestring | null
updatedAtinteger
urlstring
The session's page in Median.
codebaseIdstring
baseBranchstring
baseShastring | null
The commit it started from, once cloned.
errorstring | null
Why it stopped, on a failed session.
createdAtinteger
changesobject | null
What the working tree changed, the last time Mode looked.
Show properties
filesobject[]
Show properties
Array of object
pathstring
statusstring
Allowed:addedmodifieddeletedrenamed
additionsinteger
deletionsinteger
fromstring
The old path of a renamed file.
additionsinteger
deletionsinteger
atinteger
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" \
  -H "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
  }
}