Skip to main content
DELETE
/
v1
/
sessions
Delete All Sessions
curl --request DELETE \
  --url https://api.example.com/v1/sessions \
  --header 'Authorization: <authorization>'
{
  "success": true,
  "deleted": true,
  "message": "Sessions deleted successfully"
}

Overview

Clean up all sessions at once. Useful for emergency cleanup or application shutdown scenarios.

Request

Authorization
string
required
Bearer token for authentication

Response

success
boolean
Whether the operation completed successfully
deleted
boolean
Whether any sessions were deleted
message
string
Result message
{
  "success": true,
  "deleted": true,
  "message": "Sessions deleted successfully"
}

Example

curl -X DELETE https://api.agi.tech/v1/sessions \
  -H "Authorization: Bearer $AGI_API_KEY"

Use Cases

Emergency Cleanup

# Delete all sessions on application shutdown
def shutdown_handler():
    print("Cleaning up all sessions...")
    result = delete_all_sessions()

    if result["deleted"]:
        print("All sessions cleaned up")
    else:
        print("No active sessions to clean")

# Register shutdown handler
import atexit
atexit.register(shutdown_handler)

Best Practices

This operation deletes ALL sessions immediately and cannot be undone. Use with caution.
Consider using individual session deletion for more granular control in production environments.
All running tasks will be cancelled and browsers closed when sessions are deleted.