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

Send a message

Tells the session what to do next, and wakes it when it is paused. Refused with session_starting while it starts and session_over once it has ended. Attachments are ids from POST /uploads; with them, message may be empty. Needs Pro and credits.

POST/mode/sessions/{id}/messages
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.
Request body
requiredapplication/json
messagestringrequired
Up to 20,000 characters.
attachmentsobject[]
Up to 6 files, 25 MB each.
Show properties
Array of object
idstringrequired
namestringrequired
Responses
200Done.
okboolean
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
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/string/messages" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "message": "Add a test for it too."
}'
Response
{
  "ok": true
}