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. See supported values below.

Supported reason values:

UNKNOWN, USER_DISCONNECTED, SERVER_ERROR, IDLE_TIMEOUT, NO_CREDITS, USER_CLOSED, AVATAR_DELETED, MAX_DURATION_REACHED, ZOMBIE_SESSION_REAP, USER_REQUEST_STOP, JOB_COMPLETED, JOB_CANCELLED, JOB_FAILED, BILLING_FAILED, BILLING_CANCELLED, TIMEOUT_INACTIVE, SERVER_SHUTDOWN

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 stopped successfully"
}

Next step​

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