Skip to content

Switch to a different tenant

POST
/api/v1/tenant/switch
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" }'
Media type application/json
object
organizationId
required

Target organization ID to switch to

string
duration

Duration of the switch

string
default: session
Allowed values: 15m 1h 4h session
reason

Reason for the switch

string
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