Extend the open tenant switch
const url = 'http://localhost:3000/api/v1/tenant/switch';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"expiresAt":"2026-04-15T12:00:00Z","reason":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url http://localhost:3000/api/v1/tenant/switch \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "expiresAt": "2026-04-15T12:00:00Z", "reason": "example" }'Moves the expiry of the caller’s own open switch to a later time, at most 72 hours from now, with a reason (3-500 characters). Only a superadmin or support user holds switches. One audit entry (action extend) records the reason and the previous and new expiry. Not available to API keys.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”UUID of the organization (tenant) the request acts in. It selects the tenant and grants nothing: the server checks membership or an open tenant switch. Not needed for global operations. A malformed value returns 400. API keys are fixed to their own organization; another organization returns 403. The x-organization-source header grants nothing.
Request Bodyrequired
Section titled “Request Bodyrequired”object
New expiry (ISO 8601): later than the current expiry and at most 72 hours from now.
Why the switch is extended (3-500 characters after trimming)
Examplegenerated
{ "expiresAt": "2026-04-15T12:00:00Z", "reason": "example"}Responses
Section titled “Responses”Switch extended
object
Switch record ID
User ID who performed the switch
Original organization ID
Original organization name
Target organization ID
Target organization name
Duration of the switch
Reason for switching
When the switch was performed
When the switch expires
When the user returned to default tenant
Whether the switch is currently active
Examplegenerated
{ "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}Reason missing or out of range, expiresAt invalid, not later than the current expiry, or beyond the 72 h cap
No system role, or the caller is an API key (API keys cannot use tenant switches)
No open tenant switch
The switch has expired, or was ended or extended concurrently