Switch to a different tenant
POST
/api/v1/tenant/switch
const url = 'http://localhost:3000/api/v1/tenant/switch';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"organizationId":"example","duration":"15m","reason":"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 http://localhost:3000/api/v1/tenant/switch \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "organizationId": "example", "duration": "15m", "reason": "example" }'Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ” Media type application/json
object
organizationId
required
Target organization ID to switch to
string
duration
Duration of the switch
string
reason
Reason for the switch
string
Responses
Section titled “ Responses ” Media type application/json
object
id
required
Switch record ID
string
userId
required
User ID who performed the switch
string
fromOrgId
Original organization ID
string
fromOrgName
Original organization name
string
toOrgId
required
Target organization ID
string
toOrgName
Target organization name
string
duration
Duration of the switch
string
reason
Reason for switching
string
switchedAt
required
When the switch was performed
string format: date-time
expiresAt
When the switch expires
string format: date-time
returnedAt
When the user returned to default tenant
string format: date-time
isActive
required
Whether the switch is currently active
boolean
Example generated
{ "id": "example", "userId": "example", "fromOrgId": "example", "fromOrgName": "example", "toOrgId": "example", "toOrgName": "example", "duration": "example", "reason": "example", "switchedAt": "2026-04-15T12:00:00Z", "expiresAt": "2026-04-15T12:00:00Z", "returnedAt": "2026-04-15T12:00:00Z", "isActive": true}Already switched to another tenant
Not authorized to switch to this tenant
Organization not found