@abgov/adsp-sdk-mcp-server 1.33.0 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -156,7 +156,7 @@
156
156
  "urn": "urn:ads:platform:tenant-service",
157
157
  "name": "Tenant service",
158
158
  "title": "Tenant management service",
159
- "operations": 15,
159
+ "operations": 16,
160
160
  "file": "tenant-management-api.json"
161
161
  },
162
162
  {
@@ -1 +1 @@
1
- {"openapi":"3.0.0","info":{"title":"Tenant management service","version":"0.0.0","description":"The tenant management service includes APIs for common platform capabilities like retrieving tenant information."},"paths":{"/api/tenant/v1":{"post":{"deprecated":true,"tags":["Tenant service"],"description":"Deprecated; use POST /api/tenant/v2/tenants, which shares this endpoint's implementation but also validates the name length and characters. Creates a tenant. Requires the core realm beta-tester or tenant-service-admin role; tenant users are rejected even with those roles.\n\nBy default a new realm is created for the tenant, with the current user as the administrator; the response is sent with status 202 while the realm is provisioned. Users with the tenant-service-admin role can instead set realm to associate the tenant with an existing realm, in which case adminEmail is required and the response is sent with status 200. Only tenant-service-admin users can set realm or adminEmail.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Name of the tenant. Must be unique (ignoring case) and must not contain special characters such as ! & % - or /.\n"},"realm":{"type":"string","description":"Existing realm to associate with the tenant. Requires the tenant-service-admin role."},"adminEmail":{"type":"string","format":"email","description":"Email of the tenant administrator. Requires the tenant-service-admin role."}}},"examples":{"newRealm":{"summary":"Create a tenant with a new realm","value":{"name":"Test Tenant"}},"existingRealm":{"summary":"Associate an existing realm (tenant-service-admin only)","value":{"name":"Test Tenant","realm":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f","adminEmail":"test.admin@gov.ab.ca"}}}}}},"responses":{"200":{"description":"Tenant is created with an existing realm.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"}}}},"202":{"description":"Tenant is created and its realm is being provisioned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"},"example":{"id":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","name":"Test Tenant","realm":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f","status":"provisioning","adminEmail":"test.admin@gov.ab.ca"}}}},"400":{"description":"The name is missing, the name is invalid or already used, the administrator already has a tenant, or the realm is already associated with a tenant or set without adminEmail.\n","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/TenantV1ValidationError"},{"$ref":"#/components/schemas/TenantError"}]},"examples":{"missingName":{"summary":"Name is missing","value":{"success":false,"errors":[{"property":"name","constraints":{"isDefined":"name should not be null or undefined"}}]}},"nameUsed":{"summary":"Name is already used","value":{"errorMessage":"Value not valid for Tenant name: This tenant name has already been used. Please enter a different tenant name."}}}}}},"401":{"$ref":"#/components/responses/TenantUnauthorized"}}},"delete":{"deprecated":true,"tags":["Tenant service"],"description":"Deprecated; use DELETE /api/tenant/v2/tenants/{id}, after looking up the tenant ID with GET /api/tenant/v2/tenants?realm={realm}. Deletes the tenant with the given realm, and the realm. Requires the core realm tenant-service-admin role.\n","parameters":[{"in":"query","name":"realm","required":true,"description":"Realm of the tenant to delete.","schema":{"type":"string"},"example":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f"}],"responses":{"200":{"description":"Tenant deletion completed. success is false if the realm or the tenant record wasn't deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantDeleteResult"}}}},"400":{"$ref":"#/components/responses/TenantV1BadRequest"},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"404":{"description":"No tenant has the realm.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantError"},"example":{"errorMessage":"tenant with ID 'realm: 2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f' could not be found."}}}}}}},"/api/tenant/v1/email":{"post":{"deprecated":true,"tags":["Tenant service"],"description":"Deprecated; use GET /api/tenant/v2/tenants?adminEmail={email}, which limits tenant users to their own tenant. Retrieves the tenant with the given administrator email. Available to any authenticated user of any tenant or the core realm; no role is required.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","description":"Email of the tenant administrator."}}},"example":{"email":"test.admin@gov.ab.ca"}}}},"responses":{"200":{"description":"Tenant information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"}}}},"400":{"$ref":"#/components/responses/TenantV1BadRequest"},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"404":{"$ref":"#/components/responses/TenantNotFound"}}}},"/api/tenant/v1/name":{"post":{"deprecated":true,"tags":["Tenant service"],"description":"Deprecated; use GET /api/tenant/v2/tenants?name={name}, which limits tenant users to their own tenant. Retrieves the tenant with the given name, ignoring case. Available to any authenticated user of any tenant or the core realm; no role is required.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Name of the tenant."}}},"example":{"name":"Test Tenant"}}}},"responses":{"200":{"description":"Tenant information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"}}}},"400":{"$ref":"#/components/responses/TenantV1BadRequest"},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"404":{"$ref":"#/components/responses/TenantNotFound"}}}},"/api/tenant/v1/realm/roles":{"get":{"deprecated":true,"tags":["Tenant service"],"description":"Deprecated; there is no v2 replacement. Returns the Keycloak roles of the realm that issued the current user's token, which is the user's own tenant realm. Requires the tenant-admin role.\n","responses":{"200":{"description":"Roles of the realm.","content":{"application/json":{"schema":{"type":"object","properties":{"roles":{"type":"array","items":{"$ref":"#/components/schemas/TenantRealmRole"}}}},"example":{"roles":[{"id":"0b9a6c2e-7d4f-4e1a-9c3b-5a8d2f6e1c7b","name":"offline_access","description":"${role_offline-access}","composite":false,"clientRole":false,"containerId":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f"}]}}}},"401":{"$ref":"#/components/responses/TenantUnauthorized"}}}},"/api/tenant/v1/realm/{realm}":{"get":{"deprecated":true,"tags":["Tenant service"],"description":"Deprecated; use GET /api/tenant/v2/tenants?realm={realm}, which limits tenant users to their own tenant. Retrieves a tenant by realm. Available to any authenticated user of any tenant or the core realm; no role is required.\n","parameters":[{"in":"path","name":"realm","required":true,"description":"Realm of the tenant.","schema":{"type":"string"},"example":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f"}],"responses":{"200":{"description":"Tenant information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantResult"}}}},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"404":{"$ref":"#/components/responses/TenantNotFound"}}}},"/api/tenant/v1/user/default-idp":{"get":{"tags":["Tenant service"],"description":"Internal endpoint used by the tenant admin webapp. Checks if the given user in the core realm is linked to the default ADSP identity provider. Requires the tenant-admin role and is rate limited.\n","parameters":[{"in":"query","name":"userId","required":true,"description":"ID of the user in the core realm.","schema":{"type":"string"},"example":"3d1c5e7a-9b2f-4c6d-8e0a-1f3b5d7c9e2a"}],"responses":{"200":{"description":"Whether the user is linked to the default identity provider in the core realm.","content":{"application/json":{"schema":{"type":"object","properties":{"hasDefaultIdpInCore":{"type":"boolean"}}},"example":{"hasDefaultIdpInCore":true}}}},"400":{"description":"userId is missing, or the identity providers of the user could not be read.","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/TenantV1ValidationError"},{"$ref":"#/components/schemas/TenantError"}]},"examples":{"missingUserId":{"summary":"userId is missing","value":{"success":false,"errors":[{"property":"userId","constraints":{"isDefined":"userId should not be null or undefined"}}]}},"checkFailed":{"summary":"Identity providers could not be read","value":{"errorMessage":"Failed to check the goa-ad IdP in core for user 3d1c5e7a-9b2f-4c6d-8e0a-1f3b5d7c9e2a due to Request failed with status code 404"}}}}}},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"429":{"$ref":"#/components/responses/TenantTooManyRequests"}}}},"/api/tenant/v1/user/id":{"get":{"tags":["Tenant service"],"description":"Internal endpoint used by the tenant admin webapp. Looks up the ID of the user with the given email in a realm, which defaults to the core realm. Requires the tenant-admin role and is rate limited.\n","parameters":[{"in":"query","name":"email","required":true,"description":"Email of the user.","schema":{"type":"string"},"example":"test.user@gov.ab.ca"},{"in":"query","name":"realm","required":false,"description":"Realm to look up the user in. Defaults to core.","schema":{"type":"string"},"example":"core"}],"responses":{"200":{"description":"ID of the user, or null if there is no user with the email.","content":{"application/json":{"schema":{"type":"object","properties":{"userIdInCore":{"type":"string","nullable":true}}},"example":{"userIdInCore":"3d1c5e7a-9b2f-4c6d-8e0a-1f3b5d7c9e2a"}}}},"400":{"$ref":"#/components/responses/TenantV1BadRequest"},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"429":{"$ref":"#/components/responses/TenantTooManyRequests"}}}},"/api/tenant/v1/user/idp":{"delete":{"tags":["Tenant service"],"description":"Internal endpoint used by the tenant admin webapp. Removes the link between a user and an identity provider in a realm. Requires the tenant-admin role and is rate limited.\n","parameters":[{"in":"query","name":"userId","required":true,"description":"ID of the user in the realm.","schema":{"type":"string"},"example":"3d1c5e7a-9b2f-4c6d-8e0a-1f3b5d7c9e2a"},{"in":"query","name":"realm","required":true,"description":"Realm of the user.","schema":{"type":"string"},"example":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f"},{"in":"query","name":"idpName","required":false,"description":"Alias of the identity provider. Defaults to goa-ad.","schema":{"type":"string"},"example":"goa-ad"}],"responses":{"200":{"description":"Identity provider link removed.","content":{"text/plain":{"schema":{"type":"string"},"example":"OK"}}},"400":{"description":"A required parameter is missing, or the identity provider link could not be removed.","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/TenantV1ValidationError"},{"$ref":"#/components/schemas/TenantError"}]},"examples":{"missingRealm":{"summary":"realm is missing","value":{"success":false,"errors":[{"property":"realm","constraints":{"isDefined":"realm should not be null or undefined"}}]}},"removeFailed":{"summary":"Link could not be removed","value":{"errorMessage":"Failed to delete the IdP goa-ad from user 3d1c5e7a-9b2f-4c6d-8e0a-1f3b5d7c9e2a due to Request failed with status code 404"}}}}}},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"429":{"$ref":"#/components/responses/TenantTooManyRequests"}}}},"/api/tenant/v1/{id}":{"get":{"deprecated":true,"tags":["Tenant service"],"description":"Deprecated; use GET /api/tenant/v2/tenants/{id}, which limits tenant users to their own tenant. Retrieves a tenant by ID. Available to any authenticated user of any tenant or the core realm, and not limited to the user's own tenant; no role is required.\n","parameters":[{"in":"path","name":"id","required":true,"description":"ID of the tenant, without the URN prefix.","schema":{"type":"string"},"example":"61f2e3a8c9b1d2e3f4a5b6c7"}],"responses":{"200":{"description":"Tenant information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantResult"}}}},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"404":{"$ref":"#/components/responses/TenantNotFound"}}}},"/api/tenant/v2/tenants":{"get":{"tags":["Tenant service"],"description":"Search for active tenants; tenants that are still provisioning are not included. No role is required. Authenticated tenant users only find their own tenant; authenticated core users, including service accounts, can find any tenant.\n\nAnonymous requests (without a valid bearer token) are allowed if they include the name or realm criteria, and the results do not include the administrator email.\n","security":[{},{"accessToken":[]}],"parameters":[{"in":"query","name":"name","schema":{"type":"string","minLength":1,"maxLength":50},"description":"Name of the tenant, matched as a whole and ignoring case.","example":"Test Tenant"},{"in":"query","name":"realm","schema":{"type":"string","minLength":1,"maxLength":50},"description":"Realm of the tenant.","example":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f"},{"in":"query","name":"adminEmail","schema":{"type":"string","format":"email"},"description":"Email of the tenant administrator. Anonymous requests must also include name or realm.","example":"test.admin@gov.ab.ca"}],"responses":{"200":{"description":"Matching tenants.","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/Tenant"}},"page":{"type":"object","properties":{"size":{"type":"number"}}}}},"examples":{"authenticated":{"summary":"Authenticated request","value":{"results":[{"id":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","name":"Test Tenant","realm":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f","status":"active","adminEmail":"test.admin@gov.ab.ca"}],"page":{"size":1}}},"anonymous":{"summary":"Anonymous request, without the administrator email","value":{"results":[{"id":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","name":"Test Tenant","realm":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f","status":"active"}],"page":{"size":1}}}}}}},"400":{"$ref":"#/components/responses/TenantBadRequest"},"401":{"description":"Anonymous request does not include name or realm criteria.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantError"},"example":{"errorMessage":"Request must include realm id or name criteria."}}}}}},"post":{"tags":["Tenant service"],"description":"Create a tenant. Requires the core realm beta-tester or tenant-service-admin role; tenant users are rejected even with those roles.\n\nBy default a new realm is created for the tenant, with the current user as the administrator; the response is sent with status 202 while the realm is provisioned, and a beta-tester who is already the administrator of a tenant is rejected. Users with the tenant-service-admin role can instead set realm to associate the tenant with an existing realm, in which case adminEmail is required and the response is sent with status 200. Only tenant-service-admin users can set realm or adminEmail.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[0-9a-zA-Z _]{1,50}$","description":"Name of the tenant. Must be unique, ignoring case."},"realm":{"type":"string","nullable":true,"minLength":1,"maxLength":50,"description":"Existing realm to associate with the tenant. Requires the tenant-service-admin role."},"adminEmail":{"type":"string","nullable":true,"format":"email","description":"Email of the tenant administrator. Requires the tenant-service-admin role."}}},"examples":{"newRealm":{"summary":"Create a tenant with a new realm","value":{"name":"Test Tenant"}},"existingRealm":{"summary":"Associate an existing realm (tenant-service-admin only)","value":{"name":"Test Tenant","realm":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f","adminEmail":"test.admin@gov.ab.ca"}}}}}},"responses":{"200":{"description":"Tenant created with an existing realm.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"}}}},"202":{"description":"Tenant created and its realm is being provisioned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"},"example":{"id":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","name":"Test Tenant","realm":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f","status":"provisioning","adminEmail":"test.admin@gov.ab.ca"}}}},"400":{"description":"Request is invalid, for example the name is invalid or already used, the administrator already has a tenant, or the realm is already associated with a tenant or set without adminEmail.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantError"},"examples":{"invalidName":{"summary":"Name failed validation","value":{"errorMessage":"Validation failed with error(s): name (body) - Invalid value"}},"nameUsed":{"summary":"Name is already used","value":{"errorMessage":"Value not valid for Tenant name: This tenant name has already been used. Please enter a different tenant name."}},"adminHasTenant":{"summary":"Administrator already has a tenant","value":{"errorMessage":"test.admin@gov.ab.ca is the tenant admin in our record. One user can create only one realm."}}}}}},"401":{"description":"Request does not include a valid bearer token, the user does not have the required role, or a user without the tenant-service-admin role set realm or adminEmail.\n","content":{"text/plain":{"schema":{"type":"string"},"example":"Unauthorized"},"application/json":{"schema":{"$ref":"#/components/schemas/TenantError"},"example":{"errorMessage":"tenant-service-admin role needed!"}}}}}}},"/api/tenant/v2/tenants/{id}":{"parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true,"description":"ID of the tenant, without the URN prefix.","example":"61f2e3a8c9b1d2e3f4a5b6c7"}],"get":{"tags":["Tenant service"],"description":"Retrieves a tenant. No role is required, but the request must be authenticated. Tenant users can only retrieve their own tenant, and get 403 for any other tenant ID; core users can retrieve any tenant.\n","responses":{"200":{"description":"Tenant information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"}}}},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"403":{"description":"Tenant user is not permitted to retrieve another tenant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantError"},"example":{"errorMessage":"User Test User (ID: 3d1c5e7a-9b2f-4c6d-8e0a-1f3b5d7c9e2a) not permitted to get tenant."}}}},"404":{"$ref":"#/components/responses/TenantNotFound"}}},"delete":{"tags":["Tenant service"],"description":"Deletes a tenant and its realm. Requires the core realm tenant-service-admin role, which can delete any tenant; tenant users are rejected.\n","responses":{"200":{"description":"Tenant deletion completed. success is false if the realm or the tenant record wasn't deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantDeleteResult"}}}},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"404":{"$ref":"#/components/responses/TenantNotFound"}}}},"/api/tenant/v2/tenants/{id}/name":{"parameters":[{"in":"path","name":"id","required":true,"description":"ID of the tenant, without the URN prefix.","schema":{"type":"string"},"example":"61f2e3a8c9b1d2e3f4a5b6c7"}],"patch":{"tags":["Tenant service"],"description":"Update the tenant name. Requires the core realm tenant-service-admin role, which can rename any tenant; tenant users, including tenant administrators, are rejected. Rate limited.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[0-9a-zA-Z _]{1,50}$"}}},"example":{"name":"Renamed Tenant"}}}},"responses":{"200":{"description":"Updated tenant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"},"example":{"id":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","name":"Renamed Tenant","realm":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f","status":"active","adminEmail":"test.admin@gov.ab.ca"}}}},"400":{"$ref":"#/components/responses/TenantBadRequest"},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"404":{"$ref":"#/components/responses/TenantNotFound"},"429":{"$ref":"#/components/responses/TenantTooManyRequests"}}}}},"components":{"securitySchemes":{"accessToken":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"responses":{"TenantBadRequest":{"description":"Request is invalid, for example a parameter failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantError"},"example":{"errorMessage":"Validation failed with error(s): name (body) - Invalid value"}}}},"TenantNotFound":{"description":"Tenant not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantError"},"example":{"errorMessage":"Tenant with ID '61f2e3a8c9b1d2e3f4a5b6c7' could not be found."}}}},"TenantTooManyRequests":{"description":"Too many requests; limited to 200 requests per 5 minutes.","content":{"text/plain":{"schema":{"type":"string"},"example":"Too many requests, please try again later."}}},"TenantUnauthorized":{"description":"Request does not include a valid bearer token, or the user does not have the role required for the operation. Role checks in this API respond with 401 rather than 403.\n","content":{"text/plain":{"schema":{"type":"string"},"example":"Unauthorized"}}},"TenantV1BadRequest":{"description":"A required parameter is missing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantV1ValidationError"}}}}},"schemas":{"Tenant":{"type":"object","properties":{"id":{"type":"string","readOnly":true,"description":"URN of the tenant.","example":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7"},"name":{"type":"string","example":"Test Tenant"},"realm":{"type":"string","description":"Keycloak realm of the tenant, which is the issuer of the tenant's access tokens.","example":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f"},"status":{"type":"string","readOnly":true,"enum":["provisioning","active"],"description":"Status of the tenant; a new tenant is provisioning until its realm has been created.","example":"active"},"adminEmail":{"type":"string","description":"Email of the tenant administrator. Not included for anonymous requests.","example":"test.admin@gov.ab.ca"}},"example":{"id":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","name":"Test Tenant","realm":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f","status":"active","adminEmail":"test.admin@gov.ab.ca"}},"TenantDeleteResult":{"type":"object","properties":{"deletedRealm":{"type":"boolean"},"deletedTenant":{"type":"boolean"},"success":{"type":"boolean"}},"example":{"deletedRealm":true,"deletedTenant":true,"success":true}},"TenantError":{"type":"object","properties":{"errorMessage":{"type":"string"}},"example":{"errorMessage":"Tenant with ID '61f2e3a8c9b1d2e3f4a5b6c7' could not be found."}},"TenantRealmRole":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"composite":{"type":"boolean"},"clientRole":{"type":"boolean"},"containerId":{"type":"string"}},"example":{"id":"0b9a6c2e-7d4f-4e1a-9c3b-5a8d2f6e1c7b","name":"offline_access","description":"${role_offline-access}","composite":false,"clientRole":false,"containerId":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f"}},"TenantResult":{"type":"object","properties":{"success":{"type":"boolean"},"tenant":{"$ref":"#/components/schemas/Tenant"}},"example":{"success":true,"tenant":{"id":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","name":"Test Tenant","realm":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f","status":"active","adminEmail":"test.admin@gov.ab.ca"}}},"TenantV1ValidationError":{"type":"object","properties":{"success":{"type":"boolean"},"errors":{"type":"array","items":{"type":"object","properties":{"property":{"type":"string"},"constraints":{"type":"object","additionalProperties":{"type":"string"}}}}}},"example":{"success":false,"errors":[{"property":"email","constraints":{"isDefined":"email should not be null or undefined"}}]}}}},"security":[{"accessToken":[]}],"tags":[{"name":"Tenant service","description":"Tenant API to store and read tenant information."}]}
1
+ {"openapi":"3.0.0","info":{"title":"Tenant management service","version":"0.0.0","description":"The tenant management service includes APIs for common platform capabilities like retrieving tenant information."},"paths":{"/api/tenant/v1":{"post":{"deprecated":true,"tags":["Tenant service"],"description":"Deprecated; use POST /api/tenant/v2/tenants, which shares this endpoint's implementation but also validates the name length and characters. Creates a tenant. Requires the core realm beta-tester or tenant-service-admin role; tenant users are rejected even with those roles.\n\nBy default a new realm is created for the tenant, with the current user as the administrator; the response is sent with status 202 while the realm is provisioned. Users with the tenant-service-admin role can instead set realm to associate the tenant with an existing realm, in which case adminEmail is required and the response is sent with status 200. Only tenant-service-admin users can set realm or adminEmail.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Name of the tenant. Must be unique (ignoring case) and must not contain special characters such as ! & % - or /.\n"},"realm":{"type":"string","description":"Existing realm to associate with the tenant. Requires the tenant-service-admin role."},"adminEmail":{"type":"string","format":"email","description":"Email of the tenant administrator. Requires the tenant-service-admin role."}}},"examples":{"newRealm":{"summary":"Create a tenant with a new realm","value":{"name":"Test Tenant"}},"existingRealm":{"summary":"Associate an existing realm (tenant-service-admin only)","value":{"name":"Test Tenant","realm":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f","adminEmail":"test.admin@gov.ab.ca"}}}}}},"responses":{"200":{"description":"Tenant is created with an existing realm.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"}}}},"202":{"description":"Tenant is created and its realm is being provisioned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"},"example":{"id":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","name":"Test Tenant","realm":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f","status":"provisioning","adminEmail":"test.admin@gov.ab.ca"}}}},"400":{"description":"The name is missing, the name is invalid or already used, the administrator already has a tenant, or the realm is already associated with a tenant or set without adminEmail.\n","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/TenantV1ValidationError"},{"$ref":"#/components/schemas/TenantError"}]},"examples":{"missingName":{"summary":"Name is missing","value":{"success":false,"errors":[{"property":"name","constraints":{"isDefined":"name should not be null or undefined"}}]}},"nameUsed":{"summary":"Name is already used","value":{"errorMessage":"Value not valid for Tenant name: This tenant name has already been used. Please enter a different tenant name."}}}}}},"401":{"$ref":"#/components/responses/TenantUnauthorized"}}},"delete":{"deprecated":true,"tags":["Tenant service"],"description":"Deprecated; use DELETE /api/tenant/v2/tenants/{id}, after looking up the tenant ID with GET /api/tenant/v2/tenants?realm={realm}. Archives the tenant with the given realm and disables the realm; the tenant is not deleted. Requires the core realm tenant-service-admin role.\n","parameters":[{"in":"query","name":"realm","required":true,"description":"Realm of the tenant to archive.","schema":{"type":"string"},"example":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f"}],"responses":{"200":{"description":"The archived tenant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"}}}},"400":{"$ref":"#/components/responses/TenantV1BadRequest"},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"404":{"description":"No tenant has the realm.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantError"},"example":{"errorMessage":"tenant with ID 'realm: 2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f' could not be found."}}}}}}},"/api/tenant/v1/email":{"post":{"deprecated":true,"tags":["Tenant service"],"description":"Deprecated; use GET /api/tenant/v2/tenants?adminEmail={email}, which limits tenant users to their own tenant. Retrieves the tenant with the given administrator email. Available to any authenticated user of any tenant or the core realm; no role is required.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","description":"Email of the tenant administrator."}}},"example":{"email":"test.admin@gov.ab.ca"}}}},"responses":{"200":{"description":"Tenant information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"}}}},"400":{"$ref":"#/components/responses/TenantV1BadRequest"},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"404":{"$ref":"#/components/responses/TenantNotFound"}}}},"/api/tenant/v1/name":{"post":{"deprecated":true,"tags":["Tenant service"],"description":"Deprecated; use GET /api/tenant/v2/tenants?name={name}, which limits tenant users to their own tenant. Retrieves the tenant with the given name, ignoring case. Available to any authenticated user of any tenant or the core realm; no role is required.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Name of the tenant."}}},"example":{"name":"Test Tenant"}}}},"responses":{"200":{"description":"Tenant information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"}}}},"400":{"$ref":"#/components/responses/TenantV1BadRequest"},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"404":{"$ref":"#/components/responses/TenantNotFound"}}}},"/api/tenant/v1/realm/roles":{"get":{"deprecated":true,"tags":["Tenant service"],"description":"Deprecated; there is no v2 replacement. Returns the Keycloak roles of the realm that issued the current user's token, which is the user's own tenant realm. Requires the tenant-admin role.\n","responses":{"200":{"description":"Roles of the realm.","content":{"application/json":{"schema":{"type":"object","properties":{"roles":{"type":"array","items":{"$ref":"#/components/schemas/TenantRealmRole"}}}},"example":{"roles":[{"id":"0b9a6c2e-7d4f-4e1a-9c3b-5a8d2f6e1c7b","name":"offline_access","description":"${role_offline-access}","composite":false,"clientRole":false,"containerId":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f"}]}}}},"401":{"$ref":"#/components/responses/TenantUnauthorized"}}}},"/api/tenant/v1/realm/{realm}":{"get":{"deprecated":true,"tags":["Tenant service"],"description":"Deprecated; use GET /api/tenant/v2/tenants?realm={realm}, which limits tenant users to their own tenant. Retrieves a tenant by realm. Available to any authenticated user of any tenant or the core realm; no role is required.\n","parameters":[{"in":"path","name":"realm","required":true,"description":"Realm of the tenant.","schema":{"type":"string"},"example":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f"}],"responses":{"200":{"description":"Tenant information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantResult"}}}},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"404":{"$ref":"#/components/responses/TenantNotFound"}}}},"/api/tenant/v1/user/default-idp":{"get":{"tags":["Tenant service"],"description":"Internal endpoint used by the tenant admin webapp. Checks if the given user in the core realm is linked to the default ADSP identity provider. Requires the tenant-admin role and is rate limited.\n","parameters":[{"in":"query","name":"userId","required":true,"description":"ID of the user in the core realm.","schema":{"type":"string"},"example":"3d1c5e7a-9b2f-4c6d-8e0a-1f3b5d7c9e2a"}],"responses":{"200":{"description":"Whether the user is linked to the default identity provider in the core realm.","content":{"application/json":{"schema":{"type":"object","properties":{"hasDefaultIdpInCore":{"type":"boolean"}}},"example":{"hasDefaultIdpInCore":true}}}},"400":{"description":"userId is missing, or the identity providers of the user could not be read.","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/TenantV1ValidationError"},{"$ref":"#/components/schemas/TenantError"}]},"examples":{"missingUserId":{"summary":"userId is missing","value":{"success":false,"errors":[{"property":"userId","constraints":{"isDefined":"userId should not be null or undefined"}}]}},"checkFailed":{"summary":"Identity providers could not be read","value":{"errorMessage":"Failed to check the goa-ad IdP in core for user 3d1c5e7a-9b2f-4c6d-8e0a-1f3b5d7c9e2a due to Request failed with status code 404"}}}}}},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"429":{"$ref":"#/components/responses/TenantTooManyRequests"}}}},"/api/tenant/v1/user/id":{"get":{"tags":["Tenant service"],"description":"Internal endpoint used by the tenant admin webapp. Looks up the ID of the user with the given email in a realm, which defaults to the core realm. Requires the tenant-admin role and is rate limited.\n","parameters":[{"in":"query","name":"email","required":true,"description":"Email of the user.","schema":{"type":"string"},"example":"test.user@gov.ab.ca"},{"in":"query","name":"realm","required":false,"description":"Realm to look up the user in. Defaults to core.","schema":{"type":"string"},"example":"core"}],"responses":{"200":{"description":"ID of the user, or null if there is no user with the email.","content":{"application/json":{"schema":{"type":"object","properties":{"userIdInCore":{"type":"string","nullable":true}}},"example":{"userIdInCore":"3d1c5e7a-9b2f-4c6d-8e0a-1f3b5d7c9e2a"}}}},"400":{"$ref":"#/components/responses/TenantV1BadRequest"},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"429":{"$ref":"#/components/responses/TenantTooManyRequests"}}}},"/api/tenant/v1/user/idp":{"delete":{"tags":["Tenant service"],"description":"Internal endpoint used by the tenant admin webapp. Removes the link between a user and an identity provider in a realm. Requires the tenant-admin role and is rate limited.\n","parameters":[{"in":"query","name":"userId","required":true,"description":"ID of the user in the realm.","schema":{"type":"string"},"example":"3d1c5e7a-9b2f-4c6d-8e0a-1f3b5d7c9e2a"},{"in":"query","name":"realm","required":true,"description":"Realm of the user.","schema":{"type":"string"},"example":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f"},{"in":"query","name":"idpName","required":false,"description":"Alias of the identity provider. Defaults to goa-ad.","schema":{"type":"string"},"example":"goa-ad"}],"responses":{"200":{"description":"Identity provider link removed.","content":{"text/plain":{"schema":{"type":"string"},"example":"OK"}}},"400":{"description":"A required parameter is missing, or the identity provider link could not be removed.","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/TenantV1ValidationError"},{"$ref":"#/components/schemas/TenantError"}]},"examples":{"missingRealm":{"summary":"realm is missing","value":{"success":false,"errors":[{"property":"realm","constraints":{"isDefined":"realm should not be null or undefined"}}]}},"removeFailed":{"summary":"Link could not be removed","value":{"errorMessage":"Failed to delete the IdP goa-ad from user 3d1c5e7a-9b2f-4c6d-8e0a-1f3b5d7c9e2a due to Request failed with status code 404"}}}}}},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"429":{"$ref":"#/components/responses/TenantTooManyRequests"}}}},"/api/tenant/v1/{id}":{"get":{"deprecated":true,"tags":["Tenant service"],"description":"Deprecated; use GET /api/tenant/v2/tenants/{id}, which limits tenant users to their own tenant. Retrieves a tenant by ID. Available to any authenticated user of any tenant or the core realm, and not limited to the user's own tenant; no role is required.\n","parameters":[{"in":"path","name":"id","required":true,"description":"ID of the tenant, without the URN prefix.","schema":{"type":"string"},"example":"61f2e3a8c9b1d2e3f4a5b6c7"}],"responses":{"200":{"description":"Tenant information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantResult"}}}},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"404":{"$ref":"#/components/responses/TenantNotFound"}}}},"/api/tenant/v2/tenants":{"get":{"tags":["Tenant service"],"description":"Search for active tenants; tenants that are still provisioning or archived are not included. No role is required. Authenticated tenant users only find their own tenant; authenticated core users, including service accounts, can find any tenant.\n\nArchived tenants are only returned when status is archived, which requires the core realm tenant-service-admin role.\n\nAnonymous requests (without a valid bearer token) are allowed if they include the name or realm criteria, and the results do not include the administrator email.\n","security":[{},{"accessToken":[]}],"parameters":[{"in":"query","name":"name","schema":{"type":"string","minLength":1,"maxLength":50},"description":"Name of the tenant, matched as a whole and ignoring case.","example":"Test Tenant"},{"in":"query","name":"realm","schema":{"type":"string","minLength":1,"maxLength":50},"description":"Realm of the tenant.","example":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f"},{"in":"query","name":"adminEmail","schema":{"type":"string","format":"email"},"description":"Email of the tenant administrator. Anonymous requests must also include name or realm.","example":"test.admin@gov.ab.ca"},{"in":"query","name":"status","schema":{"type":"string","enum":["active","archived"]},"description":"Status of the tenants to find. Archived requires the core realm tenant-service-admin role."}],"responses":{"200":{"description":"Matching tenants.","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/Tenant"}},"page":{"type":"object","properties":{"size":{"type":"number"}}}}},"examples":{"authenticated":{"summary":"Authenticated request","value":{"results":[{"id":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","name":"Test Tenant","realm":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f","status":"active","adminEmail":"test.admin@gov.ab.ca"}],"page":{"size":1}}},"anonymous":{"summary":"Anonymous request, without the administrator email","value":{"results":[{"id":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","name":"Test Tenant","realm":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f","status":"active"}],"page":{"size":1}}}}}}},"400":{"$ref":"#/components/responses/TenantBadRequest"},"401":{"description":"Anonymous request does not include name or realm criteria, or the request for archived tenants is not from a core tenant-service-admin.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantError"},"example":{"errorMessage":"Request must include realm id or name criteria."}}}}}},"post":{"tags":["Tenant service"],"description":"Create a tenant. Requires the core realm beta-tester or tenant-service-admin role; tenant users are rejected even with those roles.\n\nBy default a new realm is created for the tenant, with the current user as the administrator; the response is sent with status 202 while the realm is provisioned, and a beta-tester who is already the administrator of a tenant is rejected. Users with the tenant-service-admin role can instead set realm to associate the tenant with an existing realm, in which case adminEmail is required and the response is sent with status 200. Only tenant-service-admin users can set realm or adminEmail.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[0-9a-zA-Z _]{1,50}$","description":"Name of the tenant. Must be unique, ignoring case."},"realm":{"type":"string","nullable":true,"minLength":1,"maxLength":50,"description":"Existing realm to associate with the tenant. Requires the tenant-service-admin role."},"adminEmail":{"type":"string","nullable":true,"format":"email","description":"Email of the tenant administrator. Requires the tenant-service-admin role."}}},"examples":{"newRealm":{"summary":"Create a tenant with a new realm","value":{"name":"Test Tenant"}},"existingRealm":{"summary":"Associate an existing realm (tenant-service-admin only)","value":{"name":"Test Tenant","realm":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f","adminEmail":"test.admin@gov.ab.ca"}}}}}},"responses":{"200":{"description":"Tenant created with an existing realm.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"}}}},"202":{"description":"Tenant created and its realm is being provisioned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"},"example":{"id":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","name":"Test Tenant","realm":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f","status":"provisioning","adminEmail":"test.admin@gov.ab.ca"}}}},"400":{"description":"Request is invalid, for example the name is invalid or already used, the administrator already has a tenant, or the realm is already associated with a tenant or set without adminEmail.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantError"},"examples":{"invalidName":{"summary":"Name failed validation","value":{"errorMessage":"Validation failed with error(s): name (body) - Invalid value"}},"nameUsed":{"summary":"Name is already used","value":{"errorMessage":"Value not valid for Tenant name: This tenant name has already been used. Please enter a different tenant name."}},"adminHasTenant":{"summary":"Administrator already has a tenant","value":{"errorMessage":"test.admin@gov.ab.ca is the tenant admin in our record. One user can create only one realm."}}}}}},"401":{"description":"Request does not include a valid bearer token, the user does not have the required role, or a user without the tenant-service-admin role set realm or adminEmail.\n","content":{"text/plain":{"schema":{"type":"string"},"example":"Unauthorized"},"application/json":{"schema":{"$ref":"#/components/schemas/TenantError"},"example":{"errorMessage":"tenant-service-admin role needed!"}}}}}}},"/api/tenant/v2/tenants/{id}":{"parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true,"description":"ID of the tenant, without the URN prefix.","example":"61f2e3a8c9b1d2e3f4a5b6c7"}],"get":{"tags":["Tenant service"],"description":"Retrieves a tenant. No role is required, but the request must be authenticated. Tenant users can only retrieve their own tenant, and get 403 for any other tenant ID; core users can retrieve any tenant.\n","responses":{"200":{"description":"Tenant information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"}}}},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"403":{"description":"Tenant user is not permitted to retrieve another tenant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantError"},"example":{"errorMessage":"User Test User (ID: 3d1c5e7a-9b2f-4c6d-8e0a-1f3b5d7c9e2a) not permitted to get tenant."}}}},"404":{"$ref":"#/components/responses/TenantNotFound"}}},"delete":{"tags":["Tenant service"],"description":"Archives a tenant: its realm is disabled, so users can no longer sign in, and the tenant and realm are retained. Archiving an archived tenant has no effect. Use the restore endpoint to recover an archived tenant. Requires the core realm tenant-service-admin role, which can archive any tenant; tenant users are rejected.\n\nSet purge to true to permanently delete an archived tenant and its realm. Purge also requires the core realm tenant-purge role and responds 400 if the tenant is not archived.\n","parameters":[{"in":"query","name":"purge","schema":{"type":"string","enum":["true","false"],"default":"false"},"description":"Permanently delete the archived tenant and its realm."}],"responses":{"200":{"description":"The archived tenant, or for purge the result of the deletion. success is false if the realm or the tenant record wasn't deleted.\n","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/Tenant"},{"$ref":"#/components/schemas/TenantDeleteResult"}]}}}},"400":{"description":"Request is invalid, for example the tenant is not archived for purge, or is still provisioning.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantError"},"example":{"errorMessage":"Tenant must be archived before it can be purged."}}}},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"403":{"description":"Purge was requested without the core realm tenant-purge role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantError"},"example":{"errorMessage":"User Test User (ID: 3d1c5e7a-9b2f-4c6d-8e0a-1f3b5d7c9e2a) not permitted to purge tenant."}}}},"404":{"$ref":"#/components/responses/TenantNotFound"}}}},"/api/tenant/v2/tenants/{id}/name":{"parameters":[{"in":"path","name":"id","required":true,"description":"ID of the tenant, without the URN prefix.","schema":{"type":"string"},"example":"61f2e3a8c9b1d2e3f4a5b6c7"}],"patch":{"tags":["Tenant service"],"description":"Update the tenant name. Requires the core realm tenant-service-admin role, which can rename any tenant; tenant users, including tenant administrators, are rejected. Rate limited.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[0-9a-zA-Z _]{1,50}$"}}},"example":{"name":"Renamed Tenant"}}}},"responses":{"200":{"description":"Updated tenant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"},"example":{"id":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","name":"Renamed Tenant","realm":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f","status":"active","adminEmail":"test.admin@gov.ab.ca"}}}},"400":{"$ref":"#/components/responses/TenantBadRequest"},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"404":{"$ref":"#/components/responses/TenantNotFound"},"429":{"$ref":"#/components/responses/TenantTooManyRequests"}}}},"/api/tenant/v2/tenants/{id}/restore":{"parameters":[{"in":"path","name":"id","required":true,"description":"ID of the tenant, without the URN prefix.","schema":{"type":"string"},"example":"61f2e3a8c9b1d2e3f4a5b6c7"}],"post":{"tags":["Tenant service"],"description":"Restores an archived tenant: its realm is enabled again and its status is active. Requires the core realm tenant-service-admin role; tenant users are rejected.\n","responses":{"200":{"description":"The restored tenant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"}}}},"400":{"description":"The tenant is not archived.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantError"},"example":{"errorMessage":"Only an archived tenant can be restored."}}}},"401":{"$ref":"#/components/responses/TenantUnauthorized"},"404":{"$ref":"#/components/responses/TenantNotFound"}}}}},"components":{"securitySchemes":{"accessToken":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"responses":{"TenantBadRequest":{"description":"Request is invalid, for example a parameter failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantError"},"example":{"errorMessage":"Validation failed with error(s): name (body) - Invalid value"}}}},"TenantNotFound":{"description":"Tenant not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantError"},"example":{"errorMessage":"Tenant with ID '61f2e3a8c9b1d2e3f4a5b6c7' could not be found."}}}},"TenantTooManyRequests":{"description":"Too many requests; limited to 200 requests per 5 minutes.","content":{"text/plain":{"schema":{"type":"string"},"example":"Too many requests, please try again later."}}},"TenantUnauthorized":{"description":"Request does not include a valid bearer token, or the user does not have the role required for the operation. Role checks in this API respond with 401 rather than 403.\n","content":{"text/plain":{"schema":{"type":"string"},"example":"Unauthorized"}}},"TenantV1BadRequest":{"description":"A required parameter is missing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantV1ValidationError"}}}}},"schemas":{"Tenant":{"type":"object","properties":{"id":{"type":"string","readOnly":true,"description":"URN of the tenant.","example":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7"},"name":{"type":"string","example":"Test Tenant"},"realm":{"type":"string","description":"Keycloak realm of the tenant, which is the issuer of the tenant's access tokens.","example":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f"},"status":{"type":"string","readOnly":true,"enum":["provisioning","active","archived"],"description":"Status of the tenant; a new tenant is provisioning until its realm has been created. An archived tenant has its realm disabled.\n","example":"active"},"adminEmail":{"type":"string","description":"Email of the tenant administrator. Not included for anonymous requests.","example":"test.admin@gov.ab.ca"},"deletedAt":{"type":"string","format":"date-time","readOnly":true,"description":"Time the tenant was archived. Only included for an archived tenant."}},"example":{"id":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","name":"Test Tenant","realm":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f","status":"active","adminEmail":"test.admin@gov.ab.ca"}},"TenantDeleteResult":{"type":"object","properties":{"deletedRealm":{"type":"boolean"},"deletedTenant":{"type":"boolean"},"success":{"type":"boolean"}},"example":{"deletedRealm":true,"deletedTenant":true,"success":true}},"TenantError":{"type":"object","properties":{"errorMessage":{"type":"string"}},"example":{"errorMessage":"Tenant with ID '61f2e3a8c9b1d2e3f4a5b6c7' could not be found."}},"TenantRealmRole":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"composite":{"type":"boolean"},"clientRole":{"type":"boolean"},"containerId":{"type":"string"}},"example":{"id":"0b9a6c2e-7d4f-4e1a-9c3b-5a8d2f6e1c7b","name":"offline_access","description":"${role_offline-access}","composite":false,"clientRole":false,"containerId":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f"}},"TenantResult":{"type":"object","properties":{"success":{"type":"boolean"},"tenant":{"$ref":"#/components/schemas/Tenant"}},"example":{"success":true,"tenant":{"id":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","name":"Test Tenant","realm":"2f6c8f1e-3b7a-4d5c-9e8f-1a2b3c4d5e6f","status":"active","adminEmail":"test.admin@gov.ab.ca"}}},"TenantV1ValidationError":{"type":"object","properties":{"success":{"type":"boolean"},"errors":{"type":"array","items":{"type":"object","properties":{"property":{"type":"string"},"constraints":{"type":"object","additionalProperties":{"type":"string"}}}}}},"example":{"success":false,"errors":[{"property":"email","constraints":{"isDefined":"email should not be null or undefined"}}]}}}},"security":[{"accessToken":[]}],"tags":[{"name":"Tenant service","description":"Tenant API to store and read tenant information."}]}
@@ -5,104 +5,121 @@ parent: Services
5
5
  ---
6
6
 
7
7
  # Tenant service
8
+
8
9
  Tenant service provides the infrastructure for multi-tenancy in ADSP. It provides the APIs that allow for operations like creation of new tenants and lookup of tenants.
9
10
 
10
11
  Tenant users and applications do not need to interact with tenant service directly.
11
12
 
12
13
  ## Client roles
14
+
13
15
  client `urn:ads:platform:tenant-service`
14
16
 
15
- | name | description |
16
- |:-|:-|
17
- | tenant-admin | Administrator role for tenant service. This role grants a user access to tenant administration. It is also a composite role that includes roles for configuration of other platform services. |
18
- | platform-service | Service role for backend services that read tenants. |
17
+ | name | description |
18
+ | :--------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
19
+ | tenant-admin | Administrator role for tenant service. This role grants a user access to tenant administration. It is also a composite role that includes roles for configuration of other platform services. |
20
+ | platform-service | Service role for backend services that read tenants. |
19
21
 
20
22
  Tenant service also checks two core realm roles. They are realm roles of the `core` realm, not client roles, and are not registered by tenant service:
21
23
 
22
- | name | description |
23
- |:-|:-|
24
- | tenant-service-admin | Platform administrator role. Allows creating tenants for any administrator or with an existing realm, renaming tenants, and deleting tenants. |
25
- | beta-tester | Allows a core user to create a tenant with a new realm, with themselves as the administrator. |
24
+ | name | description |
25
+ | :------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
26
+ | tenant-service-admin | Platform administrator role. Allows creating tenants for any administrator or with an existing realm, renaming tenants, and archiving, restoring, and listing archived tenants. |
27
+ | tenant-purge | Allows a `tenant-service-admin` to permanently delete (purge) an archived tenant. |
28
+ | beta-tester | Allows a core user to create a tenant with a new realm, with themselves as the administrator. |
26
29
 
27
30
  No API operation checks the `platform-service` role: any authenticated core user or service account can read tenants. Services usually read tenants through the `tenantService` of the [Node.js SDK](../platform/platform-node-sdk.md) instead of calling the API.
28
31
 
29
32
  ## Tenancy
33
+
30
34
  Tenant service manages the tenants themselves, so it doesn't use the `tenantId` query parameter of other services. Which tenants a request can see depends on who makes it:
31
35
 
32
36
  - **Tenant users and service accounts** (with a token from a tenant realm) only find and retrieve their own tenant. `GET /api/tenant/v2/tenants` returns only their tenant, and `GET /api/tenant/v2/tenants/{id}` responds `403` for any other tenant ID.
33
- - **Core users and service accounts** (with a token from the `core` realm) can find and retrieve any tenant. Creating, renaming, and deleting tenants require a core user with the roles above; tenant users are rejected even if they hold a role with the same name.
37
+ - **Core users and service accounts** (with a token from the `core` realm) can find and retrieve any tenant. Creating, renaming, archiving, and restoring tenants require a core user with the roles above; tenant users are rejected even if they hold a role with the same name.
34
38
  - **Anonymous requests** can search `GET /api/tenant/v2/tenants` by `name` or `realm`. Results don't include the administrator email. This is how applications resolve a tenant name to its realm before a user signs in.
35
39
  - **Deprecated v1 lookups** (`GET /api/tenant/v1/{id}`, `GET /api/tenant/v1/realm/{realm}`, `POST /api/tenant/v1/email`, `POST /api/tenant/v1/name`) are available to any authenticated user and aren't limited to the user's own tenant. Use the v2 endpoints instead.
36
40
 
37
41
  Search results only include `active` tenants. A tenant that is still `provisioning` can be retrieved by ID, but isn't found by search.
38
42
 
39
43
  ## API overview
44
+
40
45
  All endpoints are under `https://tenant-service.adsp.alberta.ca`. See the [API documentation](https://api.adsp.alberta.ca) for request and response schemas. Role checks in this API respond `401`, not `403`, when the user lacks the role.
41
46
 
42
- | Endpoint | Purpose | Required role |
43
- |:-|:-|:-|
44
- | `GET /api/tenant/v2/tenants` | Search for tenants by name, realm, or administrator email. | None; anonymous with `name` or `realm` |
45
- | `POST /api/tenant/v2/tenants` | Create a tenant. | core `beta-tester` or `tenant-service-admin` |
46
- | `GET /api/tenant/v2/tenants/{id}` | Retrieve a tenant. | Any authenticated user; tenant users only their own tenant |
47
- | `PATCH /api/tenant/v2/tenants/{id}/name` | Rename a tenant. Rate limited. | core `tenant-service-admin` |
48
- | `DELETE /api/tenant/v2/tenants/{id}` | Delete a tenant and its realm. | core `tenant-service-admin` |
47
+ | Endpoint | Purpose | Required role |
48
+ | :----------------------------------------- | :--------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------- |
49
+ | `GET /api/tenant/v2/tenants` | Search for tenants by name, realm, or administrator email. `status=archived` finds archived tenants. | None; anonymous with `name` or `realm`. Archived: core `tenant-service-admin` |
50
+ | `POST /api/tenant/v2/tenants` | Create a tenant. | core `beta-tester` or `tenant-service-admin` |
51
+ | `GET /api/tenant/v2/tenants/{id}` | Retrieve a tenant. | Any authenticated user; tenant users only their own tenant |
52
+ | `PATCH /api/tenant/v2/tenants/{id}/name` | Rename a tenant. Rate limited. | core `tenant-service-admin` |
53
+ | `DELETE /api/tenant/v2/tenants/{id}` | Archive a tenant and disable its realm. With `?purge=true`, permanently delete an archived tenant and its realm. | core `tenant-service-admin`; purge also requires core `tenant-purge` |
54
+ | `POST /api/tenant/v2/tenants/{id}/restore` | Restore an archived tenant and enable its realm. | core `tenant-service-admin` |
49
55
 
50
56
  The following `/api/tenant/v1` endpoints are deprecated. They are documented in the API documentation so that existing callers can find their replacements:
51
57
 
52
- | Deprecated endpoint | Required role | Replacement |
53
- |:-|:-|:-|
54
- | `POST /api/tenant/v1` | core `beta-tester` or `tenant-service-admin` | `POST /api/tenant/v2/tenants` |
55
- | `GET /api/tenant/v1/{id}` | Any authenticated user | `GET /api/tenant/v2/tenants/{id}` |
56
- | `DELETE /api/tenant/v1?realm={realm}` | core `tenant-service-admin` | `DELETE /api/tenant/v2/tenants/{id}` |
57
- | `GET /api/tenant/v1/realm/{realm}` | Any authenticated user | `GET /api/tenant/v2/tenants?realm={realm}` |
58
- | `POST /api/tenant/v1/email` | Any authenticated user | `GET /api/tenant/v2/tenants?adminEmail={email}` |
59
- | `POST /api/tenant/v1/name` | Any authenticated user | `GET /api/tenant/v2/tenants?name={name}` |
60
- | `GET /api/tenant/v1/realm/roles` | `tenant-admin` | None |
58
+ | Deprecated endpoint | Required role | Replacement |
59
+ | :------------------------------------ | :------------------------------------------- | :---------------------------------------------- |
60
+ | `POST /api/tenant/v1` | core `beta-tester` or `tenant-service-admin` | `POST /api/tenant/v2/tenants` |
61
+ | `GET /api/tenant/v1/{id}` | Any authenticated user | `GET /api/tenant/v2/tenants/{id}` |
62
+ | `DELETE /api/tenant/v1?realm={realm}` | core `tenant-service-admin` | `DELETE /api/tenant/v2/tenants/{id}` |
63
+ | `GET /api/tenant/v1/realm/{realm}` | Any authenticated user | `GET /api/tenant/v2/tenants?realm={realm}` |
64
+ | `POST /api/tenant/v1/email` | Any authenticated user | `GET /api/tenant/v2/tenants?adminEmail={email}` |
65
+ | `POST /api/tenant/v1/name` | Any authenticated user | `GET /api/tenant/v2/tenants?name={name}` |
66
+ | `GET /api/tenant/v1/realm/roles` | `tenant-admin` | None |
61
67
 
62
68
  These `/api/tenant/v1` endpoints are not deprecated. They are internal endpoints used by the tenant admin app, and are rate limited:
63
69
 
64
- | Endpoint | Purpose | Required role |
65
- |:-|:-|:-|
66
- | `GET /api/tenant/v1/user/id` | Look up the ID of a user by email in a realm. | `tenant-admin` |
70
+ | Endpoint | Purpose | Required role |
71
+ | :------------------------------------ | :--------------------------------------------------------------------- | :------------- |
72
+ | `GET /api/tenant/v1/user/id` | Look up the ID of a user by email in a realm. | `tenant-admin` |
67
73
  | `GET /api/tenant/v1/user/default-idp` | Check if a core realm user is linked to the default identity provider. | `tenant-admin` |
68
- | `DELETE /api/tenant/v1/user/idp` | Remove the link between a user and an identity provider. | `tenant-admin` |
74
+ | `DELETE /api/tenant/v1/user/idp` | Remove the link between a user and an identity provider. | `tenant-admin` |
69
75
 
70
76
  ## Concepts
77
+
71
78
  ### Tenant
79
+
72
80
  A tenant represents a team or program area using ADSP. Its ID is a URN, for example `urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7`; endpoints that take `{id}` use only the last segment. Other platform services store this ID on their records to isolate tenant data. Each tenant has a unique name (compared ignoring case), an administrator email, and a status:
73
81
 
74
82
  - `provisioning`: the tenant was created and its realm is still being set up. `POST /api/tenant/v2/tenants` responds `202` with this status. If provisioning fails, the tenant is removed.
75
83
  - `active`: the tenant and its realm are ready.
84
+ - `archived`: the tenant was deleted with `DELETE /api/tenant/v2/tenants/{id}`. Its realm is disabled and it is excluded from searches (unless `status=archived` is requested). The tenant is retained until an archived tenant is purged with `DELETE /api/tenant/v2/tenants/{id}?purge=true`, or it can be restored.
76
85
 
77
86
  A user can be the administrator of only one tenant, unless a `tenant-service-admin` creates the tenant.
78
87
 
79
88
  ### Realm
80
- Each tenant has its own Keycloak realm, which signs the access tokens of the tenant's users and service accounts. Platform services read the token issuer to work out which tenant a request is for. A new realm is created when a tenant is created, with the administrator given the `tenant-admin` role and clients for the platform apps and services. A `tenant-service-admin` can instead associate a tenant with an existing realm. Deleting a tenant also deletes its realm.
89
+
90
+ Each tenant has its own Keycloak realm, which signs the access tokens of the tenant's users and service accounts. Platform services read the token issuer to work out which tenant a request is for. A new realm is created when a tenant is created, with the administrator given the `tenant-admin` role and clients for the platform apps and services. A `tenant-service-admin` can instead associate a tenant with an existing realm. Archiving a tenant disables its realm, so users can no longer sign in, but doesn't delete it. A realm is only deleted when its tenant is purged.
81
91
 
82
92
  ## Events
83
- Tenant service sends the following domain events under the `tenant-service` namespace. It doesn't consume events.
84
93
 
85
- | Event | Description |
86
- |:-|:-|
87
- | `tenant-created` | A tenant was created, either with an existing realm or once its new realm was provisioned. The payload includes the `tenant` and `createdBy`. |
88
- | `tenant-deleted` | A tenant was deleted. The payload includes the `tenant` and `deletedBy`. |
94
+ Tenant service sends the following domain events under the `tenant-service` namespace. It doesn't consume events.
89
95
 
96
+ | Event | Description |
97
+ | :---------------- | :-------------------------------------------------------------------------------------------------------------------------------------------- |
98
+ | `tenant-created` | A tenant was created, either with an existing realm or once its new realm was provisioned. The payload includes the `tenant` and `createdBy`. |
99
+ | `tenant-deleted` | A tenant was permanently deleted (purged). The payload includes the `tenant` and `deletedBy`. |
100
+ | `tenant-archived` | A tenant was archived. The payload includes the `tenant` and `archivedBy`. |
101
+ | `tenant-restored` | An archived tenant was restored. The payload includes the `tenant` and `restoredBy`. |
90
102
 
91
103
  ## Audit actions
104
+
92
105
  Tenant service records audit events in the `tenant-service` namespace of the [audit service](audit-service.md). Records are written to the affected tenant, with the tenant as the resource (`{ type: 'tenant', id: <tenant URN> }`) and the tenant name and realm in the metadata.
93
106
 
94
- | action | category | severity | retention class | recorded when |
95
- |:-|:-|:-|:-|:-|
96
- | tenant.created | administrative | info | compliance | A tenant is created with an existing realm, or a new realm is provisioned for it. A failed provisioning is recorded with `failure` status. |
97
- | tenant.deleted | administrative | critical | compliance | A tenant is deleted. |
98
- | tenant.updated | administrative | info | compliance | A tenant is renamed. The change set captures the name before and after. |
107
+ | action | category | severity | retention class | recorded when |
108
+ | :-------------- | :------------- | :------- | :-------------- | :----------------------------------------------------------------------------------------------------------------------------------------- |
109
+ | tenant.created | administrative | info | compliance | A tenant is created with an existing realm, or a new realm is provisioned for it. A failed provisioning is recorded with `failure` status. |
110
+ | tenant.deleted | administrative | critical | compliance | A tenant is permanently deleted (purged). |
111
+ | tenant.archived | administrative | warning | compliance | A tenant is archived and its realm disabled. |
112
+ | tenant.restored | administrative | warning | compliance | An archived tenant is restored and its realm enabled. |
113
+ | tenant.updated | administrative | info | compliance | A tenant is renamed. The change set captures the name before and after. |
99
114
 
100
115
  Because the audit service resolves the tenant of each event, `tenant.deleted` is recorded before the realm and tenant are removed. If the removal does not fully succeed, a further `tenant.deleted` event is recorded with `failure` or `error` status; it cannot be stored if the tenant record itself was already removed.
101
116
 
102
117
  Audit failures are logged by the SDK and do not roll back the tenant operation. The tenant service account requires the `audit-writer` role of `urn:ads:platform:audit-service`. Set `AUDIT_ENABLED=false` on tenant service to turn recording off; see [turn audit recording off](audit-service.md#turn-audit-recording-off).
103
118
 
104
119
  ## Code examples
120
+
105
121
  ### Look up a tenant by name
122
+
106
123
  Anonymous requests can look up a tenant by name, for example to find the realm for signing in. Include a bearer token to also get the administrator email.
107
124
 
108
125
  ```typescript
@@ -115,6 +132,7 @@ const [tenant] = results;
115
132
  ```
116
133
 
117
134
  ### Retrieve a tenant by ID
135
+
118
136
  Tenant users can retrieve their own tenant. Core users can retrieve any tenant.
119
137
 
120
138
  ```typescript
@@ -127,6 +145,7 @@ const { name, realm, adminEmail } = await response.json();
127
145
  ```
128
146
 
129
147
  ### Create a tenant
148
+
130
149
  Core users with the `beta-tester` role create a tenant with a new realm and become its administrator. The response is `202` with `status: 'provisioning'`; search by name until the tenant is found, which means it is `active`.
131
150
 
132
151
  ```typescript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/adsp-sdk-mcp-server",
3
- "version": "1.33.0",
3
+ "version": "1.34.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Government of Alberta - MCP server for ADSP documentation and Node SDK reference lookup.",
6
6
  "repository": "https://github.com/GovAlta/adsp-monorepo",
package/provenance.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "kind": "release",
3
- "builtAt": "2026-11-16T22:20:45.235Z",
4
- "sourceCommit": "c385f1d35c8f0494ee0f22413b506f625fd4438d",
5
- "latestRelease": "1.32.2",
6
- "docsCommit": "8872dfd4f6252eadfd83ebb028671b05dbd62eb2",
3
+ "builtAt": "2026-11-17T15:07:15.268Z",
4
+ "sourceCommit": "48ad19ceefced766bcf7ad20002c6b2dfd5b7735",
5
+ "latestRelease": "1.33.0",
6
+ "docsCommit": "48ad19ceefced766bcf7ad20002c6b2dfd5b7735",
7
7
  "sdk": {
8
8
  "version": "2.36.1",
9
9
  "commit": "dd58a2b854c4406b42c0604dba3fa4b941038d6c",