Start a conversation session
Starts a conversation: the avatar listens and answers in a LiveKit room
your visitor joins. Responds 201 once the avatar is in the room, with
what livekit-client's Room.connect() needs.
The credential decides who pays:
- API key (
X-Api-Key): your backend starts it for your visitor, billed to your account. Call it server to server, never from a browser. - Signed-in user (
Authorization: Bearer): an Atmee website visitor. The avatar's settings decide whether the visitor or the owner pays. - No credential: a visitor on an avatar whose owner sponsors
anonymous chat, paid from its sponsor pool and rate-limited per IP.
visitorIdis required.
Rules:
maxDurationSecondsis capped by the key's and the plan's limits (and, withreservebilling, by the balance). The response says what was asked for, what was granted and whether it was cut.- The visitor must join within 60 seconds of the avatar, or the session
ends
failedwith nothing billed. - An avatar runs one live conversation per account at a time: a second
start is
409 avatar_busy. appTools(API key only) declares functions the avatar may call. Each call reaches the visitor's client as the LiveKit RPCatmee.tool(payload{id, name, arguments}); withx-atmee.mode: await, the client's answer is the result. The body may be up to 128 KiB.- End it with
POST /v1/sessions/{id}/end; read its state and cost withGET /v1/sessions/{id}.
X-Api-Key<token>Your secret API key (sk_atmee_...; older keys start sk_live_),
sent as X-Api-Key. Keep it on your server and never send it to a
browser.
application/json- body
The same body for every credential. The session runs in a LiveKit room.
avatarId*stringID of the avatar to launch. With an API key, it must be on the key's allow-list.
length <= 36maxDurationSeconds?integerThe session's maximum length in seconds. Absent, the most the key, the plan and the balance allow. Capped server-side.
1 <= value <= 14400visitorId?stringAn opaque id for this visitor. With an API key: at least 16 characters, used only when the key has cross-visit memory, and it must be unguessable (whoever can name it reads that visitor's history). Without a credential: required, at most 64 characters, and it counts the visitor's free daily time. Ignored for a signed-in user.
8 <= length <= 256language?stringPer-session language override (BCP 47), e.g. en, zh-TW or ja;
omit it to use the avatar's language. Any well-formed tag is
accepted. Speech recognition and replies are routed for en,
zh-TW and ja; other tags fall back to language auto-detection.
^[a-zA-Z]{2,3}(-[A-Za-z0-9]{2,8})*$length <= 35metadata?Optional free-form metadata to attach to the session.
properties <= 50location?Optional location metadata to attach to the session.
properties <= 20sttMultilingual?booleanRecognise speech in any supported language instead of the session's language only.
appTools?API key only; with any other credential the start answers 400 invalid_request.
checkInAfterS?numberSeconds of silence, 0 to 3600, before the avatar speaks up in
character; a second check-in waits twice as long, then it waits for
the visitor. 0 turns check-ins off; absent or null keeps the
default, about 10 seconds. Honoured by a v2 avatar on the default
conversation runtime, as every avatar built through this API is;
any other ignores it and keeps its usual check-in.
double0 <= value <= 3600welcome?booleanfalse starts without the avatar's welcome (no self-introduction or
welcome back): it waits for the visitor to speak, though a long
silence still gets a check-in (see checkInAfterS). Absent, null or
true: the avatar speaks first. Honoured by a v2 avatar on the
default conversation runtime, as every avatar built through this
API is; any other ignores it and speaks first.
The session started; the avatar has already joined the room.
application/json- response
A started conversation session: serverUrl, roomName and
userToken are what livekit-client's Room.connect() needs.
links?Absent when this deployment does not know the website's address.
sessionId*stringID of the created session
uuidserverUrl*stringBare LiveKit server URL — pass directly to Room.connect(). Never has a room path appended.
uriroomName*stringLiveKit room name, informational only — the token already selects the room.
userToken*stringLiveKit access token for the visitor's browser to join with.
actualDurationSeconds?integerThe granted session length in seconds, counted from when both the
visitor and the avatar are in the room. Absent when the session is
uncapped (a metered key without a session cap): do not start a
countdown then. A metered session ends when the balance or the key's
spend cap runs out, after a short grace, or at the service's maximum
length.
fundedSeconds?integerAnonymous sessions only, present when the avatar's sponsor budget
runs out before actualDurationSeconds: how long it pays for at
start, in seconds. The session ends there unless the budget grows.
requestedDurationSeconds?integerThe maxDurationSeconds you sent; omitted when you sent none.
durationCapped?booleanTrue when actualDurationSeconds is shorter than
requestedDurationSeconds: the key's, the plan's or the
balance's limit cut the session you asked for.
billingMode?stringDeprecatedDeprecated, kept for clients that read it: every billed session is
charged as it runs, so this is metered. Do not rely on it; it
will be removed.
"reserve""metered"watermark*booleanWhether the atmee.ai player draws its watermark over this avatar.
It follows the plan of the account that owns the avatar, not the
caller's or the visitor's: false when that plan waives the
watermark (its watermark feature is false), true otherwise.
It is true whenever the plan could not be read. Informational
for API callers: the service draws nothing into the video.
curl -X POST 'https://api.atmanity.us/v1/sessions' \ -H 'Content-Type: application/json' \ -d '{ "avatarId": "123e4567-e89b-12d3-a456-426614174000"}'{ "links": { "chat": "http://example.com" }, "sessionId": "550e8400-e29b-41d4-a716-446655440000", "serverUrl": "wss://atmanity.livekit.cloud", "roomName": "rk-8f14e45f-ceea-467a-9f21-4c2f5b3a91cd", "userToken": "string", "actualDurationSeconds": 0, "fundedSeconds": 0, "requestedDurationSeconds": 0, "durationCapped": true, "billingMode": "reserve", "watermark": true}
