Atmee.aiDocs
APIAPI referenceSpeech sessions

End a speech session

POST
/v1/speech_sessions/{session_id}/end

Ends the session with endReason: ended_by_api. With no connection open it settles at once. With one open, it ends at the next usage report (within 30 seconds) and is billed until then: the answer reads status: active with endRequestedAt set, and GET reads it completed once settled.

Idempotent: a repeat keeps the first request, and ending a settled session answers alreadyEnded: true.

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 speech session's id, as POST /v1/speech_sessions returned it.

Formatuuid

Response Body

The session is ended or its end is requested (or it already was ended).

application/json
  1. response
sessionId*string
Formatuuid
status*string

active when a connection is open: the end is requested (endRequestedAt) and settles at its next usage report.

Value in"active""completed""failed"
alreadyEnded*boolean

True when the session was settled before this call.

endRequestedAt?string

When the end was first requested, while a connection is open; null once settled at this call or before.

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