Orgs & Sharing
Share a session with a user, an org or a link, and manage the orgs you belong to.
Shares grant viewer, editor or owner on one session; link shares return a token the recipient presents as x-codai-share-token or ?share=. Org objects are returned camelCase (ownerUserId, createdAt) while member lists are snake_case — mirrored here exactly as the gateway sends them. Background: sharing & orgs.
Agents read your orgs through the MCP server tools orgs_list and org_members_list (id; members only). Both are read-only: creating orgs and adding or removing members stay in the hub.
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).
archived?stringSet to 1 or true to include archived sessions.
"1""true"x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Shared sessions with your effective role.
application/json- response
sessions*array<>curl -X GET 'https://ai.codai.ro/v1/sessions/shared-with-me'{ "sessions": [ { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "session_key": "string", "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, "role": "viewer", "share_id": "853fa54b-9753-4ffb-b7d0-6739f9ae0f8e" } ]}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*stringSession UUID or your session_key (the value used as x-codai-session-id). Own sessions win on session_key collisions.
length <= 128x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Shares of the session.
application/json- response
shares*array<>curl -X GET 'https://ai.codai.ro/v1/sessions/6f1c2a4e-9d3b-4c7a-8e21-0b5f3d9a7c11/shares'{ "shares": [ { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82", "principal_type": "user", "principal_id": "string", "role": "viewer", "has_token": true, "expires_at": "2019-08-24T14:15:22Z", "created_by_user_id": "209f54c4-4c33-43bc-9c6a-ef4c65ad7473", "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*stringSession UUID or your session_key (the value used as x-codai-session-id). Own sessions win on session_key collisions.
length <= 128x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128application/json- body
principal_type*OrgSharePrincipalTypeWho a share is for.
"user""org""link"principal_id?stringRequired (user or org UUID) for user and org; forbidden for link.
1 <= length <= 128role?stringRole to grant. Default viewer.
"viewer""viewer""editor""owner"expires_at?stringISO 8601 with offset; must be in the future. Omit for no expiry.
date-timeThe created share; token is present only for link shares.
application/json- response
id*stringuuidsession_id*stringuuidprincipal_type*OrgSharePrincipalTypeWho a share is for.
"user""org""link"principal_id*|User UUID or org UUID; null for link shares.
role*OrgSessionRoleRole granted on a session.
"viewer""editor""owner"has_token*booleanLink shares only — a token exists. The plaintext is never returned after creation.
expires_at*|date-timecreated_by_user_id*stringuuidcreated_at*stringdate-timetoken?stringPlaintext link token (base64url, 43 chars). Returned once; link shares only.
curl -X POST 'https://ai.codai.ro/v1/sessions/6f1c2a4e-9d3b-4c7a-8e21-0b5f3d9a7c11/shares' \ -H 'Content-Type: application/json' \ -d '{ "principal_type": "user"}'{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82", "principal_type": "user", "principal_id": "string", "role": "viewer", "has_token": true, "expires_at": "2019-08-24T14:15:22Z", "created_by_user_id": "209f54c4-4c33-43bc-9c6a-ef4c65ad7473", "created_at": "2019-08-24T14:15:22Z", "token": "Qm9keSBvZiB0aGUgdG9rZW4gaXMgcmFuZG9tIGJ5dGVz"}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*stringSession UUID or your session_key (the value used as x-codai-session-id). Own sessions win on session_key collisions.
length <= 128x-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*stringuuidcurl -X DELETE 'https://ai.codai.ro/v1/sessions/6f1c2a4e-9d3b-4c7a-8e21-0b5f3d9a7c11/shares/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).
x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128application/json- body
name*stringDisplay name; trimmed.
1 <= length <= 200The new org.
application/json- response
The stored org row (camelCase, as persisted) plus the caller's role.
id*stringuuidname*stringownerUserId*stringuuidcreatedAt*stringdate-timerole*OrgRoleRole inside an org.
"owner""admin""member"curl -X POST 'https://ai.codai.ro/v1/orgs' \ -H 'Content-Type: application/json' \ -d '{ "name": "Acme Robotics"}'{ "id": "7e2f9b4c-1a3d-4e5f-9b8c-2d4e6f8a0b1c", "name": "Acme Robotics", "ownerUserId": "283eeac5-beea-465a-80a5-763009480d0f", "createdAt": "2026-09-23T08:41:12.000Z", "role": "owner"}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-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Your orgs.
application/json- response
orgs*array<>curl -X GET 'https://ai.codai.ro/v1/orgs'{ "orgs": [ { "id": "7e2f9b4c-1a3d-4e5f-9b8c-2d4e6f8a0b1c", "name": "Acme Robotics", "ownerUserId": "283eeac5-beea-465a-80a5-763009480d0f", "createdAt": "2026-09-23T08:41:12.000Z", "role": "owner" } ]}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*stringOrg UUID.
uuidx-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Members of the org.
application/json- response
org_id*stringuuidmembers*array<>curl -X GET 'https://ai.codai.ro/v1/orgs/497f6eca-6276-4993-bfeb-53cbbbba6f08/members'{ "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b", "members": [ { "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", "role": "owner", "created_at": "2019-08-24T14:15:22Z", "email": "user@example.com" } ]}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*stringOrg UUID.
uuidx-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128application/json- body
Exactly one of user_id or email is required.
user_id?stringuuidemail?stringemailrole?stringDefault member. owner can only be granted by the org owner.
"member""owner""admin""member"The membership as stored.
application/json- response
org_id*stringuuiduser_id*stringuuidrole*OrgRoleRole inside an org.
"owner""admin""member"curl -X POST 'https://ai.codai.ro/v1/orgs/497f6eca-6276-4993-bfeb-53cbbbba6f08/members' \ -H 'Content-Type: application/json' \ -d '{}'{ "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b", "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", "role": "owner"}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*stringOrg UUID.
uuiduserId*stringUUID of the member to remove.
uuidx-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Removed.
application/json- response
deleted*truetrueorg_id*stringuuiduser_id*stringuuidcurl -X DELETE 'https://ai.codai.ro/v1/orgs/497f6eca-6276-4993-bfeb-53cbbbba6f08/members/497f6eca-6276-4993-bfeb-53cbbbba6f08'{ "deleted": true, "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b", "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"}Last updated: