Tenant Context Service
API Contract
REST
/api/v1/tenant-context
6 endpoints
GET
/api/v1/tenant-context/api/v1/tenant-context
Get the current active tenant context for the authenticated session
Public
Response Example
{
"data": [
{
"context_id": "ctx_01J4K8M2N3P5Q7Z1",
"org_id": "org_01J4K8M2N3P5Q7R9",
"org_name": "Northbrook Academy",
"user_id": "usr_01J4K8M2N3P5Q7A1",
"applied_at": "2026-03-26T09:00:00Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 1
}
}
GET
/api/v1/tenant-context/api/v1/tenant-context/:id
Get a specific tenant context record by context ID
Public
Response Example
{
"context_id": "ctx_01J4K8M2N3P5Q7Z1",
"org_id": "org_01J4K8M2N3P5Q7R9",
"org_name": "Northbrook Academy",
"user_id": "usr_01J4K8M2N3P5Q7A1",
"applied_at": "2026-03-26T09:00:00Z"
}
POST
/api/v1/tenant-context/api/v1/tenant-context
Set (apply) tenant context for the current session
Public
Request Example
{
"org_id": "org_01J4K8M2N3P5Q7R9"
}
Response Example
{
"context_id": "ctx_01J9X3P7K2M4N6D4",
"org_id": "org_01J4K8M2N3P5Q7R9",
"org_name": "Northbrook Academy",
"user_id": "usr_01J4K8M2N3P5Q7A1",
"applied_at": "2026-03-26T12:00:00Z",
"created_at": "2026-03-26T12:00:00Z"
}
PUT
/api/v1/tenant-context/api/v1/tenant-context/:id
Update active tenant context (switch org within session)
Public
Request Example
{
"org_id": "org_01J4K8M2N3P5Q7R8"
}
Response Example
{
"context_id": "ctx_01J9X3P7K2M4N6D4",
"org_id": "org_01J4K8M2N3P5Q7R8",
"org_name": "Westfield Learning Hub",
"user_id": "usr_01J4K8M2N3P5Q7A1",
"applied_at": "2026-03-26T13:00:00Z",
"updated_at": "2026-03-26T13:00:00Z"
}
DELETE
/api/v1/tenant-context/api/v1/tenant-context/:id
Clear (remove) tenant context for the current session
Public
Response Example
{
"success": true,
"cleared_at": "2026-03-26T14:00:00Z"
}
GET
/api/v1/tenant-context/api/v1/tenant-context/terminology/:key
Get a localized terminology label for the current org context
Public
Response Example
{
"key": "student",
"label": "Learner",
"org_id": "org_01J4K8M2N3P5Q7R9",
"locale": "en-IE"
}