Sessions
Shared-sessions protocol v2: event log, controls, executor lease, dispatch and the live SSE stream.
Every call carries x-codai-device (a stable UUID) — that header is what selects protocol v2 and registers the device. One executor holds the lease; viewers and editors send controls; everyone reads the same event log. The protocol itself is specified in the sessions section.
bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
x-codai-device*stringStable device UUID. Registers the device on first use (name/platform from x-codai-device-name / x-codai-device-platform) and selects the shared-sessions protocol.
uuidx-codai-device-name?stringHuman-readable device name used when the device is first registered (truncated to 120 chars).
length <= 120x-codai-device-platform?stringPlatform recorded on first registration; unknown values become agent.
"android""ios""web""desktop""cli""agent"x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128application/json- body
session_key?stringClient-chosen stable key; a random UUID when omitted. A server UUID of an existing readable session resolves to that session.
1 <= length <= 256title?stringlength <= 500e2e?booleanMark payloads as end-to-end encrypted.
falsestub?booleanCreate a title-only stub (no events yet); viewers request the transcript with a hydrate control.
falseA session with this session_key (or server id) already exists; returned unchanged.
application/json- response
A shared session as returned by create/patch and embedded in list/detail.
id*stringServer-assigned id.
uuidsession_key*stringClient-chosen stable key, unique per owner.
owner_user_id*stringuuidtitle*stringlength <= 500created_at*stringdate-timelast_event_at*stringBumped on every stored event.
date-timelast_seq*integerHighest event seq; 0 for an empty session.
0 <= valueexecutor_device_id*stringMirror of the lease holder; may be stale until the next lease write.
uuidlease_expires_at*stringdate-timee2e*booleanPayloads are end-to-end encrypted client-side.
archived*booleanstub*booleanTitle-only mirror without events yet; cleared by the first appended event batch.
curl -X POST 'https://ai.codai.ro/v1/sessions' \ -H 'x-codai-device: 497f6eca-6276-4993-bfeb-53cbbbba6f08' \ -H 'Content-Type: application/json' \ -d '{}'{ "id": "3f7a4c1e-9b2d-4e8f-a1b6-5c0d7e2f9a34", "session_key": "desktop-2026-09-23-main", "owner_user_id": "65139110-7c3c-4777-b692-80c218be3b9d", "title": "string", "created_at": "2019-08-24T14:15:22Z", "last_event_at": "2019-08-24T14:15:22Z", "last_seq": 0, "executor_device_id": "4a403d11-3f52-4f9c-8024-3e4b6ac6da4c", "lease_expires_at": "2019-08-24T14:15:22Z", "e2e": true, "archived": true, "stub": true}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
limit?integerMax rows per list (own and shared are capped separately). Default 50, max 200.
0 <= value <= 20050archived?stringInclude archived sessions when 1 or true.
"0""1""true""false"v?"2"Force protocol v2 without the device header. Only 2 is meaningful.
"2"x-codai-device*stringStable device UUID. Registers the device on first use (name/platform from x-codai-device-name / x-codai-device-platform) and selects the shared-sessions protocol.
uuidx-codai-device-name?stringHuman-readable device name used when the device is first registered (truncated to 120 chars).
length <= 120x-codai-device-platform?stringPlatform recorded on first registration; unknown values become agent.
"android""ios""web""desktop""cli""agent"x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Own sessions first, then shared ones, each ordered by last_event_at descending.
application/json- response
sessions*array<>curl -X GET 'https://ai.codai.ro/v1/sessions' \ -H 'x-codai-device: 497f6eca-6276-4993-bfeb-53cbbbba6f08'{ "sessions": [ { "id": "3f7a4c1e-9b2d-4e8f-a1b6-5c0d7e2f9a34", "session_key": "desktop-2026-09-23-main", "owner_user_id": "65139110-7c3c-4777-b692-80c218be3b9d", "title": "string", "created_at": "2019-08-24T14:15:22Z", "last_event_at": "2019-08-24T14:15:22Z", "last_seq": 0, "executor_device_id": "4a403d11-3f52-4f9c-8024-3e4b6ac6da4c", "lease_expires_at": "2019-08-24T14:15:22Z", "e2e": true, "archived": true, "stub": true, "role": "viewer", "presence_count": 0 } ]}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
id*stringServer UUID of the session OR its client session_key. Own sessions win on session_key collisions.
length <= 256v?"2"Force protocol v2 without the device header. Only 2 is meaningful.
"2"x-codai-device*stringStable device UUID. Registers the device on first use (name/platform from x-codai-device-name / x-codai-device-platform) and selects the shared-sessions protocol.
uuidx-codai-device-name?stringHuman-readable device name used when the device is first registered (truncated to 120 chars).
length <= 120x-codai-device-platform?stringPlatform recorded on first registration; unknown values become agent.
"android""ios""web""desktop""cli""agent"x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Session detail.
application/json- response
A shared session as returned by create/patch and embedded in list/detail.
id*stringServer-assigned id.
uuidsession_key*stringClient-chosen stable key, unique per owner.
owner_user_id*stringuuidtitle*stringlength <= 500created_at*stringdate-timelast_event_at*stringBumped on every stored event.
date-timelast_seq*integerHighest event seq; 0 for an empty session.
0 <= valueexecutor_device_id*stringMirror of the lease holder; may be stale until the next lease write.
uuidlease_expires_at*stringdate-timee2e*booleanPayloads are end-to-end encrypted client-side.
archived*booleanstub*booleanTitle-only mirror without events yet; cleared by the first appended event batch.
role*SessionRoleRole of a principal on a session; owner ≥ editor ≥ viewer.
"viewer""editor""owner"members*array<>lease*|nullpresence*array<>curl -X GET 'https://ai.codai.ro/v1/sessions/3f7a4c1e-9b2d-4e8f-a1b6-5c0d7e2f9a34' \ -H 'x-codai-device: 497f6eca-6276-4993-bfeb-53cbbbba6f08'{ "id": "3f7a4c1e-9b2d-4e8f-a1b6-5c0d7e2f9a34", "session_key": "desktop-2026-09-23-main", "owner_user_id": "65139110-7c3c-4777-b692-80c218be3b9d", "title": "string", "created_at": "2019-08-24T14:15:22Z", "last_event_at": "2019-08-24T14:15:22Z", "last_seq": 0, "executor_device_id": "4a403d11-3f52-4f9c-8024-3e4b6ac6da4c", "lease_expires_at": "2019-08-24T14:15:22Z", "e2e": true, "archived": true, "stub": true, "role": "viewer", "members": [ { "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", "role": "viewer", "remote": true, "devices": [ { "device_id": "3bafab7b-4400-4bcf-8e6e-09f954699940", "name": "string", "platform": "android", "last_seen_at": "2019-08-24T14:15:22Z", "remote": true } ] } ], "lease": { "device_id": "3bafab7b-4400-4bcf-8e6e-09f954699940", "expires_at": "2019-08-24T14:15:22Z" }, "presence": [ { "device_id": "3bafab7b-4400-4bcf-8e6e-09f954699940", "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", "role": "viewer", "executor": true, "last_seen": 1758614400000, "driving": true, "remote": true } ]}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
id*stringServer UUID of the session OR its client session_key. Own sessions win on session_key collisions.
length <= 256x-codai-device*stringStable device UUID. Registers the device on first use (name/platform from x-codai-device-name / x-codai-device-platform) and selects the shared-sessions protocol.
uuidx-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128application/json- body
At least one of title / archived is required.
title?stringNew title, or null to clear it.
length <= 500archived?booleanThe updated session.
application/json- response
A shared session as returned by create/patch and embedded in list/detail.
id*stringServer-assigned id.
uuidsession_key*stringClient-chosen stable key, unique per owner.
owner_user_id*stringuuidtitle*stringlength <= 500created_at*stringdate-timelast_event_at*stringBumped on every stored event.
date-timelast_seq*integerHighest event seq; 0 for an empty session.
0 <= valueexecutor_device_id*stringMirror of the lease holder; may be stale until the next lease write.
uuidlease_expires_at*stringdate-timee2e*booleanPayloads are end-to-end encrypted client-side.
archived*booleanstub*booleanTitle-only mirror without events yet; cleared by the first appended event batch.
curl -X PATCH 'https://ai.codai.ro/v1/sessions/3f7a4c1e-9b2d-4e8f-a1b6-5c0d7e2f9a34' \ -H 'x-codai-device: 497f6eca-6276-4993-bfeb-53cbbbba6f08' \ -H 'Content-Type: application/json' \ -d '{}'{ "id": "3f7a4c1e-9b2d-4e8f-a1b6-5c0d7e2f9a34", "session_key": "desktop-2026-09-23-main", "owner_user_id": "65139110-7c3c-4777-b692-80c218be3b9d", "title": "string", "created_at": "2019-08-24T14:15:22Z", "last_event_at": "2019-08-24T14:15:22Z", "last_seq": 0, "executor_device_id": "4a403d11-3f52-4f9c-8024-3e4b6ac6da4c", "lease_expires_at": "2019-08-24T14:15:22Z", "e2e": true, "archived": true, "stub": true}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
id*stringServer UUID of the session OR its client session_key. Own sessions win on session_key collisions.
length <= 256x-codai-device*stringStable device UUID. Registers the device on first use (name/platform from x-codai-device-name / x-codai-device-platform) and selects the shared-sessions protocol.
uuidx-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Deleted.
application/json- response
deleted*truetrueid*stringServer id of the deleted session.
uuidcurl -X DELETE 'https://ai.codai.ro/v1/sessions/3f7a4c1e-9b2d-4e8f-a1b6-5c0d7e2f9a34' \ -H 'x-codai-device: 497f6eca-6276-4993-bfeb-53cbbbba6f08'{ "deleted": true, "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
id*stringServer UUID of the session OR its client session_key. Own sessions win on session_key collisions.
length <= 256after?integerReturn events with seq strictly greater than this value. Default 0.
0 <= value0limit?integerPage size. Default 200, max 1000.
0 <= value <= 1000200x-codai-device*stringStable device UUID. Registers the device on first use (name/platform from x-codai-device-name / x-codai-device-platform) and selects the shared-sessions protocol.
uuidx-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128One page of events.
application/json- response
last_seq*integerHighest seq in the session at read time.
events*array<>curl -X GET 'https://ai.codai.ro/v1/sessions/3f7a4c1e-9b2d-4e8f-a1b6-5c0d7e2f9a34/events' \ -H 'x-codai-device: 497f6eca-6276-4993-bfeb-53cbbbba6f08'{ "last_seq": 42, "events": [ { "seq": 1, "kind": "user_message", "ts": 1758614400000, "sender_device_id": "bc45c0f5-ada8-4820-b7a5-8dc052568462", "turn_id": "string", "client_event_id": "string", "payload": {} } ]}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
id*stringServer UUID of the session OR its client session_key. Own sessions win on session_key collisions.
length <= 256x-codai-device*stringStable device UUID. Registers the device on first use (name/platform from x-codai-device-name / x-codai-device-platform) and selects the shared-sessions protocol.
uuidx-codai-device-name?stringHuman-readable device name used when the device is first registered (truncated to 120 chars).
length <= 120x-codai-device-platform?stringPlatform recorded on first registration; unknown values become agent.
"android""ios""web""desktop""cli""agent"x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128application/json- body
events*array<>1 <= items <= 200expected_last_seq?integerOptimistic check; mismatch → 409 seq_conflict.
0 <= valueBatch processed (fresh rows stored, duplicates mapped to their existing seq).
application/json- response
last_seq*integerSession last_seq after the append.
accepted*integerNumber of freshly stored events (duplicates excluded).
events*array<>One entry per element of the batch, in order.
curl -X POST 'https://ai.codai.ro/v1/sessions/3f7a4c1e-9b2d-4e8f-a1b6-5c0d7e2f9a34/events' \ -H 'x-codai-device: 497f6eca-6276-4993-bfeb-53cbbbba6f08' \ -H 'Content-Type: application/json' \ -d '{ "events": [ { "kind": "string" } ]}'{ "last_seq": 0, "accepted": 0, "events": [ { "client_event_id": "string", "seq": 0 } ]}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
id*stringServer UUID of the session OR its client session_key. Own sessions win on session_key collisions.
length <= 256applied?stringReturn applied (1/true) instead of pending controls. Default pending.
"0""1""true""false"target?stringme (the calling device) or a device UUID; only controls dispatched at that device are returned.
x-codai-device*stringStable device UUID. Registers the device on first use (name/platform from x-codai-device-name / x-codai-device-platform) and selects the shared-sessions protocol.
uuidx-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Controls matching the filters.
application/json- response
controls*array<>curl -X GET 'https://ai.codai.ro/v1/sessions/3f7a4c1e-9b2d-4e8f-a1b6-5c0d7e2f9a34/controls' \ -H 'x-codai-device: 497f6eca-6276-4993-bfeb-53cbbbba6f08'{ "controls": [ { "id": "string", "kind": "send", "text": "string", "turn_id": "string", "ask_id": "string", "from_device_id": "10624cda-85b4-412c-80da-8ce165bfd5b0", "target_device_id": "12785743-1d27-41cd-88a7-0ac66360e3d6", "mode": "open", "seq": 0, "applied": true, "created_at": "2019-08-24T14:15:22Z" } ]}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
id*stringServer UUID of the session OR its client session_key. Own sessions win on session_key collisions.
length <= 256x-codai-device*stringStable device UUID. Registers the device on first use (name/platform from x-codai-device-name / x-codai-device-platform) and selects the shared-sessions protocol.
uuidx-codai-device-name?stringHuman-readable device name used when the device is first registered (truncated to 120 chars).
length <= 120x-codai-device-platform?stringPlatform recorded on first registration; unknown values become agent.
"android""ios""web""desktop""cli""agent"x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128application/json- body
id*stringClient idempotency key, unique per session.
1 <= length <= 128kind*SessionControlKindKind of control a non-executor can send to the executor. hydrate asks the executor to upload the transcript of a stub session (session owner only, like send).
"send""answer""approve""deny""cancel""steer""inject""pause""resume""hydrate"text?stringMessage text for send / answer / steer / inject.
length <= 100000turn_id?stringlength <= 128ask_id?stringId of the question being answered / approved / denied.
length <= 128A control with this id already exists in the session; nothing was written.
application/json- response
accepted*truetrueseq*integerSeq of the echoed control event.
duplicate*booleantrue when the control id already existed.
curl -X POST 'https://ai.codai.ro/v1/sessions/3f7a4c1e-9b2d-4e8f-a1b6-5c0d7e2f9a34/control' \ -H 'x-codai-device: 497f6eca-6276-4993-bfeb-53cbbbba6f08' \ -H 'Content-Type: application/json' \ -d '{ "id": "ctl-01J8Z7Q2K9", "kind": "send"}'{ "accepted": true, "seq": 0, "duplicate": true}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
id*stringServer UUID of the session OR its client session_key. Own sessions win on session_key collisions.
length <= 256cid*stringThe client-chosen control id.
length <= 128x-codai-device*stringStable device UUID. Registers the device on first use (name/platform from x-codai-device-name / x-codai-device-platform) and selects the shared-sessions protocol.
uuidx-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Marked applied.
application/json- response
id*stringThe control id.
applied*truetruecurl -X POST 'https://ai.codai.ro/v1/sessions/3f7a4c1e-9b2d-4e8f-a1b6-5c0d7e2f9a34/control/string/applied' \ -H 'x-codai-device: 497f6eca-6276-4993-bfeb-53cbbbba6f08'{ "id": "string", "applied": true}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
id*stringServer UUID of the session OR its client session_key. Own sessions win on session_key collisions.
length <= 256x-codai-device*stringStable device UUID. Registers the device on first use (name/platform from x-codai-device-name / x-codai-device-platform) and selects the shared-sessions protocol.
uuidx-codai-device-name?stringHuman-readable device name used when the device is first registered (truncated to 120 chars).
length <= 120x-codai-device-platform?stringPlatform recorded on first registration; unknown values become agent.
"android""ios""web""desktop""cli""agent"x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128application/json- body
device_id*stringTarget device; must belong to the session owner.
uuidmode?stringsend runs text as a new turn on the target; open only opens the session there (handoff — text/turn_id ignored, no user turn).
"send""send""open"text?stringPrompt for the target. Required unless mode is open (400 otherwise).
1 <= length <= 100000turn_id?stringIgnored when mode is open.
length <= 128control_id?stringClient idempotency key; dispatch:<uuid> is generated when absent.
1 <= length <= 128A control with this control_id already exists; nothing queued, no push sent.
application/json- response
control_id*stringseq*integertarget_device_id*stringuuidmode*stringThe effective dispatch mode (send when the request omitted it).
"send""open"queued*truetruepushed*booleantrue only when FCM accepted the wake message.
duplicate*booleanpush_reason?stringWhy no push was delivered — no_push_token, no_token, auth_failed, network_error, unregistered (token cleared) or http_<status>. Absent on success.
curl -X POST 'https://ai.codai.ro/v1/sessions/3f7a4c1e-9b2d-4e8f-a1b6-5c0d7e2f9a34/dispatch' \ -H 'x-codai-device: 497f6eca-6276-4993-bfeb-53cbbbba6f08' \ -H 'Content-Type: application/json' \ -d '{ "device_id": "3bafab7b-4400-4bcf-8e6e-09f954699940"}'{ "control_id": "dispatch:8c2e5f1a-7b3d-4c9e-a0f1-2d3e4f5a6b7c", "seq": 0, "target_device_id": "12785743-1d27-41cd-88a7-0ac66360e3d6", "mode": "send", "queued": true, "pushed": true, "duplicate": true, "push_reason": "no_push_token"}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
id*stringServer UUID of the session OR its client session_key. Own sessions win on session_key collisions.
length <= 256x-codai-device*stringStable device UUID. Registers the device on first use (name/platform from x-codai-device-name / x-codai-device-platform) and selects the shared-sessions protocol.
uuidx-codai-device-name?stringHuman-readable device name used when the device is first registered (truncated to 120 chars).
length <= 120x-codai-device-platform?stringPlatform recorded on first registration; unknown values become agent.
"android""ios""web""desktop""cli""agent"x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128application/json- body
device_id?stringClaim for this device instead of the one in x-codai-device (registered lazily under your account).
uuidforce?booleanTake over a live lease held by another device.
falseLease granted (or renewed for the same device).
application/json- response
session_id*stringuuiddevice_id*stringThe lease holder.
uuidexpires_at*stringNow + 30 s.
date-timecurl -X POST 'https://ai.codai.ro/v1/sessions/3f7a4c1e-9b2d-4e8f-a1b6-5c0d7e2f9a34/lease' \ -H 'x-codai-device: 497f6eca-6276-4993-bfeb-53cbbbba6f08' \ -H 'Content-Type: application/json' \ -d '{}'{ "session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82", "device_id": "3bafab7b-4400-4bcf-8e6e-09f954699940", "expires_at": "2019-08-24T14:15:22Z"}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
id*stringServer UUID of the session OR its client session_key. Own sessions win on session_key collisions.
length <= 256x-codai-device*stringStable device UUID. Registers the device on first use (name/platform from x-codai-device-name / x-codai-device-platform) and selects the shared-sessions protocol.
uuidx-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Lease renewed.
application/json- response
session_id*stringuuiddevice_id*stringThe lease holder.
uuidexpires_at*stringNow + 30 s.
date-timecurl -X PUT 'https://ai.codai.ro/v1/sessions/3f7a4c1e-9b2d-4e8f-a1b6-5c0d7e2f9a34/lease' \ -H 'x-codai-device: 497f6eca-6276-4993-bfeb-53cbbbba6f08'{ "session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82", "device_id": "3bafab7b-4400-4bcf-8e6e-09f954699940", "expires_at": "2019-08-24T14:15:22Z"}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
id*stringServer UUID of the session OR its client session_key. Own sessions win on session_key collisions.
length <= 256x-codai-device*stringStable device UUID. Registers the device on first use (name/platform from x-codai-device-name / x-codai-device-platform) and selects the shared-sessions protocol.
uuidx-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Release outcome.
application/json- response
session_id*stringuuidreleased*booleanfalse when this device was not the holder.
curl -X DELETE 'https://ai.codai.ro/v1/sessions/3f7a4c1e-9b2d-4e8f-a1b6-5c0d7e2f9a34/lease' \ -H 'x-codai-device: 497f6eca-6276-4993-bfeb-53cbbbba6f08'{ "session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82", "released": true}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
id*stringServer UUID of the session OR its client session_key. Own sessions win on session_key collisions.
length <= 256after?integerReplay events with seq strictly greater than this before going live. Default 0 (full replay, capped at 1000).
0 <= value0x-codai-device*stringStable device UUID. Registers the device on first use (name/platform from x-codai-device-name / x-codai-device-platform) and selects the shared-sessions protocol.
uuidx-codai-device-name?stringHuman-readable device name used when the device is first registered (truncated to 120 chars).
length <= 120x-codai-device-platform?stringPlatform recorded on first registration; unknown values become agent.
"android""ios""web""desktop""cli""agent"x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Server-sent events; stays open up to 30 minutes.
response?stringtext/event-streamcurl -X GET 'https://ai.codai.ro/v1/sessions/3f7a4c1e-9b2d-4e8f-a1b6-5c0d7e2f9a34/stream' \ -H 'x-codai-device: 497f6eca-6276-4993-bfeb-53cbbbba6f08'"string"Last updated: