Skip to main content
PUT
https://api.agenthuman.com
/
v1
/
sessions
/
{session_id}
/
end
End Session
curl --request PUT \
  --url https://api.agenthuman.com/v1/sessions/{session_id}/end \
  --header 'x-api-key: <api-key>'
{
  "success": true,
  "session": {
    "session_id": "sess_01H3Z8G9YR3K2N5M6P7Q8W4T",
    "avatar": {
      "avatar_id": "avat_01H3Z8G9YR3K2N5M6P7Q8W4T",
      "name": "Professional Avatar",
      "url": "https://example.com/avatar.jpg"
    },
    "session_type": "webrtc_video",
    "status": "ended",
    "started_at": "2024-01-15T10:30:00Z",
    "ended_at": "2024-01-15T10:35:00Z",
    "created_at": "2024-01-15T10:30:00Z"
  },
  "message": "Session ended successfully"
}
What This Does: Gracefully stops the avatar server, releases GPU resources, and marks the session as ended. Call this when you’re done with the conversation to avoid unnecessary charges.

Path Parameters

session_id
string
required
The session ID to end

Response

success
boolean
Whether the request was successful
session
object
The updated session object (See Session schema).
message
string
Success message

Important Notes

  • Only active sessions (status: started) can be ended
  • Marks the session with an ended_at timestamp
  • Session status transitions from started to ended
  • Once ended, the session cannot be restarted
  • If the session is already ended, the API returns success: true with a message (safe retry)
{
  "success": true,
  "session": {
    "session_id": "sess_01H3Z8G9YR3K2N5M6P7Q8W4T",
    "avatar": {
      "avatar_id": "avat_01H3Z8G9YR3K2N5M6P7Q8W4T",
      "name": "Professional Avatar",
      "url": "https://example.com/avatar.jpg"
    },
    "session_type": "webrtc_video",
    "status": "ended",
    "started_at": "2024-01-15T10:30:00Z",
    "ended_at": "2024-01-15T10:35:00Z",
    "created_at": "2024-01-15T10:30:00Z"
  },
  "message": "Session ended successfully"
}