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

Start a coding session

Send codebaseId and message to start on a codebase; the message’s first line is the title until Mode names the session, a moment later. Send signalId alone to fix a signal: the session opens with its write-up, Mode’s findings and what customers said, in the codebase Mode confirmed it in, and a session already open on the signal comes back instead. Send toolSuggestionId alone to build a suggested tool: the session opens with the suggestion’s build prompt, in the codebase used last, and a session already open on the suggestion comes back instead. Only admins and owners, and only while the suggestion is pending. Attachments are ids from POST /uploads; with them, message may be empty. Needs Pro and credits.

POST/mode/sessions
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.
Request body
requiredapplication/json
codebaseIdstring
From `GET /v1/codebases`.
messagestring
What to work on, up to 20,000 characters.
attachmentsobject[]
Up to 6 files, 25 MB each. Sent with `codebaseId` and `message`.
Show properties
Array of object
idstringrequired
namestringrequired
signalIdstring
A signal to fix. Sent without `codebaseId` and `message`.
toolSuggestionIdstring
A tool suggestion to build, from `GET /v1/tool-suggestions`. Sent without `codebaseId` and `message`.
Responses
200The session.
idstring
urlstring
The session's page in Median.
400The request is malformed, and the message names the field.
errorobject
Show properties
codestring
messagestring
401The bearer token is missing, revoked, or expired.
errorobject
Show properties
codestring
messagestring
403The token's person does not hold the role this needs.
errorobject
Show properties
codestring
messagestring
404Not one of yours, or not there at all.
errorobject
Show properties
codestring
messagestring
409It already exists, or it was already settled.
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 POST "https://api.median.sh/v1/mode/sessions" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "codebaseId": "jd7f3k...",
  "message": "Fix the export button on Safari\n\nIt does nothing when pressed."
}'
Response
{
  "id": "k57d2v...",
  "url": "https://median.sh/mode/k57d2v..."
}