DELETE
/
api
/
project
/
{projectId}
/
integration
/
api
/
session
End Session
curl --request DELETE \
  --url https://app.pathors.com/api/project/{projectId}/integration/api/session \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '{
  "session_id": "<string>"
}'
{
  "message": "<string>",
  "sessionId": "<string>"
}
End an existing session when the conversation is complete. This is useful for cleanup and resource management.

End Session

DELETE /api/project/{projectId}/integration/api/session

Path Parameters

projectId
string
required
The ID of your project

Request Headers

Authorization
string
required
Bearer token authentication using your API key

Request Body

session_id
string
required
The unique identifier of the session to end

Response

message
string
Confirmation message that the session has been ended
sessionId
string
The ID of the ended session

Example

Request

curl -X DELETE https://app.pathors.com/api/project/{projectId}/integration/api/session \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "session_id": "user-123-session-456"
  }'

Response

{
  "message": "Session ended successfully",
  "sessionId": "user-123-session-456"
}

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
  • Idempotent Operation: Attempting to end an already ended or non-existent session will return an appropriate error

Error Responses

Status CodeDescription
400Missing or invalid session_id
401Invalid authentication
404Session not found
500Internal server error
Example error response:
{
  "error": "Session not found"
}

Best Practices

  1. Always End Sessions: End sessions when conversations are complete to prevent resource leaks
  2. Error Handling: Handle 404 errors gracefully as sessions may have already been ended
  3. Session Tracking: Keep track of active session IDs in your application to manage them properly