API reference
New session
POST /v1/agents/new-session
Starts a fresh conversation on a computer. The next message has no memory of earlier ones.
Request
Start a new session
curl -s "$SAI_API_URL/v1/agents/new-session" \
-H "Authorization: Bearer $SAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"machineId": "m_7f2a",
"channel": "api"
}'Response
200 OK · New sessionJSON
{ "sessionId": "cs_02KQA" }The next POST /message with the same API key on this computer lands in this session. Other keys' conversations are not touched.
Errors
Gotchas
- The
saiCLI sendschannel: "cli"to rotate its own conversation; an API caller can omit it. - You rarely need this. One long conversation per key and 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
/abortfirst if you want it stopped.