Atmee.aiDocs
APIAPI referenceSession

End a session

POST
/v1/sessions/{session_id}/end

Ends a session started with POST /v1/sessions now: the room closes and the avatar leaves. Use the credential that started it; with both, the API key applies.

  • API key: billing stops and the session settles completed with endReason: ended_by_api, billed only for the time both the visitor and the avatar were in the room. Idempotent: a session that already ended answers 200 with alreadyEnded: true.
  • Signed-in user: ends a website session of the user's account. A session that already ended is 409.

Authorization

headerX-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.

Path Parameters

session_id*string

The session to end.

Formatuuid

Response Body

The session is ended (API key: or already was, alreadyEnded).

application/json
  1. response
sessionId*string
Formatuuid
status*string
Value in"completed""failed"
endedAt?string
Formatdate-time
alreadyEnded*boolean

True when the session was already terminal before this call.

endReason?string

Why the session ended: ended_by_api for this call, or the earlier reason when it had already ended (see AvatarSessionStatusResponse.endReason).

Example Request
curl -X POST 'https://api.atmanity.us/v1/sessions/497f6eca-6276-4993-bfeb-53cbbbba6f08/end'
Example Response
{  "sessionId": "f6567dd8-e069-418e-8893-7d22fcf12459",  "status": "completed",  "endedAt": "2019-08-24T14:15:22Z",  "alreadyEnded": true,  "endReason": "string"}