Skip to main content
Version: Latest

Stop Session

Ends an active session and releases server resources. You should always call this when the user finishes the conversation or closes the browser so usage is billed correctly. This is the final step in the overall flow.

POST/api/v2/sessions/stop

Headers

HeaderValue
STUDIO-API-KEY{userKey}
Content-Typeapplication/json

Body

ParameterTypeRequiredDescription
session_idstringrequiredSession to stop. Use data.session_id from the Start Session response
reasonenumrequiredClose reason: USER_CLOSED, TIMEOUT, ERROR

Examples

curl https://ai-streamer.deepbrain.io/api/v2/sessions/stop \
-H "Content-Type: application/json" \
-H "STUDIO-API-KEY: ${userKey}" \
-X POST \
-d '{
"session_id": "${SESSION_ID}",
"reason": "USER_CLOSED"
}'

Success (code: 1000)

{
"code": 1000,
"data": null,
"message": "Session has been stopped"
}

Next step

After a successful stop, billing stops and all resources for the session are released.