Skip to content

Switch the session to another company

POST
/v1/auth/switch-tenant
curl --request POST \
--url https://api.emite.cr/v1/auth/switch-tenant \
--header 'Content-Type: application/json' \
--data '{ "tenantId": "01a00c73-5c09-7bb5-8b9e-d91c43bd61dc" }'

Re-issues this session for another company the person is a member of. The new token keeps the original sign-in time, so it expires no later than the one it replaces, and follows the destination company’s session rules. It is returned in the body and in the X-Session-Token header. 403 TENANT_REQUIRES_REAUTH (params.reason: tenant_policy or sessions_revoked) when that company’s rules no longer admit this sign-in — its maximum session ran out, or an admin closed this member’s sessions for it: only signing in again enters it. The current session is not affected.

Media typeapplication/json
object
tenantId
required

Id of the company to switch to, one of memberships in GET /v1/auth/me. The person must be a member of it: 403 NOT_A_MEMBER otherwise.

string
Example
01a00c73-5c09-7bb5-8b9e-d91c43bd61dc

The session, re-issued for the destination company.

Media typeapplication/json
object
accessToken
required

The session token, a signed JWT: send it as Authorization: Bearer <accessToken>. It acts for the person, in the company it names when it names one (currentTenantId in GET /v1/auth/me). The same token comes in the X-Session-Token response header.

string
tokenType
required

Always Bearer: the scheme to send the token with in the Authorization header.

string
Allowed values: Bearer
expiresIn
required

Remaining life of this token: whole seconds followed by s ("28800s" = 8 hours). It never reaches past the maximum of the session, which counts from the sign-in, so a re-issued token (switching company, renewing) lives less. Under a company inactivity rule it also ends that many minutes after it was issued, unless it is renewed with POST /v1/auth/sessions/renew.

string
expiresAt
required

The instant this token expires (ISO 8601, UTC): expiresIn as a date.

string format: date-time
passwordChangeSuggested

Present, and true, only in the answer of POST /v1/auth/login, when the password that just signed in does not meet the rule a new password must meet today (12 to 72 characters, nothing of the person, hard to guess: see POST /v1/auth/signup). A suggestion to change it, never a refusal: the sign-in went through.

boolean
Example
{
"tokenType": "Bearer",
"expiresIn": "28800s",
"expiresAt": "2026-10-22T22:30:00.000Z",
"passwordChangeSuggested": true
}