@abgov/adsp-sdk-mcp-server 1.25.0 → 1.27.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.
Files changed (61) hide show
  1. package/README.md +72 -4
  2. package/assets/api-specs/agent-service.json +1 -0
  3. package/assets/api-specs/audit-service.json +1 -0
  4. package/assets/api-specs/cache-service.json +1 -0
  5. package/assets/api-specs/calendar-service.json +1 -0
  6. package/assets/api-specs/comment-service.json +1 -0
  7. package/assets/api-specs/configuration-service.json +1 -0
  8. package/assets/api-specs/directory-service.json +1 -0
  9. package/assets/api-specs/event-service.json +1 -0
  10. package/assets/api-specs/export-service.json +1 -0
  11. package/assets/api-specs/feedback-service.json +1 -0
  12. package/assets/api-specs/file-service.json +1 -0
  13. package/assets/api-specs/form-service.json +1 -0
  14. package/assets/api-specs/index.json +186 -0
  15. package/assets/api-specs/notification-service.json +1 -0
  16. package/assets/api-specs/pdf-service.json +1 -0
  17. package/assets/api-specs/pii-service.json +1 -0
  18. package/assets/api-specs/project-planner-service.json +1 -0
  19. package/assets/api-specs/push-service.json +1 -0
  20. package/assets/api-specs/status-service.json +1 -0
  21. package/assets/api-specs/task-service.json +1 -0
  22. package/assets/api-specs/tenant-management-api.json +1 -0
  23. package/assets/api-specs/token-handler.json +1 -0
  24. package/assets/api-specs/value-service.json +1 -0
  25. package/assets/api-specs/verify-service.json +1 -0
  26. package/assets/docs/services/agent-service.md +31 -0
  27. package/assets/docs/services/notification-service.md +23 -0
  28. package/assets/docs/services/value-service.md +16 -0
  29. package/package.json +1 -1
  30. package/provenance.json +12 -0
  31. package/src/api-specs/apiSpecsRepository.d.ts +44 -0
  32. package/src/api-specs/apiSpecsRepository.js +113 -0
  33. package/src/api-specs/apiSpecsRepository.js.map +1 -0
  34. package/src/config.d.ts +2 -0
  35. package/src/config.js +7 -0
  36. package/src/config.js.map +1 -1
  37. package/src/hosted.d.ts +20 -0
  38. package/src/hosted.js +30 -0
  39. package/src/hosted.js.map +1 -0
  40. package/src/http.d.ts +4 -1
  41. package/src/http.js +22 -1
  42. package/src/http.js.map +1 -1
  43. package/src/index.d.ts +2 -0
  44. package/src/index.js +3 -1
  45. package/src/index.js.map +1 -1
  46. package/src/lifecycle.d.ts +18 -0
  47. package/src/lifecycle.js +52 -0
  48. package/src/lifecycle.js.map +1 -0
  49. package/src/main.js +2 -22
  50. package/src/main.js.map +1 -1
  51. package/src/metrics.js +7 -1
  52. package/src/metrics.js.map +1 -1
  53. package/src/server.d.ts +2 -0
  54. package/src/server.js +17 -4
  55. package/src/server.js.map +1 -1
  56. package/src/tools/registerApiTools.d.ts +7 -0
  57. package/src/tools/registerApiTools.js +110 -0
  58. package/src/tools/registerApiTools.js.map +1 -0
  59. package/src/tools/registerServerInfoTool.d.ts +20 -0
  60. package/src/tools/registerServerInfoTool.js +48 -0
  61. package/src/tools/registerServerInfoTool.js.map +1 -0
