Docs/New session
API reference

New session

POST /v1/agents/new-session

View as Markdown

Starts a fresh conversation on a computer. The next message has no memory of earlier ones.

Request

json
{ "machineId": "m_7f2a", "channel": "api" }
FieldRequiredNotes
machineIdyesThe computer whose API conversation to rotate.
channelyes for API callersSend "api". Omitted, it rotates the sai CLI's conversation instead.

Response

json
{ "sessionId": "cs_02KQA" }

The next POST /message on this computer lands in this session.

Errors

StatusBody
404{ "error": "Machine not found." }
429More than 20 new sessions in an hour.

Gotchas

  • Always send channel: "api". The default exists for the CLI.
  • You rarely need this. One long conversation per computer is the normal shape; rotate when a new task should not see the old context.
  • A running task is not stopped by a new session. Call /abort first if you want it stopped.