The Session object is an abstraction over an HTTP session. It models the period of information exchange between a user and the server. Sessions are created when a user successfully goes through the sign in or sign up flows.
Returns a list of all sessions.
The sessions are returned sorted by creation date, with the newest sessions appearing first.
Deprecation Notice (2024-01-01): All parameters were initially considered optional, however
moving forward at least one of client_id
or user_id
parameters should be provided.
Success
Request was not successful
Authentication invalid
Invalid request parameters
[- {
- "object": "session",
- "id": "string",
- "user_id": "string",
- "client_id": "string",
- "actor": { },
- "status": "active",
- "last_active_organization_id": "string",
- "last_active_at": 0,
- "latest_activity": {
- "object": "string",
- "id": "string",
- "device_type": "string",
- "is_mobile": true,
- "browser_name": "string",
- "browser_version": "string",
- "ip_address": "string",
- "city": "string",
- "country": "string"
}, - "expire_at": 0,
- "abandon_at": 0,
- "updated_at": 0,
- "created_at": 0
}
]
Create a new active session for the provided user ID.
This operation is only available for Clerk Development instances.
Success
Request was not successful
Authentication invalid
Request was not successful
Invalid request parameters
{- "user_id": "string"
}
{- "object": "session",
- "id": "string",
- "user_id": "string",
- "client_id": "string",
- "actor": { },
- "status": "active",
- "last_active_organization_id": "string",
- "last_active_at": 0,
- "latest_activity": {
- "object": "string",
- "id": "string",
- "device_type": "string",
- "is_mobile": true,
- "browser_name": "string",
- "browser_version": "string",
- "ip_address": "string",
- "city": "string",
- "country": "string"
}, - "expire_at": 0,
- "abandon_at": 0,
- "updated_at": 0,
- "created_at": 0
}
Retrieve the details of a session
Success
Request was not successful
Authentication invalid
Resource not found
{- "object": "session",
- "id": "string",
- "user_id": "string",
- "client_id": "string",
- "actor": { },
- "status": "active",
- "last_active_organization_id": "string",
- "last_active_at": 0,
- "latest_activity": {
- "object": "string",
- "id": "string",
- "device_type": "string",
- "is_mobile": true,
- "browser_name": "string",
- "browser_version": "string",
- "ip_address": "string",
- "city": "string",
- "country": "string"
}, - "expire_at": 0,
- "abandon_at": 0,
- "updated_at": 0,
- "created_at": 0
}
Sets the status of a session as "revoked", which is an unauthenticated state. In multi-session mode, a revoked session will still be returned along with its client object, however the user will need to sign in again.
Success
Request was not successful
Authentication invalid
Resource not found
{- "object": "session",
- "id": "string",
- "user_id": "string",
- "client_id": "string",
- "actor": { },
- "status": "active",
- "last_active_organization_id": "string",
- "last_active_at": 0,
- "latest_activity": {
- "object": "string",
- "id": "string",
- "device_type": "string",
- "is_mobile": true,
- "browser_name": "string",
- "browser_version": "string",
- "ip_address": "string",
- "city": "string",
- "country": "string"
}, - "expire_at": 0,
- "abandon_at": 0,
- "updated_at": 0,
- "created_at": 0
}
Returns the session if it is authenticated, otherwise returns an error. WARNING: This endpoint is deprecated and will be removed in future versions. We strongly recommend switching to networkless verification using short-lived session tokens, which is implemented transparently in all recent SDK versions (e.g. NodeJS SDK). For more details on how networkless verification works, refer to our Session Tokens documentation.
Success
Request was not successful
Authentication invalid
Resource not found
The endpoint is considered deprecated and is pending removal.
{- "token": "string"
}
{- "object": "session",
- "id": "string",
- "user_id": "string",
- "client_id": "string",
- "actor": { },
- "status": "active",
- "last_active_organization_id": "string",
- "last_active_at": 0,
- "latest_activity": {
- "object": "string",
- "id": "string",
- "device_type": "string",
- "is_mobile": true,
- "browser_name": "string",
- "browser_version": "string",
- "ip_address": "string",
- "city": "string",
- "country": "string"
}, - "expire_at": 0,
- "abandon_at": 0,
- "updated_at": 0,
- "created_at": 0
}
Creates a session JSON Web Token (JWT) based on a session.
OK
Authentication invalid
Resource not found
{- "expires_in_seconds": 30
}
{- "object": "token",
- "jwt": "string"
}
Creates a JSON Web Token(JWT) based on a session and a JWT Template name defined for your instance
OK
Authentication invalid
Resource not found
{- "expires_in_seconds": 30
}
{- "object": "token",
- "jwt": "string"
}