Skip to main content
DELETE
End Session
Deprecated. This endpoint is deprecated and will be sunset on 2026-07-11. It still works until then. Migrate to the V1 path — see the migration guide for the old -> new path table.
End an existing session when the conversation is complete. This is useful for cleanup and resource management.

Base URL

End Session

Path Parameters

projectId
string
required
The ID of your project

Request Headers

Authorization
string
required
Bearer token authentication using your Project API Key (starts with sk_). Format: Bearer {your-api-key}

Request Body

session_id
string
required
The unique identifier of the session to end

Response

success
boolean
Indicates whether the session was successfully ended
sessionId
string
The ID of the ended session
message
string
Confirmation message that the session has been ended

Example

Request

Response

Usage Notes

  • Resource Cleanup: Ending sessions helps free up server resources and should be done when conversations are complete
  • Session Variables: All session variables and conversation context are permanently removed when a session is ended
  • Session Management: The API will attempt to end the specified session. Success is returned regardless of whether the session was active

Error Responses

Example error responses: 400 Bad Request:
401 Unauthorized:

Best Practices

  1. Always End Sessions: End sessions when conversations are complete to prevent resource leaks
  2. Error Handling: Handle errors gracefully and implement appropriate retry logic for failed requests
  3. Session Tracking: Keep track of active session IDs in your application to manage them properly