Gracefully end a focus session. No new segments are generated, but already-ready segments stay playable. The operation is idempotent.
POSThttps://api.aitronos.com/v1/music/{organization_id}/focus/sessions/{session_id}/end
Ending a session you do not own returns 404. Ending an already-ended session is a no-op and returns the session's current state.
organization_id string required
The organization the session is scoped to. The caller must belong to it.
session_id string required
The focus session id (mfocus_-prefixed).
The focus session object with status set to ended (or stopped_cap). The shape matches Get a focus session: session_id, status, goal, engine, target_minutes, total_segments, ready_count, segments, more_pending, and next_ready_at.
cURL
- Bash
- Python
- Python
- JavaScript
curl -X POST "https://api.aitronos.com/v1/music/org_abc123/focus/sessions/mfocus_7c2a9f4e1b8d/end" \
-H "X-API-Key: $FREDDY_API_KEY"Response:
200 OK
{
"session_id": "mfocus_7c2a9f4e1b8d",
"status": "ended",
"goal": "focus",
"engine": "studio",
"target_minutes": 60,
"total_segments": 30,
"ready_count": 5,
"segments": [],
"more_pending": false,
"next_ready_at": null
}