Get current tenant context
const url = 'http://localhost:3000/api/v1/tenant/context';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url http://localhost:3000/api/v1/tenant/context \ --header 'Authorization: Bearer <token>'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.
Responses
Section titled “Responses”object
Whether user is currently switched to another tenant
Original organization ID (if switched)
Original organization name (if switched)
Current organization ID
Current organization name
Current organization slug
Original organization slug (if switched)
Active switch details (if switched)
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
When the switch expires (if switched)
The caller’s role in the current organization, from the database: admin, operator, viewer, a custom role name, support, or superadmin. Null when unresolved.
The caller’s effective permissions in the current organization, as the server enforces them.
Examplegenerated
{ "isSwitched": true, "originalOrgId": "example", "originalOrgName": "example", "currentOrgId": "example", "currentOrgName": "example", "currentOrgSlug": "example", "originalOrgSlug": "example", "activeSwitch": { "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 }, "expiresAt": "2026-04-15T12:00:00Z", "currentRole": "example", "permissions": [ "example" ]}Forbidden. The caller lacks the permission, is an API key (API keys cannot use tenant switches), or is not a member of the organization named by x-organization-id. This endpoint is a global operation, so it never returns TENANT_SWITCH_REQUIRED.