@@ -0,0 +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."}]}
@@ -0,0 +1 @@
1
+ {"openapi":"3.0.0","info":{"title":"Token handler","version":"0.0.0","description":"Token handler pattern as a service. This service provides authentication and a proxy to other services. Most endpoints are not RESTful, and OpenAPI docs are for reference only."},"paths":{"/token-handler/v1/clients":{"get":{"tags":["Client"],"description":"Retrieves the clients available to the tenant, including the clients of the core configuration that are available to all tenants, with their registration status.\n\nRequires the token-handler-admin role. The caller acts on the tenant of their bearer token, which must be from a tenant realm.","parameters":[{"name":"core","description":"Set to true to only retrieve the clients of the core configuration.","in":"query","required":false,"schema":{"type":"boolean"},"example":true}],"responses":{"200":{"description":"Request completed successfully.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ClientSummary"}}}}},"400":{"$ref":"#/components/responses/TokenHandlerBadRequest"},"401":{"$ref":"#/components/responses/TokenHandlerUnauthorized"},"403":{"$ref":"#/components/responses/TokenHandlerForbidden"}}}},"/token-handler/v1/clients/{clientId}":{"parameters":[{"$ref":"#/components/parameters/TokenHandlerClientId"}],"get":{"tags":["Client"],"description":"Retrieves an authentication client and its registration.\n\nRequires the token-handler-admin role. The caller acts on the tenant of their bearer token, which must be from a tenant realm. The client is looked up before the role is checked, so an unknown client responds 404 for any caller.","responses":{"200":{"description":"Request completed successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthenticationClient"}}}},"400":{"$ref":"#/components/responses/TokenHandlerBadRequest"},"401":{"$ref":"#/components/responses/TokenHandlerUnauthorized"},"403":{"$ref":"#/components/responses/TokenHandlerForbidden"},"404":{"$ref":"#/components/responses/TokenHandlerClientNotFound"}}},"post":{"tags":["Client"],"description":"Registers an authentication client in the tenant's realm in access service. If provided, the authCallbackUrl is registered with access service as a valid redirect URI, together with the redirectUris of the client configuration, and is not stored in the token handler configuration. Otherwise the client is registered with only the configured redirectUris, and more can be added directly in access service. Registering a client that is already registered replaces its registration; the previously registered client in access service is deleted, including any redirect URIs configured on it. Sends the client-registered event.\n\nRequires the token-handler-admin role. The caller acts on the tenant of their bearer token, which must be from a tenant realm.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["registrationToken"],"properties":{"registrationToken":{"type":"string","minLength":1,"maxLength":8192,"description":"Initial access token for client registration, from the tenant realm in access service."},"authCallbackUrl":{"type":"string","format":"uri","maxLength":2048,"description":"Optional http or https callback URL to register with access service as a valid redirect URI. Add redirect URIs for additional environments directly in access service after registration."}}},"example":{"registrationToken":"eyJhbGciOiJIUzI1NiJ9.eyJ0eXAiOiJJbml0aWFsQWNjZXNzVG9rZW4ifQ.c2lnbmF0dXJl","authCallbackUrl":"https://myapp.example.ca/token-handler/clients/my-client/callback"}}}},"responses":{"200":{"description":"Request completed successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"registered":{"type":"boolean"}}},"example":{"registered":true}}}},"400":{"description":"Request is invalid, for example a parameter failed validation, or access service rejected the registration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenHandlerError"},"example":{"errorMessage":"Registration request failed. Verify registration token."}}}},"401":{"$ref":"#/components/responses/TokenHandlerUnauthorized"},"403":{"$ref":"#/components/responses/TokenHandlerForbidden"},"404":{"$ref":"#/components/responses/TokenHandlerClientNotFound"}}},"put":{"tags":["Client"],"description":"Updates the registered redirect URIs for the authentication client in access service, replacing the current ones. Uses the stored management token from the registration; no external token is required. Sends the client-registered event.\n\nRequires the token-handler-admin role. The caller acts on the tenant of their bearer token, which must be from a tenant realm.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["redirectUris"],"properties":{"redirectUris":{"type":"array","minItems":1,"items":{"type":"string","format":"uri","maxLength":2048},"description":"List of http or https redirect URIs to register with access service."}}},"example":{"redirectUris":["https://myapp.example.ca/token-handler/clients/my-client/callback","http://localhost:4200/token-handler/clients/my-client/callback"]}}}},"responses":{"200":{"description":"Request completed successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"updated":{"type":"boolean"}}},"example":{"updated":true}}}},"400":{"description":"Request is invalid, for example a parameter failed validation, the client is not registered, or access service rejected the stored registration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenHandlerError"},"example":{"errorMessage":"Client not registered."}}}},"401":{"$ref":"#/components/responses/TokenHandlerUnauthorized"},"403":{"$ref":"#/components/responses/TokenHandlerForbidden"},"404":{"$ref":"#/components/responses/TokenHandlerClientNotFound"}}}},"/token-handler/v1/clients/{clientId}/auth":{"parameters":[{"$ref":"#/components/parameters/TokenHandlerClientId"},{"name":"tenant","description":"Name or URN of the tenant. The tenant is kept in the session for the callback. Required unless the X-ADSP-TENANT header is provided, which is used instead if both are provided.","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100},"example":"my-tenant"},{"name":"callbackUrl","description":"http or https URL of the callback of the application, which is a valid redirect URI of the client in access service. Required unless the client has the deprecated authCallbackUrl configuration.","in":"query","required":false,"schema":{"type":"string","format":"uri","maxLength":2048},"example":"https://myapp.example.ca/token-handler/clients/my-client/callback"},{"$ref":"#/components/parameters/TokenHandlerTenantHeader"}],"get":{"tags":["Client"],"description":"Initiates sign in via the client by redirecting the browser to the access service authorization endpoint of the tenant's realm. This is a browser navigation, not an API call.\n\nAnonymous: no bearer token or role is required. The tenant comes from the X-ADSP-TENANT header or the tenant query parameter, and the client must be registered for that tenant.","security":[],"responses":{"302":{"description":"Redirect to the access service authorization endpoint to sign in.","headers":{"Location":{"description":"URL of the access service authorization endpoint.","schema":{"type":"string"},"example":"https://access.adsp.alberta.ca/auth/realms/my-realm/protocol/openid-connect/auth?response_type=code&client_id=3f2a9c1e-7b4d-4e8a-9c2f-1a2b3c4d5e6f&redirect_uri=https%3A%2F%2Fmyapp.example.ca%2Ftoken-handler%2Fclients%2Fmy-client%2Fcallback&scope=openid&state=Zm9vYmFy"}}},"400":{"description":"Request is invalid, for example a parameter failed validation, no tenant is provided, no callbackUrl is provided for a client without authCallbackUrl, or the client is not registered for the tenant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenHandlerError"},"example":{"errorMessage":"Tenant identity is required in the x-adsp-tenant header or the tenant query parameter."}}}},"404":{"description":"The tenant or the client is not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenHandlerError"},"example":{"errorMessage":"tenant with ID 'my-tenant' could not be found."}}}},"429":{"$ref":"#/components/responses/TokenHandlerTooManyRequests"}}}},"/token-handler/v1/clients/{clientId}/callback":{"parameters":[{"$ref":"#/components/parameters/TokenHandlerClientId"},{"name":"code","description":"Authorization code from access service.","in":"query","required":false,"schema":{"type":"string"},"example":"1b2c3d4e-5f60-7182-93a4-b5c6d7e8f901"},{"name":"state","description":"State from access service, which must match the state of the sign in started on the same session.","in":"query","required":false,"schema":{"type":"string"},"example":"Zm9vYmFy"},{"name":"X-ADSP-TENANT","description":"Name or URN of the tenant. If it is not provided, the tenant that was provided to sign in on the same session is used.","in":"header","required":false,"schema":{"type":"string","maxLength":100},"example":"my-tenant"}],"get":{"tags":["Client"],"description":"Completes sign in via the client. Access service redirects the browser here with the authorization code. On success the token handler starts a session (the adsp_tk_session cookie), sets the XSRF-TOKEN cookie, and redirects to the successRedirectUrl of the client. Otherwise, including when sign in was not started on the same session, the client is not registered, or access service responds with an error, it redirects to the failureRedirectUrl.\n\nAnonymous: no bearer token or role is required. The request must be on the session in which sign in was started.","security":[],"responses":{"302":{"description":"Redirect to the successRedirectUrl or the failureRedirectUrl of the client.","headers":{"Location":{"description":"The successRedirectUrl or the failureRedirectUrl of the client. Both default to the root of the site.","schema":{"type":"string"},"example":"/"},"Set-Cookie":{"description":"The adsp_tk_session session cookie and the XSRF-TOKEN cookie, set when sign in succeeds.","schema":{"type":"string"},"example":"XSRF-TOKEN=6f1c2d3e4a5b69788796a5b4c3d2e1f0; Path=/; Secure; SameSite=Strict"}}},"400":{"description":"Request is invalid: the client ID failed validation, or no tenant is provided in the X-ADSP-TENANT header or from signing in on the same session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenHandlerError"},"example":{"errorMessage":"Tenant identity is required in the x-adsp-tenant header, or from signing in on the same session."}}}},"404":{"description":"The tenant or the client is not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenHandlerError"},"example":{"errorMessage":"client with ID 'my-client' could not be found."}}}},"429":{"$ref":"#/components/responses/TokenHandlerTooManyRequests"}}}},"/token-handler/v1/clients/{clientId}/logout":{"parameters":[{"$ref":"#/components/parameters/TokenHandlerClientId"}],"get":{"tags":["Client"],"description":"Logs the user out by ending their session in the token handler, and redirects to the root of the site. If the client is configured with keycloakLogout, redirects to the access service end session endpoint instead, which ends the user's session there and returns to the root of the site. Requests that another site caused the browser to make (Sec-Fetch-Site cross-site) only end the token handler session.\n\nRequires a signed in user on the session cookie, authenticated by the same client; no role is required.","security":[{"sessionCookie":[]}],"responses":{"302":{"description":"User logged out and redirected.","headers":{"Location":{"description":"The root of the site, or the access service end session endpoint if the client has keycloakLogout.","schema":{"type":"string"},"example":"/"}}},"400":{"description":"No user is signed in, the user was not authenticated by the client, or the client ID failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenHandlerError"},"example":{"errorMessage":"No user to logout."}}}},"429":{"$ref":"#/components/responses/TokenHandlerTooManyRequests"}}}},"/token-handler/v1/sessions":{"get":{"tags":["Session"],"description":"Retrieves the session of the signed in user, as an array with one item. Frontend applications use it to find out whether the user is signed in, and who they are.\n\nRequires a signed in user on the session cookie; no role is required. The token-handler-admin role is intended to list all sessions of the user's tenant, but that listing is not currently supported.","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Request completed successfully.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserSessionData"}}}}},"401":{"$ref":"#/components/responses/TokenHandlerNoSession"}}}},"/token-handler/v1/targets/{targetId}/{targetPath}":{"parameters":[{"name":"targetId","description":"ID of the target of the client that the user signed in with.","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":50},"example":"form-service"},{"name":"targetPath","description":"Request path on the upstream, relative to the base URL of the upstream in the directory service. It can have any number of segments (for example form/v1/forms), which OpenAPI cannot express. Paths with dot segments ('.' or '..') or encoded path separators are rejected as invalid. The query string is passed to the upstream unchanged.","in":"path","required":true,"schema":{"type":"string"},"example":"form/v1/forms"}],"get":{"tags":["Target"],"description":"Proxies a GET request to the upstream of the target, with the access token of the signed in user as the bearer token. The access token is refreshed if it is about to expire. The session cookie, CSRF token, and tenant headers of the request are not passed on. The upstream determines the response.\n\nRequires a signed in user on the session cookie; the target must be a target of the client that the user signed in with. No token handler role is required; the upstream checks the roles of the user.","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Request completed successfully by the upstream."},"400":{"$ref":"#/components/responses/TokenHandlerTargetBadRequest"},"401":{"description":"No user is signed in on the session cookie, or the client of the session is no longer registered so the access token cannot be refreshed.","content":{"text/plain":{"schema":{"type":"string"},"example":"Unauthorized"}}},"404":{"$ref":"#/components/responses/TokenHandlerTargetNotFound"},"default":{"$ref":"#/components/responses/TokenHandlerTargetUpstreamResponse"}}},"post":{"tags":["Target"],"description":"Proxies a POST request to the upstream of the target, with the access token of the signed in user as the bearer token. The access token is refreshed if it is about to expire. The session cookie, CSRF token, and tenant headers of the request are not passed on. The upstream determines the response.\n\nRequires a signed in user on the session cookie; the target must be a target of the client that the user signed in with. No token handler role is required; the upstream checks the roles of the user. The X-XSRF-TOKEN header is required.","security":[{"sessionCookie":[]}],"parameters":[{"$ref":"#/components/parameters/TokenHandlerCsrfToken"}],"requestBody":{"description":"Request body for the upstream, passed on unchanged with its content type.","required":false,"content":{"application/json":{"schema":{"type":"object"},"example":{"definitionId":"my-form-definition"}}}},"responses":{"200":{"description":"Request completed successfully by the upstream."},"400":{"$ref":"#/components/responses/TokenHandlerTargetBadRequest"},"401":{"description":"No user is signed in on the session cookie, or the client of the session is no longer registered so the access token cannot be refreshed.","content":{"text/plain":{"schema":{"type":"string"},"example":"Unauthorized"}}},"404":{"$ref":"#/components/responses/TokenHandlerTargetNotFound"},"default":{"$ref":"#/components/responses/TokenHandlerTargetUpstreamResponse"}}},"put":{"tags":["Target"],"description":"Proxies a PUT request to the upstream of the target, with the access token of the signed in user as the bearer token. The access token is refreshed if it is about to expire. The session cookie, CSRF token, and tenant headers of the request are not passed on. The upstream determines the response.\n\nRequires a signed in user on the session cookie; the target must be a target of the client that the user signed in with. No token handler role is required; the upstream checks the roles of the user. The X-XSRF-TOKEN header is required.","security":[{"sessionCookie":[]}],"parameters":[{"$ref":"#/components/parameters/TokenHandlerCsrfToken"}],"requestBody":{"description":"Request body for the upstream, passed on unchanged with its content type.","required":false,"content":{"application/json":{"schema":{"type":"object"},"example":{"definitionId":"my-form-definition"}}}},"responses":{"200":{"description":"Request completed successfully by the upstream."},"400":{"$ref":"#/components/responses/TokenHandlerTargetBadRequest"},"401":{"description":"No user is signed in on the session cookie, or the client of the session is no longer registered so the access token cannot be refreshed.","content":{"text/plain":{"schema":{"type":"string"},"example":"Unauthorized"}}},"404":{"$ref":"#/components/responses/TokenHandlerTargetNotFound"},"default":{"$ref":"#/components/responses/TokenHandlerTargetUpstreamResponse"}}},"patch":{"tags":["Target"],"description":"Proxies a PATCH request to the upstream of the target, with the access token of the signed in user as the bearer token. The access token is refreshed if it is about to expire. The session cookie, CSRF token, and tenant headers of the request are not passed on. The upstream determines the response.\n\nRequires a signed in user on the session cookie; the target must be a target of the client that the user signed in with. No token handler role is required; the upstream checks the roles of the user. The X-XSRF-TOKEN header is required.","security":[{"sessionCookie":[]}],"parameters":[{"$ref":"#/components/parameters/TokenHandlerCsrfToken"}],"requestBody":{"description":"Request body for the upstream, passed on unchanged with its content type.","required":false,"content":{"application/json":{"schema":{"type":"object"},"example":{"definitionId":"my-form-definition"}}}},"responses":{"200":{"description":"Request completed successfully by the upstream."},"400":{"$ref":"#/components/responses/TokenHandlerTargetBadRequest"},"401":{"description":"No user is signed in on the session cookie, or the client of the session is no longer registered so the access token cannot be refreshed.","content":{"text/plain":{"schema":{"type":"string"},"example":"Unauthorized"}}},"404":{"$ref":"#/components/responses/TokenHandlerTargetNotFound"},"default":{"$ref":"#/components/responses/TokenHandlerTargetUpstreamResponse"}}},"delete":{"tags":["Target"],"description":"Proxies a DELETE request to the upstream of the target, with the access token of the signed in user as the bearer token. The access token is refreshed if it is about to expire. The session cookie, CSRF token, and tenant headers of the request are not passed on. The upstream determines the response.\n\nRequires a signed in user on the session cookie; the target must be a target of the client that the user signed in with. No token handler role is required; the upstream checks the roles of the user. The X-XSRF-TOKEN header is required.","security":[{"sessionCookie":[]}],"parameters":[{"$ref":"#/components/parameters/TokenHandlerCsrfToken"}],"responses":{"200":{"description":"Request completed successfully by the upstream."},"400":{"$ref":"#/components/responses/TokenHandlerTargetBadRequest"},"401":{"description":"No user is signed in on the session cookie, or the client of the session is no longer registered so the access token cannot be refreshed.","content":{"text/plain":{"schema":{"type":"string"},"example":"Unauthorized"}}},"404":{"$ref":"#/components/responses/TokenHandlerTargetNotFound"},"default":{"$ref":"#/components/responses/TokenHandlerTargetUpstreamResponse"}}}}},"components":{"securitySchemes":{"accessToken":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"sessionCookie":{"type":"apiKey","in":"cookie","name":"adsp_tk_session"}},"parameters":{"TokenHandlerClientId":{"name":"clientId","description":"ID of the client, as configured in the token handler configuration of the tenant or the core configuration.","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":50},"example":"my-client"},"TokenHandlerCsrfToken":{"name":"X-XSRF-TOKEN","description":"Value of the XSRF-TOKEN cookie that was set when the user signed in. Required for requests other than GET, HEAD, and OPTIONS.","in":"header","required":true,"schema":{"type":"string"},"example":"6f1c2d3e4a5b69788796a5b4c3d2e1f0"},"TokenHandlerTenantHeader":{"name":"X-ADSP-TENANT","description":"Name or URN of the tenant, for example set by the reverse proxy of an application to restrict it to one tenant. The name can be the tenant name as it is (ignoring case) or in kebab-case form, with hyphens in place of spaces.","in":"header","required":false,"schema":{"type":"string","maxLength":100},"example":"my-tenant"}},"responses":{"TokenHandlerBadRequest":{"description":"Request is invalid, for example a path, query, or body parameter failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenHandlerError"},"example":{"errorMessage":"Validation failed with error(s): id (params) - Invalid value"}}}},"TokenHandlerClientNotFound":{"description":"No client with the ID is configured for the tenant or in the core configuration.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenHandlerError"},"example":{"errorMessage":"client with ID 'my-client' could not be found."}}}},"TokenHandlerForbidden":{"description":"User does not have the token-handler-admin role in the tenant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenHandlerError"},"example":{"errorMessage":"User Test User (ID: 0a1b2c3d-4e5f-6789-abcd-ef0123456789) not permitted to get clients."}}}},"TokenHandlerNoSession":{"description":"No user is signed in on the session cookie.","content":{"text/plain":{"schema":{"type":"string"},"example":"Unauthorized"}}},"TokenHandlerTargetBadRequest":{"description":"Request is invalid: the X-XSRF-TOKEN header does not match the session, the target ID failed validation, the request path has dot segments or encoded path separators, or the upstream of the target cannot be resolved by the directory service or is not in the allowed upstream domains.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenHandlerError"},"example":{"errorMessage":"Request must include valid CSRF token."}}}},"TokenHandlerTargetNotFound":{"description":"The client that the user signed in with has no target with the ID.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenHandlerError"},"example":{"errorMessage":"target with ID 'form-service' could not be found."}}}},"TokenHandlerTargetUpstreamResponse":{"description":"Any other response is the response of the upstream, passed back unchanged except that Set-Cookie, Set-Cookie2, and Clear-Site-Data headers are removed."},"TokenHandlerTooManyRequests":{"description":"Sign in, callback, and logout requests are rate limited to 100 requests per 5 minutes for each client IP address. The RateLimit and RateLimit-Policy headers describe the limit.","content":{"text/plain":{"schema":{"type":"string"},"example":"Too many requests, please try again later."}}},"TokenHandlerUnauthorized":{"description":"Request does not include a valid bearer token from a tenant realm. Tokens from the core (platform) realm are not accepted.","content":{"text/plain":{"schema":{"type":"string"},"example":"Unauthorized"}}}},"schemas":{"AuthenticationClient":{"type":"object","properties":{"id":{"type":"string","description":"ID of the client."},"clientId":{"type":"string","readOnly":true,"description":"Client ID of the registered client in access service. Not set if the client is not registered."},"authCallbackUrl":{"type":"string","deprecated":true,"description":"Deprecated callback URL of the client configuration. Use the callbackUrl query parameter to sign in instead."},"successRedirectUrl":{"type":"string","description":"URL the browser is redirected to after sign in succeeds. Defaults to the root of the site."},"failureRedirectUrl":{"type":"string","description":"URL the browser is redirected to after sign in fails. Defaults to the root of the site."}},"example":{"id":"my-client","clientId":"3f2a9c1e-7b4d-4e8a-9c2f-1a2b3c4d5e6f","successRedirectUrl":"/","failureRedirectUrl":"/sign-in-failed"}},"ClientSummary":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"core":{"type":"boolean","readOnly":true,"description":"Whether the client is from the core configuration, which provides it to all tenants."},"idpHint":{"type":"string","description":"Identity provider hint passed to access service when signing in."},"successRedirectUrl":{"type":"string"},"failureRedirectUrl":{"type":"string"},"redirectUris":{"type":"array","description":"Redirect URIs that are registered with access service when the client is registered.","items":{"type":"string"}},"targets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"upstream":{"type":"string","description":"URN of the upstream service or API, resolved by the directory service."}}}},"registered":{"type":"boolean","readOnly":true,"description":"Whether the client is registered with access service for the tenant."},"clientId":{"type":"string","readOnly":true,"description":"Client ID of the registered client in access service. Not set if the client is not registered."}},"example":{"id":"my-client","name":"My application","description":"Client for the my application frontend.","core":false,"successRedirectUrl":"/","failureRedirectUrl":"/","redirectUris":["https://myapp.example.ca/token-handler/clients/my-client/callback"],"targets":[{"id":"form-service","upstream":"urn:ads:platform:form-service"}],"registered":true,"clientId":"3f2a9c1e-7b4d-4e8a-9c2f-1a2b3c4d5e6f"}},"TokenHandlerError":{"type":"object","properties":{"errorMessage":{"type":"string"}},"example":{"errorMessage":"client with ID 'my-client' could not be found."}},"UserSessionData":{"type":"object","properties":{"tenantId":{"type":"string","description":"URN of the tenant of the user."},"id":{"type":"string","description":"ID of the user in access service."},"name":{"type":"string"},"email":{"type":"string"},"roles":{"type":"array","description":"Roles of the user, from the access token. Realm roles are listed by name, and client roles as '<client>:<role>'.","items":{"type":"string"}},"expiry":{"type":"string","format":"date-time","description":"When the session expires, based on the expiry of the refresh token."},"authenticatedBy":{"type":"string","description":"ID of the token handler client that the user signed in with."}},"example":{"tenantId":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","id":"0a1b2c3d-4e5f-6789-abcd-ef0123456789","name":"Test User","email":"test.user@gov.ab.ca","roles":["default-roles-my-realm","urn:ads:platform:form-service:form-applicant"],"expiry":"2026-11-10T20:30:00.000Z","authenticatedBy":"my-client"}}}},"security":[{"accessToken":[]}],"tags":[]}
@@ -0,0 +1 @@
1
+ {"openapi":"3.0.0","info":{"title":"Value service","version":"0.0.0","description":"The Value service provides a time-series append only store for json documents."},"paths":{"/value/v1/definitions":{"get":{"tags":["Value definition"],"description":"Retrieves the tenant and core value definitions, grouped by namespace. Requires the value-reader or value-writer role. Tenant users receive the definitions of their own tenant; core users with the role receive those of the tenant set by tenantId, or only core definitions (with an empty tenant) when it is not set.\n","parameters":[{"$ref":"#/components/parameters/ValueTenantId"}],"responses":{"200":{"description":"Value definitions successfully retrieved.","content":{"application/json":{"example":{"tenant":{"test-service":{"name":"test-service","definitions":{"response-time":{"name":"response-time","description":"Response time of the test service.","jsonSchema":{"type":"number"}}}}},"core":{}},"schema":{"type":"object","properties":{"tenant":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/ValueNamespace"}},"core":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/ValueNamespace"}}}}}}},"400":{"description":"tenantId is not a valid tenant URN.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValueError"},"example":{"errorMessage":"ADSP ID (not-a-tenant) must begin with: urn:ads:"}}}},"401":{"$ref":"#/components/responses/ValueUnauthorized"},"403":{"$ref":"#/components/responses/ValueForbidden"}}},"post":{"tags":["Value definition"],"description":"Creates a value definition in the tenant configuration, adding the namespace if it does not exist. Requires the value-writer role and a tenant context: tenant users create definitions in their own tenant, and core users must set tenantId. The JSON schema must be a valid JSON schema. Responds 409 if a tenant or core definition with the same namespace and name already exists.\n","parameters":[{"$ref":"#/components/parameters/ValueTenantId"}],"requestBody":{"required":true,"content":{"application/json":{"example":{"namespace":"test-service","name":"response-time","description":"Response time of the test service.","jsonSchema":{"type":"number"},"sendWriteEvent":false},"schema":{"allOf":[{"$ref":"#/components/schemas/ValueDefinition"},{"type":"object","properties":{"namespace":{"type":"string","pattern":"^[a-zA-Z0-9-_ ]{1,50}$"}},"required":["namespace","name","jsonSchema"]}]}}}},"responses":{"201":{"description":"Value definition successfully created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValueDefinitionResponse"}}}},"400":{"$ref":"#/components/responses/ValueBadRequest"},"401":{"$ref":"#/components/responses/ValueUnauthorized"},"403":{"$ref":"#/components/responses/ValueForbidden"},"409":{"$ref":"#/components/responses/ValueDefinitionConflict"}}}},"/value/v1/definitions/{namespace}/{name}":{"parameters":[{"name":"namespace","description":"Namespace of the value definition.","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-zA-Z0-9-_ ]{1,50}$"},"example":"test-service"},{"name":"name","description":"Name of the value definition.","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-zA-Z0-9-_ ]{1,50}$"},"example":"response-time"},{"$ref":"#/components/parameters/ValueTenantId"}],"get":{"tags":["Value definition"],"description":"Retrieves a value definition. The tenant definition is returned if it exists, otherwise the core definition. Requires the value-reader or value-writer role. Tenant users read their own tenant's definitions; core users read those of the tenant set by tenantId, or only core definitions when it is not set. Definitions of other tenants respond 404.\n","responses":{"200":{"description":"Value definition successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValueDefinitionResponse"}}}},"400":{"$ref":"#/components/responses/ValueBadRequest"},"401":{"$ref":"#/components/responses/ValueUnauthorized"},"403":{"$ref":"#/components/responses/ValueForbidden"},"404":{"$ref":"#/components/responses/ValueDefinitionNotFound"}}},"patch":{"tags":["Value definition"],"description":"Updates a tenant value definition. Properties not included in the request are left unchanged. Requires the value-writer role and a tenant context: tenant users update their own tenant's definitions, and core users must set tenantId. Core definitions and definitions of other tenants respond 404. The JSON schema must be a valid JSON schema.\n","requestBody":{"required":true,"content":{"application/json":{"example":{"description":"Response time of the test service in milliseconds."},"schema":{"$ref":"#/components/schemas/ValueDefinitionUpdate"}}}},"responses":{"200":{"description":"Value definition successfully updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValueDefinitionResponse"}}}},"400":{"$ref":"#/components/responses/ValueBadRequest"},"401":{"$ref":"#/components/responses/ValueUnauthorized"},"403":{"$ref":"#/components/responses/ValueForbidden"},"404":{"$ref":"#/components/responses/ValueDefinitionNotFound"}}},"delete":{"tags":["Value definition"],"description":"Deletes a tenant value definition. The namespace is removed when its last definition is deleted. Requires the value-writer role and a tenant context: tenant users delete their own tenant's definitions, and core users must set tenantId. Core definitions and definitions of other tenants respond 404.\n","responses":{"200":{"description":"Value definition successfully deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}}},"example":{"deleted":true}}}},"400":{"$ref":"#/components/responses/ValueBadRequest"},"401":{"$ref":"#/components/responses/ValueUnauthorized"},"403":{"$ref":"#/components/responses/ValueForbidden"},"404":{"$ref":"#/components/responses/ValueDefinitionNotFound"}}}},"/value/v1/event-resources/distinct-count":{"get":{"tags":["Value"],"description":"Counts the distinct resources a tenant's events named over a period, for example the PDF templates used by pdf-service events. Answered from a daily rollup of the event log; the current day, and any history the rollup has not reached yet, are read from the event log for that span only. Only the resources the rollup maintains are accepted: templateId for pdf-service and definitionId for form-service events. Requires the value-reader role and a tenant context: tenant users count their own tenant, and core users must set tenantId.\n","parameters":[{"$ref":"#/components/parameters/ValueTenantId"},{"name":"namespace","description":"Namespace of the events, which is the service that sends them.","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":50},"example":"pdf-service"},{"name":"contextKey","description":"Event log context property that names the resource.","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":50},"example":"templateId"},{"name":"names","description":"Comma separated event names to count across. Defaults to every event the rollup maintains for the namespace, and responds 400 if it names any other.\n","in":"query","required":false,"schema":{"type":"string"},"example":"pdf-generation-queued,pdf-generated,pdf-generation-failed"},{"name":"intervalMin","description":"Inclusive start of the period (ISO 8601).","in":"query","required":true,"schema":{"type":"string","format":"date-time"},"example":"2025-11-01T00:00:00.000Z"},{"name":"intervalMax","description":"Exclusive end of the period (ISO 8601). The period can be at most 731 days.","in":"query","required":true,"schema":{"type":"string","format":"date-time"},"example":"2026-11-01T00:00:00.000Z"}],"responses":{"200":{"description":"Distinct resources counted.","content":{"application/json":{"example":{"namespace":"pdf-service","contextKey":"templateId","names":["pdf-generation-queued","pdf-generated","pdf-generation-failed"],"intervalMin":"2025-11-01T00:00:00.000Z","intervalMax":"2026-11-01T00:00:00.000Z","count":12},"schema":{"type":"object","properties":{"namespace":{"type":"string"},"contextKey":{"type":"string"},"names":{"type":"array","items":{"type":"string"}},"intervalMin":{"type":"string","format":"date-time"},"intervalMax":{"type":"string","format":"date-time"},"count":{"type":"integer","description":"Number of distinct resources named by the events in the period."}}}}}},"400":{"description":"A parameter failed validation, tenant context is missing, the namespace and contextKey are not rolled up, names includes an event that is not rolled up, or the period is empty or longer than 731 days.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValueError"},"example":{"errorMessage":"Distinct templateId is not rolled up for test-service events."}}}},"401":{"$ref":"#/components/responses/ValueUnauthorized"},"403":{"$ref":"#/components/responses/ValueForbidden"}}}},"/value/v1/service-metric-rollups/run":{"post":{"tags":["Value"],"description":"Manually triggers service metric rollup processing for completed days. Requires the value-writer role. Core users with the role can roll up a specific tenant by setting tenantId in the body, or all tenants by leaving it out; tenant users are always restricted to their own tenant and tenantId is ignored. The current partial day and future days cannot be rolled up.\n","requestBody":{"required":false,"content":{"application/json":{"example":{"start":"2026-09-01","end":"2026-09-07","tenantId":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7"},"schema":{"type":"object","properties":{"start":{"type":"string","format":"date","description":"First completed day to roll up (ISO 8601). Defaults to end when only end is supplied, and to the configured trailing window when neither is supplied.\n"},"end":{"type":"string","format":"date","description":"Last completed day to roll up (ISO 8601). Defaults to start when only start is supplied."},"tenantId":{"type":"string","description":"Tenant ID to roll up. Only used for core users."}}}}}},"responses":{"200":{"description":"Service metric rollup completed.","content":{"application/json":{"example":{"start":"2026-09-01","end":"2026-09-07","tenant":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","rollups":42},"schema":{"type":"object","properties":{"start":{"type":"string","format":"date"},"end":{"type":"string","format":"date"},"tenant":{"type":"string","nullable":true,"description":"Tenant ID that was rolled up, or null when all tenants were rolled up."},"rollups":{"type":"integer","description":"Number of rollup rows written."}}}}}},"400":{"description":"start or end is not an ISO 8601 date, start is after end, or the range includes the current partial day or a future day.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValueError"},"example":{"errorMessage":"Cannot roll up the current partial day or a future day."}}}},"401":{"$ref":"#/components/responses/ValueUnauthorized"},"403":{"$ref":"#/components/responses/ValueForbidden"}}}},"/value/v1/{namespace}/values":{"get":{"tags":["Value"],"description":"Reads the latest record of each value definition in a namespace. Requires the value-reader role. Only values with a tenant or core value definition are returned. Acts on the tenant of the caller's token; core users reading a tenant's values should read each value with GET /value/v1/{namespace}/values/{name} and tenantId.\n","parameters":[{"$ref":"#/components/parameters/ValueNamespaceParam"},{"name":"names","in":"query","description":"Comma-separated names of the values to read. Defaults to every value defined in the namespace.","required":false,"style":"form","explode":false,"schema":{"type":"array","items":{"type":"string"}},"example":["response-time","error-count"]}],"responses":{"200":{"description":"Values successfully read, keyed by namespace and then value name.","content":{"application/json":{"example":{"test-service":{"response-time":{"correlationId":"request-1","context":{"endpoint":"/api/v1/items"},"timestamp":"2026-09-24T17:00:00.000Z","value":120}}},"schema":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Value"}}}}}},"400":{"$ref":"#/components/responses/ValueBadRequest"},"401":{"$ref":"#/components/responses/ValueUnauthorized"},"403":{"$ref":"#/components/responses/ValueForbidden"},"404":{"description":"The namespace has no value definitions, or none of the requested names has a value definition.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValueError"},"example":{"errorMessage":"namespace with ID 'test-service' could not be found."}}}}}}},"/value/v1/{namespace}/values/{name}":{"parameters":[{"name":"namespace","description":"Namespace of the stored value. This path value is always event-service for event log records; it is not the optional event namespace filter exposed by the event service.\n","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":50},"example":"test-service"},{"name":"name","description":"Name of the stored value. This path value is always event for event log records; it is not the optional event name filter exposed by the event service.\n","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":50},"example":"response-time"}],"get":{"tags":["Value"],"description":"Reads records of a namespace value, newest first unless order is asc. Requires the value-reader role, or the export-service export-job role. Only records of the tenant are returned; tenant users read their own tenant and core users with the role read the tenant set by tenantId. Core users can also leave out tenantId to read the records of all tenants, which is how the event service reads the event log. Tenant users without a tenant context get 400. A value that has no records responds 200 with an empty array. Event log consumers should use the event service API, where event namespace and name are optional query filters.\n","parameters":[{"$ref":"#/components/parameters/ValueTenantId"},{"name":"top","description":"Number of results to read. Defaults to 10.","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":5000,"default":10}},{"name":"after","description":"Cursor for the next set of results; set it to page.next of the previous response.","in":"query","required":false,"schema":{"type":"string","description":"Base64 encoded number of records to skip."},"example":"MTA="},{"name":"order","description":"Timestamp order of the results; asc reads oldest first. Defaults to desc. Reading the oldest end of a large result set in asc order avoids skipping over the newer records.\n","in":"query","required":false,"schema":{"type":"string","enum":["asc","desc"],"default":"desc"}},{"name":"correlationId","description":"Correlation ID associated with the values.","in":"query","required":false,"schema":{"type":"string"},"example":"request-1"},{"name":"context","description":"JSON object of context values the records must contain. Must be valid JSON. Every supplied property must match (AND). For event log records, namespace and name identify the event definition.\n","in":"query","required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"boolean"},{"type":"number"}]},"example":{"namespace":"support-program","name":"application-submitted"}}}}},{"name":"timestampMin","description":"Inclusive min value of timestamp (ISO 8601).","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"example":"2026-09-01T00:00:00.000Z"},{"name":"timestampMax","description":"Inclusive max value of timestamp (ISO 8601).","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"example":"2026-10-01T00:00:00.000Z"},{"name":"payloadPath","description":"Dot-separated property path within an event payload. Must be supplied with payloadValue and with both timestampMin and timestampMax. Cannot be combined with payload.\n","in":"query","required":false,"schema":{"type":"string","pattern":"^[A-Za-z_][A-Za-z0-9_-]*(\\.[A-Za-z_][A-Za-z0-9_-]*)*$","example":"applicant.contact.email"}},{"name":"payloadValue","description":"Exact JSON scalar at payloadPath. JSON numbers, booleans, null, and quoted strings are parsed as their JSON types; other input is treated as a string. Must be supplied with payloadPath.\n","in":"query","required":false,"schema":{"type":"string","example":"test.user@gov.ab.ca"}},{"name":"payload","description":"JSON object that the event payload must contain. Nested objects and multiple properties are supported, and every supplied property must match (AND). Additional event payload properties are ignored. Requires both timestampMin and timestampMax and cannot be combined with payloadPath or payloadValue.\n","in":"query","required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"example":{"applicationId":"12345","status":"submitted"}}}}},{"name":"value","description":"Filter to records with a payload targetId equal to this value (used for event log records). Must not contain double quotes.\n","in":"query","required":false,"schema":{"type":"string"},"example":"61f2e3a8c9b1d2e3f4a5b6c7"},{"name":"url","description":"Filter to records with a payload URL equal to this value (used for event log records). Must not contain double quotes.\n","in":"query","required":false,"schema":{"type":"string"},"example":"https://my-application.alberta.ca/applications"}],"responses":{"200":{"description":"Value successfully read.","content":{"application/json":{"example":{"test-service":{"response-time":[{"correlationId":"request-1","context":{"endpoint":"/api/v1/items"},"timestamp":"2026-09-24T17:00:00.000Z","value":120}]},"page":{"after":null,"next":"MTA=","size":1}},"schema":{"type":"object","properties":{"page":{"$ref":"#/components/schemas/ValuePage"}},"additionalProperties":{"type":"object","additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/Value"}}}}}}},"400":{"$ref":"#/components/responses/ValueBadRequest"},"401":{"$ref":"#/components/responses/ValueUnauthorized"},"403":{"$ref":"#/components/responses/ValueForbidden"}}},"post":{"tags":["Value"],"description":"Writes one or more records of a namespace value. Requires the value-writer role. Tenant users write to their own tenant; core users with the role write to the tenant set by tenantId in the body or query, and get 400 without one. A tenant user who sets a tenantId other than their own gets 403. The body can be a value envelope (with value, context, correlationId, timestamp and metrics), a bare JSON object which is written as the value, or an array of either. A value does not need a definition. If the value has a definition, records that fail its schema are skipped, and a value-written event is sent for each record when the definition has sendWriteEvent set. Responds with an array when the request body is an array.\n","parameters":[{"$ref":"#/components/parameters/ValueTenantId"}],"requestBody":{"required":true,"content":{"application/json":{"examples":{"envelope":{"summary":"Value with envelope","value":{"correlationId":"request-1","context":{"endpoint":"/api/v1/items"},"timestamp":"2026-09-24T17:00:00.000Z","value":120,"metrics":{"response-time":120}}},"bare":{"summary":"Bare value object","value":{"responseTime":120}},"batch":{"summary":"Batch of values","value":[{"value":120},{"value":95}]},"core":{"summary":"Core user writing to a tenant","value":{"tenantId":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","value":120}}},"schema":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/Value"},{"type":"object","properties":{"tenantId":{"type":"string","description":"Tenant to write to. Only core users can write to a tenant other than their own."}}}]},{"type":"object"},{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/Value"},{"type":"object"}]}}]}}}},"responses":{"200":{"description":"Value successfully written.","content":{"application/json":{"example":{"correlationId":"request-1","context":{"endpoint":"/api/v1/items"},"timestamp":"2026-09-24T17:00:00.000Z","value":120},"schema":{"oneOf":[{"$ref":"#/components/schemas/Value"},{"type":"array","items":{"$ref":"#/components/schemas/Value"}}]}}}},"400":{"$ref":"#/components/responses/ValueBadRequest"},"401":{"$ref":"#/components/responses/ValueUnauthorized"},"403":{"$ref":"#/components/responses/ValueForbidden"}}}},"/value/v1/{namespace}/values/{name}/count":{"parameters":[{"$ref":"#/components/parameters/ValueNamespaceParam"},{"$ref":"#/components/parameters/ValueNameParam"}],"get":{"tags":["Value"],"description":"Counts records of a namespace value in a tenant. Requires the value-reader role and a tenant context: tenant users count their own tenant, and core users must set tenantId.\n","parameters":[{"$ref":"#/components/parameters/ValueTenantId"},{"name":"correlationId","description":"Correlation ID associated with the values.","in":"query","required":false,"schema":{"type":"string"},"example":"request-1"},{"name":"context","description":"JSON object of context values the records must contain. Must be valid JSON. Every supplied property must match (AND). For event log records, namespace and name identify the event definition.\n","in":"query","required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"boolean"},{"type":"number"}]},"example":{"namespace":"support-program","name":"application-submitted"}}}}},{"name":"timestampMin","description":"Inclusive min value of timestamp (ISO 8601).","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"example":"2026-09-01T00:00:00.000Z"},{"name":"timestampMax","description":"Inclusive max value of timestamp (ISO 8601).","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"example":"2026-10-01T00:00:00.000Z"}],"responses":{"200":{"description":"Value successfully read.","content":{"application/json":{"schema":{"type":"object","properties":{"namespace":{"type":"string"},"name":{"type":"string"},"count":{"type":"integer"}}},"example":{"namespace":"test-service","name":"response-time","count":1024}}}},"400":{"$ref":"#/components/responses/ValueBadRequest"},"401":{"$ref":"#/components/responses/ValueUnauthorized"},"403":{"$ref":"#/components/responses/ValueForbidden"}}}},"/value/v1/{namespace}/values/{name}/metrics":{"get":{"tags":["Value"],"description":"Retrieves interval aggregates of every metric of a value, keyed by metric name. Requires the value-reader role and a tenant context: tenant users read their own tenant, and core users must set tenantId. Paging is over metric interval rows, newest first.\n","parameters":[{"$ref":"#/components/parameters/ValueNamespaceParam"},{"$ref":"#/components/parameters/ValueNameParam"},{"$ref":"#/components/parameters/ValueTenantId"},{"$ref":"#/components/parameters/MetricInterval"},{"$ref":"#/components/parameters/MetricTop"},{"$ref":"#/components/parameters/MetricAfter"},{"name":"criteria","description":"JSON criteria for the read. Must be valid JSON.","in":"query","required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetricCriteria"}}}}],"responses":{"200":{"description":"Metrics successfully read.","content":{"application/json":{"schema":{"type":"object","properties":{"page":{"$ref":"#/components/schemas/MetricPage"}},"additionalProperties":{"$ref":"#/components/schemas/Metric"}},"example":{"response-time:avg":{"name":"response-time:avg","values":[{"interval":"2026-09-23T00:00:00.000Z","avg":118.5,"sum":1185,"min":80,"max":240,"count":10}]},"page":{"after":null,"next":"MQ==","size":1,"intervalMax":"2026-09-24T00:00:00.000Z"}}}}},"400":{"$ref":"#/components/responses/ValueBadRequest"},"401":{"$ref":"#/components/responses/ValueUnauthorized"},"403":{"$ref":"#/components/responses/ValueForbidden"}}}},"/value/v1/{namespace}/values/{name}/metrics/{metric}":{"get":{"tags":["Value"],"description":"Retrieves interval aggregates of a single metric of a value. Requires the value-reader role and a tenant context: tenant users read their own tenant, and core users must set tenantId. A metric without records responds 200 with no values.\n","parameters":[{"$ref":"#/components/parameters/ValueNamespaceParam"},{"$ref":"#/components/parameters/ValueNameParam"},{"name":"metric","description":"Name of the metric to read.","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"example":"response-time:avg"},{"$ref":"#/components/parameters/ValueTenantId"},{"$ref":"#/components/parameters/MetricInterval"},{"$ref":"#/components/parameters/MetricTop"},{"$ref":"#/components/parameters/MetricAfter"},{"name":"criteria","description":"JSON criteria for the read; metricLike is not used. Must be valid JSON.","in":"query","required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetricCriteria"}}}}],"responses":{"200":{"description":"Metric successfully read.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Metric"},{"type":"object","properties":{"page":{"$ref":"#/components/schemas/MetricPage"}}}]},"example":{"name":"response-time:avg","values":[{"interval":"2026-09-23T00:00:00.000Z","avg":118.5,"sum":1185,"min":80,"max":240,"count":10}],"page":{"after":null,"next":"MQ==","size":1,"intervalMax":"2026-09-24T00:00:00.000Z"}}}}},"400":{"$ref":"#/components/responses/ValueBadRequest"},"401":{"$ref":"#/components/responses/ValueUnauthorized"},"403":{"$ref":"#/components/responses/ValueForbidden"}}}},"/value/v1/{namespace}/values/{name}/platform-metrics":{"get":{"tags":["Value"],"description":"Retrieves interval aggregates of a value's metrics across all tenants, labelled by tenant. Requires the value-platform-metrics-reader role and is only accessible to core users; tenant users get 403 even with the role. Always reads the materialised metric rollups and is not paginated.\n","parameters":[{"$ref":"#/components/parameters/ValueNamespaceParam"},{"$ref":"#/components/parameters/ValueNameParam"},{"$ref":"#/components/parameters/MetricInterval"},{"name":"criteria","description":"JSON criteria for the read. Must be valid JSON.","in":"query","required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetricCriteria"}}}}],"responses":{"200":{"description":"Platform metrics successfully read.","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/PlatformMetric"}},"example":{"response-time:avg":{"name":"response-time:avg","values":[{"interval":"2026-09-23T00:00:00.000Z","tenantId":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","avg":118.5,"sum":1185,"min":80,"max":240,"count":10}]}}}}},"400":{"$ref":"#/components/responses/ValueBadRequest"},"401":{"$ref":"#/components/responses/ValueUnauthorized"},"403":{"description":"User is not a core user with the value-platform-metrics-reader role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValueError"},"example":{"errorMessage":"User Test User (ID: 1234) not permitted to read platform metrics."}}}}}}}},"components":{"securitySchemes":{"accessToken":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"responses":{"ValueBadRequest":{"description":"Request is invalid, for example a path or query parameter failed validation or tenant context is missing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValueError"},"example":{"errorMessage":"Tenant context is required for operation."}}}},"ValueDefinitionConflict":{"description":"Value definition already exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValueError"},"example":{"errorMessage":"Value definition 'test-service:response-time' already exists."}}}},"ValueDefinitionNotFound":{"description":"Value definition not found in the tenant (or, for reads, in the core definitions).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValueError"},"example":{"errorMessage":"value definition with ID 'test-service:response-time' could not be found."}}}},"ValueForbidden":{"description":"User does not have the role required for the operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValueError"},"example":{"errorMessage":"User Test User (ID: 1234) not permitted to read values."}}}},"ValueNotFound":{"description":"Namespace or value definition not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValueError"},"example":{"errorMessage":"namespace with ID 'test-service' could not be found."}}}},"ValueUnauthorized":{"description":"Request does not include a valid bearer token."}},"schemas":{"Metric":{"type":"object","properties":{"name":{"type":"string"},"values":{"type":"array","description":"Interval aggregates, newest first.","items":{"$ref":"#/components/schemas/MetricIntervalValue"}}},"example":{"name":"response-time:avg","values":[{"interval":"2026-09-23T00:00:00.000Z","avg":118.5,"sum":1185,"min":80,"max":240,"count":10}]}},"MetricCriteria":{"type":"object","description":"Must be valid JSON. Without intervalMin and intervalMax, the last month is read. intervalMin and intervalMax must be ISO 8601 date-times.\n","properties":{"metricLike":{"type":"string","description":"Only read metrics whose name contains this text. Not used when reading a single metric."},"intervalMax":{"type":"string","format":"date-time"},"intervalMin":{"type":"string","format":"date-time"}},"example":{"metricLike":"response-time","intervalMin":"2026-09-01T00:00:00.000Z","intervalMax":"2026-10-01T00:00:00.000Z"}},"MetricIntervalValue":{"type":"object","properties":{"interval":{"type":"string","format":"date-time","description":"Start of the interval."},"avg":{"type":"number","nullable":true},"sum":{"type":"number"},"min":{"type":"number"},"max":{"type":"number"},"count":{"type":"number"}},"example":{"interval":"2026-09-23T00:00:00.000Z","avg":118.5,"sum":1185,"min":80,"max":240,"count":10}},"MetricPage":{"allOf":[{"$ref":"#/components/schemas/ValuePage"},{"type":"object","properties":{"intervalMax":{"type":"string","format":"date-time","readOnly":true,"description":"End of the window actually read. It is snapped back to the start of the interval in progress, so only whole intervals are returned.\n"}}}],"example":{"after":null,"next":"MQ==","size":1,"intervalMax":"2026-09-24T00:00:00.000Z"}},"PlatformMetric":{"type":"object","properties":{"name":{"type":"string"},"values":{"type":"array","items":{"$ref":"#/components/schemas/PlatformMetricIntervalValue"}}},"example":{"name":"response-time:avg","values":[{"interval":"2026-09-23T00:00:00.000Z","tenantId":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","avg":118.5,"sum":1185,"min":80,"max":240,"count":10}]}},"PlatformMetricIntervalValue":{"allOf":[{"$ref":"#/components/schemas/MetricIntervalValue"},{"type":"object","properties":{"tenantId":{"type":"string"}}}],"example":{"interval":"2026-09-23T00:00:00.000Z","tenantId":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","avg":118.5,"sum":1185,"min":80,"max":240,"count":10}},"Value":{"type":"object","properties":{"correlationId":{"type":"string","nullable":true,"description":"Correlation ID that links related records, for example the records of one request."},"context":{"type":"object","description":"Context of the record, used to filter reads.","additionalProperties":{"oneOf":[{"type":"string"},{"type":"boolean"},{"type":"number"}]}},"timestamp":{"type":"string","format":"date-time","description":"Time of the record. Defaults to the time of the write."},"value":{"description":"The recorded value; any JSON value. Validated against the value definition schema, if there is one."},"metrics":{"type":"object","writeOnly":true,"description":"Metric name to number. Numeric entries are recorded as metrics of the value and aggregated into intervals; other entries are ignored. Not returned with the record.\n","additionalProperties":{"type":"number"}}},"example":{"correlationId":"request-1","context":{"endpoint":"/api/v1/items"},"timestamp":"2026-09-24T17:00:00.000Z","value":120}},"ValueDefinition":{"type":"object","properties":{"name":{"type":"string","pattern":"^[a-zA-Z0-9-_ ]{1,50}$"},"displayName":{"type":"string"},"description":{"type":"string"},"jsonSchema":{"type":"object","description":"JSON schema that written values are validated against."},"sendWriteEvent":{"type":"boolean","description":"Whether a value-written event is sent when a value is written."}},"example":{"name":"response-time","displayName":"Response time","description":"Response time of the test service.","jsonSchema":{"type":"number"},"sendWriteEvent":false}},"ValueDefinitionResponse":{"allOf":[{"$ref":"#/components/schemas/ValueDefinition"},{"type":"object","properties":{"namespace":{"type":"string"},"isCore":{"type":"boolean","description":"Whether the definition is a core (platform) definition rather than a tenant definition."}}}],"example":{"namespace":"test-service","name":"response-time","displayName":"Response time","description":"Response time of the test service.","jsonSchema":{"type":"number"},"sendWriteEvent":false,"isCore":false}},"ValueDefinitionUpdate":{"type":"object","properties":{"displayName":{"type":"string"},"description":{"type":"string"},"jsonSchema":{"type":"object"},"sendWriteEvent":{"type":"boolean"}},"example":{"description":"Response time of the test service in milliseconds."}},"ValueError":{"type":"object","properties":{"errorMessage":{"type":"string"}},"example":{"errorMessage":"Tenant context is required for operation."}},"ValueNamespace":{"type":"object","properties":{"name":{"type":"string"},"definitions":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/ValueDefinition"}}},"example":{"name":"test-service","definitions":{"response-time":{"name":"response-time","description":"Response time of the test service.","jsonSchema":{"type":"number"}}}}},"ValuePage":{"type":"object","properties":{"after":{"type":"string","nullable":true,"description":"Cursor the page was read after."},"next":{"type":"string","description":"Cursor for the next page; absent when there are no more results."},"size":{"type":"number","description":"Number of results in the page."}},"example":{"after":null,"next":"MTA=","size":10}}},"parameters":{"MetricAfter":{"name":"after","description":"Cursor for the next set of results; set it to page.next of the previous response.","in":"query","required":false,"schema":{"type":"string","description":"Base64 encoded number of rows to skip."},"example":"MTAw"},"MetricInterval":{"name":"interval","description":"Interval to aggregate metrics into. Defaults to daily. Any other value responds 400 with \"Interval value is not recognized.\"\n","in":"query","required":false,"schema":{"type":"string","default":"daily","enum":["one_minute","five_minutes","hourly","daily","weekly","monthly"]}},"MetricTop":{"name":"top","description":"Number of metric interval rows to read. Defaults to 100.","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":5000,"default":100}},"ValueNameParam":{"name":"name","description":"Name of the value within the namespace.","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":50},"example":"response-time"},"ValueNamespaceParam":{"name":"namespace","description":"Namespace of the value, for example the name of the service that writes it.","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":50},"example":"test-service"},"ValueTenantId":{"name":"tenantId","description":"ID of the tenant to act on. Only used for core (platform) users; tenant users always act on the tenant of their token and this parameter is ignored. Responds 400 if it is not a valid tenant URN.\n","in":"query","required":false,"schema":{"type":"string"},"example":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7"}}},"security":[{"accessToken":[]}],"tags":[{"name":"Value","description":"API to store and retrieve values."},{"name":"Value definition","description":"API to manage value definitions."}]}
@@ -0,0 +1 @@
1
+ {"openapi":"3.0.0","info":{"title":"Verify service","version":"1.0.0","description":"The Verify service generates random codes that expire in 10 mins and provides verification of such codes. Codes can be used to verify that a user has access to a particular email address or SMS number."},"paths":{"/verify/v1/codes/{key}":{"post":{"tags":["Verify"],"description":"Generates a new code at a key, or verifies a code against the code at a key.\n\nWithout a `code` in the body, the operation generates a new random code at the key, replacing any existing code there, and requires the code-generator role. With a `code` in the body, the operation verifies it and requires the code-verifier role. Each failed verification is counted, and the code at the key is cleared after 10 failures; generate a new code at the key to continue.\n\nCodes are isolated by tenant. Tenant users and service accounts generate and verify codes in the tenant of their token, and core (platform) users with the role in the core realm use a separate core namespace. A code generated in one tenant can't be verified from another; the verification responds 200 with `verified: false`. Core users can set the `tenantId` query parameter to the tenant that audit records of the operation are attributed to; it doesn't change the core namespace of the code.\n\nOperations are recorded in the audit service under the verify-service namespace, with the key but never the code.\n","parameters":[{"name":"key","description":"Key for the code to generate or verify, for example an identifier of the email address or SMS number being verified. Unique within the tenant.\n","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":50,"example":"email-test.user@gov.ab.ca"}},{"name":"expireIn","description":"Number of minutes the generated code is valid for. Defaults to 10. Only used when generating a code; ignored when verifying.\n","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":10,"example":15}},{"name":"tenantId","description":"Tenant that audit records of the operation are attributed to, for core (platform) users acting on behalf of a tenant. Ignored for tenant users, whose records are attributed to the tenant of their token. Codes of core users are stored in the core namespace regardless of this parameter.\n","in":"query","required":false,"schema":{"type":"string","example":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7"}}],"requestBody":{"required":false,"description":"Omit the body, or the code, to generate a code. Include a non-empty code to verify it.","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","description":"Code to verify against the code at the key. Required to verify a code."}}},"examples":{"generate":{"summary":"Generate a code","value":{}},"verify":{"summary":"Verify a code","value":{"code":"CF4HKR"}}}}}},"responses":{"200":{"description":"Code generated, with the generated code in the response; or code verified, with the result of the verification in the response.\n","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/GeneratedCode"},{"$ref":"#/components/schemas/VerifyResult"}]},"examples":{"generated":{"summary":"Generated code","value":{"key":"email-test.user@gov.ab.ca","code":"CF4HKR","expiresAt":"2026-10-01T15:14:05.000Z"}},"verified":{"summary":"Verification result","value":{"verified":true}}}}}},"400":{"$ref":"#/components/responses/VerifyBadRequest"},"401":{"$ref":"#/components/responses/VerifyUnauthorized"},"403":{"$ref":"#/components/responses/VerifyForbidden"}}}}},"components":{"securitySchemes":{"accessToken":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"responses":{"VerifyBadRequest":{"description":"Request is invalid, for example the key is longer than 50 characters, expireIn is not a positive integer, code is not a string, a core user's tenantId is not a tenant ID, or the body is not valid JSON.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyError"},"example":{"errorMessage":"Validation failed with error(s): expireIn (query) - Invalid value"}}}},"VerifyForbidden":{"description":"User does not have the role required for the operation: code-generator to generate a code, or code-verifier to verify a code.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyError"},"example":{"errorMessage":"User Test Service Account (ID: 3f2b8c1e-5d4a-4f6b-9c7e-1a2b3c4d5e6f) not permitted to verify code."}}}},"VerifyUnauthorized":{"description":"Request does not include a valid bearer token from the core realm or a tenant realm.","content":{"text/plain":{"schema":{"type":"string"},"example":"Unauthorized"}}}},"schemas":{"GeneratedCode":{"type":"object","properties":{"key":{"type":"string","description":"Key the code was generated at, as given in the path.","readOnly":true},"code":{"type":"string","description":"Random 6 character code, using characters that are easy to tell apart.","readOnly":true},"expiresAt":{"type":"string","format":"date-time","description":"Time after which the code is cleared and can no longer be verified.","readOnly":true}},"required":["key","code","expiresAt"],"example":{"key":"email-test.user@gov.ab.ca","code":"CF4HKR","expiresAt":"2026-10-01T15:14:05.000Z"}},"VerifyError":{"type":"object","properties":{"errorMessage":{"type":"string"}}},"VerifyResult":{"type":"object","properties":{"verified":{"type":"boolean","description":"True if the code matches the code at the key. False if it doesn't match, or if there is no code at the key because it expired, was never generated, or was cleared after 10 failed verifications.\n","readOnly":true}},"required":["verified"],"example":{"verified":true}}}},"security":[{"accessToken":[]}],"tags":[{"name":"Verify","description":"API to generate and verify time limited codes."}]}
@@ -142,6 +142,37 @@ The agent service sends the following domain events under the `agent-service` na
142
142
 
143
143
  The service doesn't consume domain events, but it listens for configuration service updates so that changed agent configuration applies without waiting for its cache to expire.
144
144
 
145
+ ## Audit actions
146
+
147
+ Agent service records audit events in the `agent-service` namespace of the [audit service](audit-service.md). Records are written to the tenant of the agent configuration. Agent interactions have the agent as the resource (`{ type: 'agent', id: <agent ID>, name: <agent name> }`); thread deletion has the thread as the resource (`{ type: 'thread', id: <thread ID> }`). The thread ID is the correlation ID, and `agentId` and `threadId` are in the metadata. All actions are version 1.
148
+
149
+ | action | category | severity | retention class | recorded when |
150
+ | :----------------------- | :------------- | :------- | :-------------- | :------------------------------------------------------------------------------------------------------------------------------------------ |
151
+ | agent.message.sent | data-access | info | compliance | A message to an agent is accepted, over REST or socket.io, with `messageLength` (characters of text) and `attachmentCount` in the metadata. |
152
+ | agent.response.completed | runtime | info | compliance | An agent's response finishes, with `responseLength` and `hasStructuredOutput` in the metadata. See the statuses below. |
153
+ | agent.tool.invoked | runtime | info | compliance | An agent calls a tool, with `toolId` and `toolType` (`builtin`, `api` or `mcp`) in the metadata. See the statuses below. |
154
+ | agent.delegation.started | runtime | info | compliance | An agent delegates a subtask to another agent, with the delegating agent as the resource and `delegateAgentId` in the metadata. |
155
+ | thread.deleted | administrative | info | standard | A user deletes one of their own threads through the API. |
156
+
157
+ The outcome is in the `status` of the record, not in the action name, so failures can be found with the `status` query filter:
158
+
159
+ - `agent.tool.invoked` has status `failure` when the tool throws, fails input or output validation, or an MCP tool returns an error. `errorCode` in the metadata is the code of the error, or its name when it has no code (for example `ValidationError`).
160
+ - `agent.response.completed` has status `failure` when the response stops with an error, with `errorCode` such as `GENERATION_DEADLINE` (time limit), `MAX_STEPS` (step limit), `ABORTED`, or the error name. It has status `blocked` when a guardrail stops the response, with `errorCode: 'TRIPWIRE'` and the `processorId` of the guardrail.
161
+ - Other records have status `success`.
162
+
163
+ The actor is the user who sent the message, or the service account for service-triggered calls. Tool calls and delegations made by a delegated agent are recorded with that agent's ID and the same user and thread, so each delegation in an agentic loop has its own record. Each tool call produces one `agent.tool.invoked` record.
164
+
165
+ Message and response content, tool inputs and outputs, delegation prompts, error messages, structured output values, and token counts are never recorded. Messages rejected because the user lacks a required role, or that cannot be processed (for example, an attachment cannot be read), are not recorded.
166
+
167
+ Not recorded by agent service:
168
+
169
+ - Changes to agent configuration. Agents are configured in the [configuration service](configuration-service.md), which records `configuration.updated` and `configuration.deleted` with a change set, including changes to `instructions`, `tools`, `userRoles` and `mcp`, in the `configuration-service` namespace.
170
+ - Threads deleted when they expire. These are signalled by the `thread-deleted` event.
171
+
172
+ Tool calls can be high volume, so agent service sends audit events in batches of up to 100 events, and sends any remaining events on shutdown. Audit failures are logged by the SDK and do not fail the agent interaction. The agent service account requires the `audit-writer` role of `urn:ads:platform:audit-service`.
173
+
174
+ Audit recording is on by default. Set the environment variable `AGENT_AUDIT_ENABLED=false` on agent service to turn it off, or `true` to turn it on regardless of the SDK `AUDIT_ENABLED` variable, which applies when `AGENT_AUDIT_ENABLED` is not set. The action catalog is still registered while recording is off, so turning it back on needs only a restart.
175
+
145
176
  ## Code examples
146
177
 
147
178
  ### Configure an agent
@@ -90,6 +90,29 @@ The notification service sends the following domain events under the `notificati
90
90
  | `subscription-set` | A subscription was created or its criteria changed. |
91
91
  | `subscription-deleted` | A subscription was deleted. |
92
92
 
93
+ ## Audit
94
+ Notification service records audit events in the `notification-service` namespace of the [audit service](/adsp-monorepo/services/audit-service.html). Records are written to the tenant of the subscriber, subscription, notification type or notification. All actions are version 1.
95
+
96
+ | Action | Category | Severity | Retention class | Recorded when |
97
+ |:-|:-|:-|:-|:-|
98
+ | `subscriber.created` | administrative | info | standard | A subscriber is created, including when a user first subscribes. |
99
+ | `subscriber.updated` | administrative | info | standard | The name or channels of a subscriber are changed, or a subscriber channel is verified. |
100
+ | `subscriber.deleted` | administrative | warning | compliance | A subscriber and its subscriptions are deleted. |
101
+ | `subscription.created` | administrative | info | standard | A subscriber is subscribed to a notification type. |
102
+ | `subscription.updated` | administrative | info | standard | The criteria of a subscription are changed or one criteria is removed. |
103
+ | `subscription.deleted` | administrative | info | standard | A subscriber is unsubscribed from a notification type. |
104
+ | `notification.sent` | runtime | info | standard | A notification is sent to a subscriber through a channel provider. |
105
+ | `notification.send-failed` | runtime | warning | standard | A notification to a subscriber could not be sent after all retries, with the `error` message in the metadata. |
106
+ | `notification.direct-sent` | runtime | info | standard | A notification of a direct type (with an `addressPath`) is sent to the address in the event. |
107
+ | `notification.direct-send-failed` | runtime | warning | standard | A notification of a direct type could not be sent after all retries, with the `error` message in the metadata. |
108
+ | `notification-type.created` | administrative | info | compliance | A tenant notification type is created through the notification API. |
109
+ | `notification-type.updated` | administrative | warning | compliance | A tenant notification type is changed, or a platform type is customized (`customizesCoreType: true`). |
110
+ | `notification-type.deleted` | administrative | warning | compliance | A tenant notification type or a platform type customization is deleted (`revertsToCoreType: true`). |
111
+
112
+ Subscriber and subscription changes record the user or service account (ID, name and roles, without the email address) as the actor. Subscriber records include only the channel types and whether each is verified; channel addresses are not recorded. Sent and failed notifications are recorded with the system actor `notification-service-job` and the event correlation ID. Notifications to subscribers are recorded against the subscription (`<type ID>:<subscriber ID>`), and notifications of direct types are recorded against the notification type with the `direct-` actions. The recipient address, message content and context values are not recorded (only the context keys).
113
+
114
+ Contact information changes and notification type changes made directly in the configuration service are not recorded by notification service. Notifications can be high volume, so audit events are sent in batches of up to 100 events. Audit failures are logged and do not fail the operation. The service account of notification service needs the `audit-writer` role of `urn:ads:platform:audit-service`. Set `NOTIFICATION_AUDIT_ENABLED` to `false` to disable recording; when unset it follows the SDK `AUDIT_ENABLED` variable (on by default).
115
+
93
116
  ## Code examples
94
117
  ### Create a notification type
95
118
  Users with the subscription-admin or configuration-admin role can create notification types for their tenant. The definition is validated, including its channels, events, and templates. The service responds `409` if a type with the ID already exists.
@@ -48,6 +48,7 @@ All endpoints are under `https://value-service.adsp.alberta.ca/value/v1`. See th
48
48
  | `GET /value/v1/{namespace}/values/{name}/metrics/{metric}` | Read interval aggregates of one metric. | `value-reader` |
49
49
  | `GET /value/v1/{namespace}/values/{name}/platform-metrics` | Read a value's metrics across all tenants. | `value-platform-metrics-reader` (core users only) |
50
50
  | `POST /value/v1/service-metric-rollups/run` | Run the service metric rollup for completed days. | `value-writer` |
51
+ | `GET /value/v1/event-resources/distinct-count` | Count the distinct resources events named over a period. | `value-reader` |
51
52
  | `GET /value/v1/definitions` | List tenant and core value definitions. | `value-reader` or `value-writer` |
52
53
  | `POST /value/v1/definitions` | Create a tenant value definition. | `value-writer` |
53
54
  | `GET /value/v1/definitions/{namespace}/{name}` | Get a value definition (tenant, otherwise core). | `value-reader` or `value-writer` |
@@ -126,6 +127,21 @@ ORDER BY "interval";
126
127
 
127
128
  Rollups store `sum` and `count` rather than an average, because an average of averages is not the average; the read path divides the two.
128
129
 
130
+ ### Event resource rollups
131
+
132
+ Reports count how many distinct resources a tenant's events named over a period, such as the PDF templates behind `pdf-service` events. Reading that from the event log means reading every event in the period. The `event_resource_rollups` table instead records, per day, which resources each tenant's events named: one row per day, tenant, event and resource, with the number of events. A distinct count does not add up across days the way a sum does — a template used on two days is still one template — so the rollup keeps the resources themselves, and a period's count is a distinct count over its days.
133
+
134
+ The resources rolled up are the `resource` entries of the service metric rollup mappings: `templateId` for `pdf-service` and `definitionId` for `form-service` events.
135
+
136
+ The job runs alongside the metric interval rollups, under `METRIC_INTERVAL_ROLLUP_JOB_ENABLED`, `METRIC_INTERVAL_ROLLUP_MAX_CHUNK_HOURS` (bounded to between a day and a week) and `METRIC_INTERVAL_ROLLUP_STATEMENT_TIMEOUT_MS`, on ticks offset two minutes from theirs and under its own advisory lock. It moves each source's coverage forward over closed days — a day is rolled up an hour after it ends, so events timestamped just before midnight land in it — and backward through history, recorded in `event_resource_rollup_coverage`. Walking back starts from the newest event log chunk below coverage, read from chunk metadata, so a span of years with no data at all, such as between a stray old event and the rest of the log, is crossed in a single step.
137
+
138
+ `GET /value/v1/event-resources/distinct-count` reads the count for a `namespace`, `contextKey`, optional comma separated `names` (defaulting to every event rolled up for the namespace) and a period from `intervalMin` (inclusive) to `intervalMax` (exclusive), at most 731 days. Whole days inside coverage come from the rollup; the current day, and any history the backfill has not reached yet, are read from the event log for that span alone, and the two are combined before counting. Only the sources above and their own events are accepted, since the rollup has no rows for anything else and would undercount.
139
+
140
+ ```sql
141
+ SELECT namespace, context_key, covered_from, covered_to, updated_at
142
+ FROM event_resource_rollup_coverage;
143
+ ```
144
+
129
145
  ### Service metric rollups
130
146
 
131
147
  A daily job summarises tenant activity for `pdf-service`, `form-service` and `notification-service` into the `service_metric_rollups` table: one row per day, tenant and service, with counts of initiated, succeeded and failed operations, duration totals, and the number of distinct resources (for example PDF templates or form definitions). The rows are derived from the event log and the services' metrics.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/adsp-sdk-mcp-server",
3
- "version": "1.25.0",
3
+ "version": "1.27.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",
@@ -0,0 +1,12 @@
1
+ {
2
+ "kind": "release",
3
+ "builtAt": "2026-11-13T21:16:43.554Z",
4
+ "sourceCommit": "01504d1ddbee00f3e8e0320cb05b7258967e92da",
5
+ "latestRelease": "1.26.0",
6
+ "docsCommit": "ac78f9c3d5a7570fc866b06f379806a915db9b91",
7
+ "sdk": {
8
+ "version": "2.36.1",
9
+ "commit": "dd58a2b854c4406b42c0604dba3fa4b941038d6c",
10
+ "unreleasedChanges": false
11
+ }
12
+ }
@@ -0,0 +1,44 @@
1
+ /** One entry of api-specs/index.json, written by scripts/api-specs.mjs. */
2
+ export interface ApiServiceSummary {
3
+ app: string;
4
+ urn: string;
5
+ name: string;
6
+ title?: string;
7
+ operations: number;
8
+ file: string;
9
+ }
10
+ export interface ApiEndpointSummary {
11
+ service: string;
12
+ method: string;
13
+ path: string;
14
+ summary?: string;
15
+ deprecated: boolean;
16
+ /** Sentences of the description that state who may call it (roles, tenancy, anonymous access). */
17
+ access: string[];
18
+ }
19
+ export interface ApiEndpoint extends ApiEndpointSummary {
20
+ serviceUrn: string;
21
+ operationId?: string;
22
+ description?: string;
23
+ tags: string[];
24
+ parameters: unknown[];
25
+ requestBody?: unknown;
26
+ responses: Record<string, unknown>;
27
+ security?: unknown;
28
+ }
29
+ /** The bundled OpenAPI specs (api-specs/), indexed for listing, keyword search and reading one endpoint. */
30
+ export declare class ApiSpecsRepository {
31
+ private readonly services;
32
+ private readonly operations;
33
+ constructor(apiSpecsRoot: string);
34
+ list(): ApiServiceSummary[];
35
+ /** The service named by its app folder, URN or display name; case-insensitive. */
36
+ findService(nameOrUrn: string): ApiServiceSummary | undefined;
37
+ search(query: string, options?: {
38
+ service?: ApiServiceSummary;
39
+ limit?: number;
40
+ }): ApiEndpointSummary[];
41
+ read(service: ApiServiceSummary, method: string, path: string): ApiEndpoint | undefined;
42
+ /** Paths of a service, for suggesting the right one when a read misses. */
43
+ paths(service: ApiServiceSummary): string[];
44
+ }