Overview
Clean up all sessions at once. Useful for emergency cleanup or application shutdown scenarios.
Request
Bearer token for authentication
Response
Whether the operation completed successfully
Whether any sessions were deleted
{
"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.