Switch the session to another org
const url = 'https://api.sloose.com/auth/session/org';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"orgId":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.sloose.com/auth/session/org \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "orgId": "example" }'Points the session at one of the person’s orgs. Every org-scoped call after this runs there, with the role they hold there. Refused for an org they are not a member of, or where their access is revoked.
Session only.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Examplegenerated
{ "orgId": "example"}Responses
Section titled “Responses”The session now works in this org.
object
Example
{ "role": "owner"}The request body did not match the schema. issues carries the Zod issue list.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}No bearer, or one that is expired, revoked or no longer resolves to a member.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}Not a member of that org (code: NOT_A_MEMBER), access revoked (code: ACCESS_REVOKED), or the org has been closed (code: ORG_CLOSED).
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}