Endpoint Details
Overview
The Active Sessions API provides a server-to-server endpoint for discovering active WordPress user sessions. Unlike traditional cookie-based approaches, this endpoint directly queries the WordPress database for session data, making it more reliable for cross-domain authentication.Authentication
All requests to this endpoint must include theX-ASAP-Sync-Secret header with the shared secret value configured in your WordPress environment. This secret is defined with the BETTER_AUTH_SECRET constant in your WordPress configuration.
Request Parameters
An identifier for the source of the request (e.g., “svelte-kit-server”)
The current timestamp in milliseconds
Optional server information for debugging purposes
Response Format
Indicates whether the operation was successful
Array of user objects with active WordPress sessions
Server timestamp when the response was generated
Error message if success is false
Error Codes
| Error Code | Description | HTTP Status |
|---|---|---|
unauthorized | Invalid or missing sync secret | 401 |
no_active_wp_sessions | No active WordPress sessions found | 200 |
no_eligible_active_sessions | Active sessions found but not with required roles | 200 |