POST/sessions

Create a new active session

Create a new active session for the provided user ID.

This operation is intended only for use in testing, and is not available for production instances. If you are looking to generate a user session from the backend, we recommend using the Sign-in Tokens resource instead.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

2 body fields
user_idstringrequired
The ID representing the user
active_organization_idstringoptional
The ID of the organization to set as active for this session

5 status codes
200Success
objectstringrequired
String representing the object's type. Objects of the same type share the same value.
Allowed:session
idstringrequired
user_idstringrequired
client_idstringrequired
actorobjectoptional
statusstringrequired
Allowed:activerevokedendedexpiredremovedabandonedreplacedpending
last_active_organization_idstringoptional
last_active_atintegerrequired
latest_activityobjectoptional
expire_atintegerrequired
Unix timestamp of expiration.
abandon_atintegerrequired
Unix timestamp of abandonment.
updated_atintegerrequired
Unix timestamp of last update.
created_atintegerrequired
Unix timestamp of creation.
tasksarray<object>optional
400Request was not successful
errorsarray<object>required
metaobjectoptional
clerk_trace_idstringoptional
401Authentication invalid
errorsarray<object>required
metaobjectoptional
clerk_trace_idstringoptional
404Request was not successful
errorsarray<object>required
metaobjectoptional
clerk_trace_idstringoptional
422Invalid request parameters
errorsarray<object>required
metaobjectoptional
clerk_trace_idstringoptional

Error handling

A 400 is returned: Request was not successful. A 401 is returned: Authentication invalid. A 404 is returned: Request was not successful. A 422 is returned: Invalid request parameters.