Read the current user session
const url = 'https://your-tenant-host/v1/id/get-session';const options = { method: 'GET', headers: { cookie: 'ek.session_token=<ek.session_token>', 'x-edgekit-site-id': 'site_example' }};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://your-tenant-host/v1/id/get-session \ --header 'x-edgekit-site-id: site_example' \ --cookie ek.session_token=<ek.session_token>Never cached. Mounted in all three idModes — the authority differs, not the surface, which is what lets an organization move external_only to dual without shipping an SDK release. No credential answers 200 with a null user and a null session, never 401. In dual it also performs the exchange on first sight and reports it as session.exchanged, which makes this a write — still safe to retry.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”The site this request is for, within this tenant. Every official EdgeKit SDK sets it from the client you configured; set it yourself only when calling this API directly.
Example
site_exampleThe site this request is for, within this tenant. Every official EdgeKit SDK sets it from the client you configured; set it yourself only when calling this API directly.
Responses
Section titled “Responses”The user and their session, or two nulls.
object
object
Example
{ "user": { "id": "01926f3a-8b4c-7d2e-9f10-2a3b4c5d6e7f", "email": "user@example.com", "emailVerified": true, "name": "Ada Lovelace", "firstName": "Ada", "lastName": "Lovelace", "image": null }, "session": { "id": "01926f3a-8b4d-7a11-8c22-3d4e5f6a7b8c", "kind": "edgekit", "expiresAt": "2026-08-30T09:00:00.000Z", "exchanged": true }}Invalid request.
object
object
Example
{ "error": { "code": "unauthorized", "message": "Invalid or missing API key." }}Not allowed.
object
object
Example
{ "error": { "code": "unauthorized", "message": "Invalid or missing API key." }}Resource not found.
object
object
Example
{ "error": { "code": "unauthorized", "message": "Invalid or missing API key." }}Request validation failed.
object
object
Example
{ "error": { "code": "unauthorized", "message": "Invalid or missing API key." }}Unexpected error.
object
object
Example
{ "error": { "code": "unauthorized", "message": "Invalid or missing API key." }}