@abgov/adsp-sdk-mcp-server 1.26.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 (58) hide show
  1. package/README.md +53 -7
  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 +4 -4
  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 +13 -3
  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
package/README.md CHANGED
@@ -4,8 +4,8 @@ An MCP (Model Context Protocol) server that gives an AI coding assistant grounde
4
4
  [Alberta Digital Service Platform](https://govalta.github.io/adsp-monorepo) (ADSP) and the Node SDK
5
5
  (`@abgov/adsp-service-sdk`), instead of guessing.
6
6
 
7
- It bundles the ADSP documentation site content and a curated reference of every `@abgov/adsp-service-sdk` export,
8
- and exposes them over stdio via eight tools:
7
+ It bundles the ADSP documentation site content, the OpenAPI specs of ADSP services, and a curated reference of every
8
+ `@abgov/adsp-service-sdk` export, and exposes them over stdio via eleven tools:
9
9
 
10
10
  - `search_adsp_docs` — keyword search across ADSP platform docs (getting started, architecture, service concepts,
11
11
  tutorials). Common words people use that the docs don't, such as `websocket` or `auth`, also search for the
@@ -26,6 +26,15 @@ and exposes them over stdio via eight tools:
26
26
  - `get_adsp_mcp_server_info` — this server's version and where its bundled content came from: the docs source
27
27
  commit, the `@abgov/adsp-service-sdk` version the SDK reference matches, and the release time. Lets an agent warn
28
28
  that an answer may be stale.
29
+ - `list_service_apis` — the ADSP services that publish a REST API, with URN and operation count.
30
+ - `search_service_endpoints` — keyword search over those services' endpoints (path, summary, tags, description),
31
+ optionally within one service.
32
+ - `read_service_endpoint` — one endpoint as its service's OpenAPI spec defines it: description, parameters, request
33
+ body and responses with schema references inlined. `access` quotes the description's sentences about roles,
34
+ tenancy and anonymous access; structured role metadata is planned (CS-5731).
35
+
36
+ The three API tools read the bundled OpenAPI specs (see [Bundled OpenAPI specs](#bundled-openapi-specs)), the same
37
+ content each service serves at `/swagger/docs/v1`, so they work offline.
29
38
 
30
39
  The two live tools require logging in first (see below). Everything else in this package works fully offline with no
31
40
  setup.
@@ -55,7 +64,7 @@ Add it to your MCP client's server config, run via `npx`:
55
64
  ### HTTP transport
56
65
 
57
66
  To host the server instead of running it per user, start it with `MCP_TRANSPORT=http`. It serves Streamable HTTP
58
- at `POST /mcp`, with a liveness check at `GET /health`.
67
+ at `POST /mcp`, with a liveness check at `GET /health` and a readiness check at `GET /ready`.
59
68
 
60
69
  | Variable | Default | Purpose |
61
70
  |---|---|---|
@@ -66,6 +75,8 @@ at `POST /mcp`, with a liveness check at `GET /health`.
66
75
  | `MCP_IN_FLIGHT_WAIT_MS` | `1000` | How long a request waits for a free slot before getting `503`. Also how long a live tool waits for a free upstream slot |
67
76
  | `MCP_RATE_LIMIT_PER_MINUTE` | `1200` | `POST /mcp` requests allowed per client IP per minute, per process. `0` turns the limit off |
68
77
  | `MCP_LIVE_TOOL_MAX_CONCURRENT` | `8` | Live-tool calls to ADSP running at once per process, across both live tools |
78
+ | `MCP_SHUTDOWN_DELAY_MS` | `5000` | After a shutdown signal, how long to keep serving with `/ready` failing, so the router stops sending traffic first |
79
+ | `MCP_SHUTDOWN_TIMEOUT_MS` | `30000` | Hard deadline from the signal to exit, even if a request is still running. Must be longer than the delay |
69
80
  | `TRUSTED_PROXY` | `uniquelocal` | Express [`trust proxy`](https://expressjs.com/en/guide/behind-proxies.html) setting, so the client IP comes from the router's `X-Forwarded-For` |
70
81
  | `OTEL_EXPORTER_OTLP_ENDPOINT` | unset | OTLP/HTTP collector base URL. When set, metrics are exported to `<endpoint>/v1/metrics` |
71
82
  | `OTEL_METRIC_EXPORT_INTERVAL` | `60000` | Metric export interval, in milliseconds |
@@ -80,6 +91,24 @@ there is no stream to open and no session to delete.
80
91
 
81
92
  `SESSION_TTL_MINUTES` has been removed and is ignored: there are no sessions to expire.
82
93
 
94
+ #### Health and shutdown
95
+
96
+ - `GET /health` is liveness: it answers `200` while the process is up, including during the shutdown delay, so a pod
97
+ that is still finishing requests isn't restarted. Once the delay ends the port is closed.
98
+ - `GET /ready` is readiness. The server only listens once the docs index is built, so the check fails while the index
99
+ loads. It answers `200` after that, and `503` from the moment shutdown starts.
100
+
101
+ On `SIGTERM` or `SIGINT`:
102
+
103
+ 1. `/ready` starts failing, and responses carry `Connection: close` so clients reconnect elsewhere.
104
+ 2. The server keeps serving for `MCP_SHUTDOWN_DELAY_MS`, while the router takes the pod out of rotation.
105
+ 3. It stops accepting new connections, lets requests already running finish, flushes metrics, and exits `0`. A
106
+ request already on an open connection is still answered, with `Connection: close`.
107
+ 4. If a request is still running at `MCP_SHUTDOWN_TIMEOUT_MS`, it exits `1` anyway.
108
+
109
+ Set the pod's `terminationGracePeriodSeconds` above `MCP_SHUTDOWN_TIMEOUT_MS`, and keep `MCP_SHUTDOWN_DELAY_MS` longer
110
+ than it takes the router to stop sending traffic to a pod that fails readiness.
111
+
83
112
  #### Overload guards
84
113
 
85
114
  `POST /mcp` passes these checks in order. `GET /health` skips all of them. Every rejection is a JSON-RPC error body
@@ -140,7 +169,7 @@ OpenTelemetry SDK isn't loaded. Stdio mode never exports metrics.
140
169
 
141
170
  Every label takes a value from a fixed set:
142
171
 
143
- - `mcp.tool.name`: one of the eight tool names, or `unknown` for any name the server doesn't have.
172
+ - `mcp.tool.name`: one of the eleven tool names, or `unknown` for any name the server doesn't have.
144
173
  - `mcp.method.name`: an MCP method such as `initialize`, `tools/list` or `tools/call`; `other` for any other method;
145
174
  `batch` for a JSON-RPC batch; `unparsed` when the body wasn't valid JSON-RPC or was too large.
146
175
  - `error.type` on `mcp.request.duration`: `aborted` when the client disconnected before the response was written; the
@@ -182,11 +211,17 @@ nx lint adsp-sdk-mcp-server
182
211
 
183
212
  ### Refresh workflow
184
213
 
185
- The bundled content is refreshed from source on every release, not fetched live:
214
+ The bundled content is refreshed from source on every release, not fetched live. After changing `docs/`, a service's
215
+ OpenAPI fragments or `swagger.config.js`, or `scripts/api-services.json`, run:
216
+
217
+ ```bash
218
+ npx nx run adsp-sdk-mcp-server:sync-content
219
+ ```
220
+
221
+ and commit what it changes in the same PR. In Claude Code, `/adsp-mcp-sync` does this and checks the SDK reference.
186
222
 
187
223
  - **Docs.** The build copies `docs/**/*.md` into the package. `src/docs/docs-lock.json` fingerprints those pages, and
188
- `src/docs/docsLock.spec.ts` fails CI when `docs/` changes without it. In a PR that changes `docs/`, run
189
- `npx nx run adsp-sdk-mcp-server:update-docs-lock` and commit the lock. The lock is inside this package, so the
224
+ `src/docs/docsLock.spec.ts` fails CI when `docs/` changes without it. `sync-content` updates it. The lock is inside this package, so the
190
225
  change releases it: `.releaserc.json` releases a patch for `docs` commits as well as `feat` and `fix`.
191
226
  - **SDK reference.** Maintained by hand, and checked against the SDK source (below).
192
227
  - **Provenance.** The `release` target runs `scripts/provenance.mjs` before publishing. It writes
@@ -209,6 +244,17 @@ output over the fixture docs in `src/fixtures/docs`; the other tools are checked
209
244
  instead, so SDK reference and quickstart edits don't touch it. If you change docs search or the docs tools' output on
210
245
  purpose, update the matching entry.
211
246
 
247
+ ### Bundled OpenAPI specs
248
+
249
+ `api-specs/` holds each service's OpenAPI spec as minified JSON, plus `index.json` (app, service URN, name,
250
+ operation count). `scripts/api-specs.mjs` generates them the way each service's webpack build does: `swagger-jsdoc`
251
+ over `apps/<app>/swagger.config.js`, `apps/<app>/src/**/*.ts` and `apps/<app>/src/**/*.swagger.yml`. pii-service
252
+ uses its static `swagger.yml`. The build copies them to `assets/api-specs`.
253
+
254
+ `src/api-specs/apiSpecs.spec.ts` fails CI when a service's spec changes without regenerating, or when an app with a
255
+ `swagger.config.js` is in neither `services` nor `excluded` in `scripts/api-services.json`. `sync-content`
256
+ regenerates them.
257
+
212
258
  To try it locally against a real MCP client, point the client config's `command`/`args` at the built entry point
213
259
  instead of `npx`:
214
260
 
@@ -0,0 +1 @@
1
+ {"openapi":"3.0.0","info":{"title":"Agent service","version":"0.0.0","description":"The agent service provides AI agents that assist users with tasks such as building forms. Use the socket.io interface for streaming, multi-turn conversations."},"paths":{"/agent/v1/access/guide/{topic}":{"get":{"tags":["Agent"],"description":"Gets one topic of the documented Access Service guidance used by the Access Service agent, such as client setup, token expiry, or identity providers. Static: no AI is involved and no tenant data is read, so the tenant admin app uses it to answer predefined questions about documented topics without a model call. Available to any authenticated user.","parameters":[{"name":"topic","description":"ID of the guide topic.","in":"path","required":true,"schema":{"type":"string","enum":["realm-model","environments","responsibility","add-tenant-admin","glossary","public-client","confidential-client","public-vs-confidential","client-troubleshooting","token-expiry","token-claims","token-audience","idp-claim-to-token","goa-ad","uiam-integration","saml-certificates","architecture","operations","disaster-recovery"]},"example":"token-expiry"}],"responses":{"200":{"description":"Guide topic successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccessGuideSection"}}}},"401":{"$ref":"#/components/responses/AgentUnauthorized"},"404":{"description":"No guide topic with the ID.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"},"example":{"errorMessage":"access guide topic with ID 'no-such-topic' could not be found."}}}}}}},"/agent/v1/access/scope":{"get":{"tags":["Agent"],"description":"Gets the Access Service environment and realm the current user may inspect (read-only). Available to any authenticated user; it deliberately does not require the agent-user role, so that it can tell users which role they are missing. Determined from the verified user token only; no AI is involved and no tenant data is read. Returns status \"unavailable\" with a reason and message, rather than an error, when the user cannot inspect (for example, without the urn:ads:platform:agent-service:agent-user role).","parameters":[{"$ref":"#/components/parameters/AgentTenantId"}],"responses":{"200":{"description":"Access scope successfully determined.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccessScope"},"examples":{"available":{"summary":"User can inspect their tenant realm","value":{"status":"available","message":"You can inspect the 3c1f9a52-6b7d-4e8a-9f0b-1c2d3e4f5a6b realm in Production (read-only).","environment":{"id":"prod","label":"Production","host":"https://access.alberta.ca","readOnly":true},"realm":{"id":"3c1f9a52-6b7d-4e8a-9f0b-1c2d3e4f5a6b","kind":"tenant"},"readOnly":true}},"missingRole":{"summary":"User does not have the agent-user role","value":{"status":"unavailable","reason":"MISSING_ROLE","message":"You do not have the role needed to inspect the Access Service. Ask your tenant administrator to assign it.","missingRoles":["urn:ads:platform:agent-service:agent-user"]}}}}}},"400":{"$ref":"#/components/responses/AgentBadRequest"},"401":{"$ref":"#/components/responses/AgentUnauthorized"}}}},"/agent/v1/agents":{"get":{"tags":["Agent"],"description":"Gets the ID and name of every agent available in the tenant: the platform (core) agents and the agents the tenant has configured. Available to any authenticated user; no role is required, and agents restricted by userRoles are listed too. A platform agent replaces a tenant agent with the same ID.","parameters":[{"$ref":"#/components/parameters/AgentTenantId"}],"responses":{"200":{"description":"Agents successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentList"}}}},"400":{"$ref":"#/components/responses/AgentBadRequest"},"401":{"$ref":"#/components/responses/AgentUnauthorized"}}}},"/agent/v1/agents/{agentId}":{"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/AgentTenantId"}],"get":{"tags":["Agent"],"description":"Gets the ID and name of an agent. Available to any authenticated user; no role is required, even for agents restricted by userRoles. An agent ID that is not configured for the tenant or the platform responds 404.","responses":{"200":{"description":"Agent successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentSummary"}}}},"400":{"$ref":"#/components/responses/AgentBadRequest"},"401":{"$ref":"#/components/responses/AgentUnauthorized"},"404":{"$ref":"#/components/responses/AgentNotFound"}}},"post":{"tags":["Agent"],"description":"Sends one or more user messages to an agent and responds with its complete reply. Available to any authenticated user when the agent has no userRoles; otherwise the user needs one of the agent's userRoles in the tenant, so core users can only use agents without userRoles. The agent-user role is not checked on this operation. Each request starts a new thread, so the agent has no context from earlier requests; use the socket.io interface for multi-turn conversations and streaming.","requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/UserMessage"},{"type":"array","items":{"$ref":"#/components/schemas/UserMessage"}}]},"examples":{"text":{"summary":"Text message","value":{"content":"Which fields should a business licence renewal form include?"}},"parts":{"summary":"Message with a file attachment","value":{"content":[{"type":"text","text":"Summarize the attached application."},{"type":"file","filename":"renewal-application.pdf","data":"JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSPj4Kc3RyZWFtCg==","mediaType":"application/pdf"}]}},"multiple":{"summary":"Several messages","value":[{"content":"My business is a food truck in Edmonton."},{"content":"Which permits do I need to renew?"}]}}}}},"responses":{"200":{"description":"Agent successfully responded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentGenerateResponse"}}}},"400":{"$ref":"#/components/responses/AgentBadRequest"},"401":{"$ref":"#/components/responses/AgentUnauthorized"},"403":{"$ref":"#/components/responses/AgentForbidden"},"404":{"$ref":"#/components/responses/AgentNotFound"}}}},"/agent/v1/agents/{agentId}/threads/{threadId}":{"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/ThreadId"},{"$ref":"#/components/parameters/AgentTenantId"}],"delete":{"tags":["Agent"],"description":"Deletes one of the signed-in user's own conversation threads, with its stored messages, observations and workspace, so a new chat starts without its context. Available to any authenticated user when the agent has no userRoles; otherwise the user needs one of the agent's userRoles in the tenant. Returns deleted false when the user has no thread with this ID in the tenant, including one that belongs to another user or tenant, so repeating the request is harmless.","responses":{"200":{"description":"Request completed successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThreadDeletion"},"examples":{"deleted":{"summary":"Thread deleted","value":{"deleted":true}},"notFound":{"summary":"User has no thread with the ID","value":{"deleted":false}}}}}},"400":{"$ref":"#/components/responses/AgentBadRequest"},"401":{"$ref":"#/components/responses/AgentUnauthorized"},"403":{"$ref":"#/components/responses/AgentForbidden"},"404":{"$ref":"#/components/responses/AgentNotFound"}}}}},"components":{"securitySchemes":{"accessToken":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"parameters":{"AgentId":{"name":"agentId","description":"ID of the agent, as configured in the agent-service configuration.","in":"path","required":true,"schema":{"type":"string"},"example":"formGenerationAgent"},"AgentTenantId":{"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. Without it, core users see only the platform (core) agents. Must be the full URN of an existing tenant.","in":"query","required":false,"schema":{"type":"string"},"example":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7"},"ThreadId":{"name":"threadId","description":"ID of the conversation thread, as sent as threadId on the socket.io message event.","in":"path","required":true,"schema":{"type":"string"},"example":"0f8fad5b-d9cb-469f-a165-70867728950e"}},"responses":{"AgentBadRequest":{"description":"Request is invalid, for example the tenantId query parameter is not a valid ADSP ID, or the request body is not valid JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"},"example":{"errorMessage":"ADSP ID (my-tenant) must begin with: urn:ads:"}}}},"AgentForbidden":{"description":"The agent is configured with userRoles and the user does not have any of them in the tenant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"},"example":{"errorMessage":"User Test User (ID: 7d2b6c3e-1f4a-4b8e-9c0d-2a5e6f7b8c9d) not permitted to use agent."}}}},"AgentNotFound":{"description":"No agent with the ID is configured for the tenant or the platform.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"},"example":{"errorMessage":"Agent with ID 'my-assistant' could not be found."}}}},"AgentUnauthorized":{"description":"Request does not include a valid bearer token.","content":{"text/plain":{"schema":{"type":"string"},"example":"Unauthorized"}}}},"schemas":{"AccessGuideSection":{"type":"object","properties":{"topic":{"type":"string"},"title":{"type":"string"},"markdown":{"type":"string","description":"The documented guidance for the topic, as markdown."}},"required":["topic","title","markdown"],"example":{"topic":"token-expiry","title":"Token expiry and refresh","markdown":"## Token expiry: Keycloak defaults usually already solve it\nKeycloak v24 ships with these realm-level defaults (Realm Settings → Tokens)..."}},"AccessScope":{"type":"object","properties":{"status":{"type":"string","enum":["available","unavailable"]},"reason":{"type":"string","description":"Why the scope is unavailable. Only present when status is unavailable.","enum":["NO_SESSION","MISSING_ROLE","UNKNOWN_ENVIRONMENT","ENVIRONMENT_MISMATCH","REALM_MISMATCH"]},"message":{"type":"string"},"missingRoles":{"type":"array","description":"Roles the user needs. Only present when reason is MISSING_ROLE.","items":{"type":"string"}},"readOnly":{"type":"boolean"},"environment":{"type":"object","properties":{"id":{"type":"string","enum":["dev","uat","prod","local"]},"label":{"type":"string"},"host":{"type":"string"},"readOnly":{"type":"boolean"}}},"realm":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["tenant","core"]}}}},"required":["status","message"],"example":{"status":"available","message":"You can inspect the 3c1f9a52-6b7d-4e8a-9f0b-1c2d3e4f5a6b realm in Production (read-only).","environment":{"id":"prod","label":"Production","host":"https://access.alberta.ca","readOnly":true},"realm":{"id":"3c1f9a52-6b7d-4e8a-9f0b-1c2d3e4f5a6b","kind":"tenant"},"readOnly":true}},"AgentError":{"type":"object","properties":{"errorMessage":{"type":"string"}},"required":["errorMessage"]},"AgentGenerateResponse":{"type":"object","properties":{"agent":{"type":"string","description":"ID of the agent that responded."},"content":{"type":"string","description":"Text of the agent's response."},"output":{"type":"object","additionalProperties":true,"nullable":true,"description":"Structured output matching the agent's outputSchema. Absent when the agent has no outputSchema, or when the output did not match it."}},"required":["agent","content"],"example":{"agent":"data-extractor","content":"The message mentions one organization and is positive overall.","output":{"entities":[{"name":"Service Alberta","type":"organization"}],"sentiment":"positive"}}},"AgentList":{"type":"object","properties":{"agents":{"type":"array","items":{"$ref":"#/components/schemas/AgentSummary"}}},"required":["agents"],"example":{"agents":[{"id":"formGenerationAgent","name":"Form Generation Agent"},{"id":"my-assistant","name":"My Assistant"}]}},"AgentSummary":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"example":{"id":"formGenerationAgent","name":"Form Generation Agent"}},"FilePart":{"type":"object","properties":{"type":{"type":"string","enum":["file"]},"filename":{"type":"string"},"data":{"type":"string","description":"File content as a base64 string or data URL."},"mediaType":{"type":"string"}},"required":["type","data","mediaType"],"example":{"type":"file","filename":"renewal-application.pdf","data":"JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSPj4Kc3RyZWFtCg==","mediaType":"application/pdf"}},"ImagePart":{"type":"object","properties":{"type":{"type":"string","enum":["image"]},"image":{"type":"string","description":"Image as a base64 string, data URL, or URL."},"mediaType":{"type":"string"}},"required":["type","image"],"example":{"type":"image","image":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==","mediaType":"image/png"}},"TextPart":{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"text":{"type":"string"}},"required":["type","text"],"example":{"type":"text","text":"Which fields should a business licence renewal form include?"}},"ThreadDeletion":{"type":"object","properties":{"deleted":{"type":"boolean"}},"required":["deleted"],"example":{"deleted":true}},"UserMessage":{"type":"object","description":"A message from the user. content is required: either text, or an array of text, image, and file parts.","properties":{"content":{"oneOf":[{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/TextPart"},{"$ref":"#/components/schemas/ImagePart"},{"$ref":"#/components/schemas/FilePart"}],"discriminator":{"propertyName":"type","mapping":{"text":"#/components/schemas/TextPart","image":"#/components/schemas/ImagePart","file":"#/components/schemas/FilePart"}}}},{"type":"string"}]}},"required":["content"],"example":{"content":"Which fields should a business licence renewal form include?"}}}},"security":[{"accessToken":[]}],"tags":[{"name":"Agent","description":"API to list agents, message agents, and manage conversation threads."}]}
@@ -0,0 +1 @@
1
+ {"openapi":"3.0.0","info":{"title":"Audit service","version":"0.0.0","description":"The Audit service records who did what, to which resource and when, for ADSP applications.\n\n**Read this before integrating.**\n- A `202` from `POST /audit/v1/{namespace}/events` does **not** mean every event was stored. Inspect `accepted`, `duplicates` and `rejected` in the body. Rejected events are not stored and are not resent.\n- `403` means a missing role **or** a namespace that is not the caller's. `404` on the actions endpoint means no catalog is registered for the namespace. `503` means retry.\n- Roles: `audit-writer` writes events, `audit-reader` reads events and action catalogs, `audit-admin` manages failed events.\n- Retention periods are applied when an event is written. Changing retention configuration affects only events written afterward.\n\nUse **Authorize** with a bearer token to try requests from this page. Writing to a namespace you do not own returns `403`."},"paths":{"/audit/v1/actions":{"get":{"tags":["Action catalogs"],"summary":"List all action catalogs visible to the caller.","description":"Requires the `audit-reader` role, held in the tenant or as a Core role. Returns every catalog registered in\naudit-service:actions-<application> for the caller's tenant and for Core (such as the platform services), so a\nclient can discover the available namespaces and actions. As for the single-namespace endpoint, each catalog\nmerges tenant and Core actions with Core winning.\n\nTenant callers read their token's tenant. Core callers select a tenant with `tenantId`; without it only Core\ncatalogs are returned.\n","parameters":[{"$ref":"#/components/parameters/TenantId"}],"responses":{"200":{"description":"Catalogs ordered by application; an empty array means none are registered.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AuditActionCatalog"}}}}},"400":{"$ref":"#/components/responses/AuditBadRequest"},"401":{"$ref":"#/components/responses/AuditUnauthorized"},"403":{"$ref":"#/components/responses/AuditForbidden"},"503":{"$ref":"#/components/responses/AuditCatalogUnavailable"}}}},"/audit/v1/events":{"get":{"tags":["Audit events"],"summary":"List events across every namespace in the caller's tenant, newest first.","description":"Requires the `audit-reader` role, held in the tenant or as a Core role. Returns only the resolved tenant's\nevents and accepts the same filters as the namespace listing. Actor `name` and `email` are included as\nrecorded. Tenant callers read their token's tenant. Core callers must select a tenant with `tenantId`; without it the\nrequest responds 403.\n","parameters":[{"$ref":"#/components/parameters/TenantId"},{"$ref":"#/components/parameters/Top"},{"$ref":"#/components/parameters/After"},{"$ref":"#/components/parameters/Actor"},{"$ref":"#/components/parameters/ResourceType"},{"$ref":"#/components/parameters/ResourceId"},{"$ref":"#/components/parameters/Action"},{"$ref":"#/components/parameters/Status"},{"$ref":"#/components/parameters/Category"},{"$ref":"#/components/parameters/Severity"},{"$ref":"#/components/parameters/CorrelationId"},{"$ref":"#/components/parameters/SessionId"},{"$ref":"#/components/parameters/Scope"},{"$ref":"#/components/parameters/OccurredFrom"},{"$ref":"#/components/parameters/OccurredTo"}],"responses":{"200":{"$ref":"#/components/responses/AuditEventPage"},"400":{"$ref":"#/components/responses/AuditBadRequest"},"401":{"$ref":"#/components/responses/AuditUnauthorized"},"403":{"$ref":"#/components/responses/AuditForbidden"},"503":{"$ref":"#/components/responses/AuditStorageUnavailable"}}}},"/audit/v1/events/export":{"get":{"tags":["Audit events"],"summary":"Export events across every namespace in the caller's tenant as CSV, newest first.","description":"Requires the `audit-reader` role, held in the tenant or as a Core role. Tenant callers read their token's tenant. Core callers must select a tenant with `tenantId`; without it the\nrequest responds 403.\n\nAccepts the same filters as the event listing (`top` and `after` are ignored)\nand streams every matching event as CSV, so the export is not capped and is not held in memory.\nCancelling the request stops the export. Actor `name` and `email` columns are present only when the\ncaller also holds `audit-admin`; for other callers the columns are omitted. Values that a spreadsheet\ncould read as a formula are prefixed with a single quote. The export is recorded as a `data-access`\naudit event with the number of events written.\n","parameters":[{"$ref":"#/components/parameters/TenantId"},{"$ref":"#/components/parameters/Actor"},{"$ref":"#/components/parameters/ResourceType"},{"$ref":"#/components/parameters/ResourceId"},{"$ref":"#/components/parameters/Action"},{"$ref":"#/components/parameters/Status"},{"$ref":"#/components/parameters/Category"},{"$ref":"#/components/parameters/Severity"},{"$ref":"#/components/parameters/CorrelationId"},{"$ref":"#/components/parameters/SessionId"},{"$ref":"#/components/parameters/Scope"},{"$ref":"#/components/parameters/OccurredFrom"},{"$ref":"#/components/parameters/OccurredTo"}],"responses":{"200":{"$ref":"#/components/responses/AuditEventCsv"},"400":{"$ref":"#/components/responses/AuditBadRequest"},"401":{"$ref":"#/components/responses/AuditUnauthorized"},"403":{"$ref":"#/components/responses/AuditForbidden"},"503":{"$ref":"#/components/responses/AuditStorageUnavailable"}}}},"/audit/v1/failed-events":{"get":{"tags":["Failed audit events"],"summary":"List parked audit events in the resolved tenant.","description":"Requires the `audit-admin` role, held in the tenant or as a Core role; `audit-reader` is not enough.\nIncludes open, replayed and discarded rows, ordered by failed_at descending and id descending.\nTenant callers read their token's tenant and cannot select another tenant. Core administrators must\nselect a tenant with `tenantId`; without it the request responds 400.\n\nReads persisted PostgreSQL rows. Paging uses a keyset cursor, so new failures parked while paging do not\nshift later pages.\n","parameters":[{"$ref":"#/components/parameters/FailedEventsTenant"},{"in":"query","name":"top","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"in":"query","name":"after","description":"Opaque keyset cursor (failed_at, id) returned as page.next. Stable while new failures are parked.","schema":{"type":"string","minLength":1,"maxLength":256},"example":"eyJ0IjoiMjAyNi0xMS0wMlQxODowNDoxMS4wMDBaIiwiaSI6IjNmMWMyYTllLTdiNGQtNGU4YS05YzIxLTVkNmU3ZjhhOWIwYyJ9"}],"responses":{"200":{"description":"Tenant-scoped page. A full page can have a next cursor even if the following page is empty.","content":{"application/json":{"schema":{"type":"object","required":["results","page"],"properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/FailedAuditEvent"}},"page":{"type":"object","required":["size"],"properties":{"after":{"type":"string","description":"Supplied cursor; omitted on the first page."},"size":{"type":"integer"},"next":{"type":"string"}}}},"example":{"results":[{"id":"3f1c2a9e-7b4d-4e8a-9c21-5d6e7f8a9b0c","tenant_id":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","namespace":"case-service","event_id":"0b9f6a8e-5d8c-4f6f-9a52-7c2d1f0e4b11","event":{"eventId":"0b9f6a8e-5d8c-4f6f-9a52-7c2d1f0e4b11","occurredAt":"2026-11-02T18:04:10.000Z","action":"case.update","status":"success","actor":{"id":"test.user@gov.ab.ca","type":"user"},"resource":{"type":"case","id":"case-001"}},"error":"Audit database write timed out.","attempts":3,"failed_at":"2026-11-02T18:04:11.000Z","status":"open","replayed_as":null}],"page":{"size":1}}}}}},"400":{"$ref":"#/components/responses/AuditBadRequest"},"401":{"$ref":"#/components/responses/AuditUnauthorized"},"403":{"$ref":"#/components/responses/AuditForbidden"},"503":{"$ref":"#/components/responses/FailedEventsUnavailable"}}}},"/audit/v1/failed-events/{id}/replay":{"post":{"tags":["Failed audit events"],"summary":"Replay an open parked event.","description":"Requires the `audit-admin` role, held in the tenant or as a Core role. Tenant callers replay in their\ntoken's tenant. Core administrators must select a tenant with `tenantId`; without it the request responds\n400. An ID from another tenant responds 404.\n\nNo request body is used; the stored input is the source of the original actor and namespace. The Audit\nService is written_by on the recovered audit row, and replayed_as links to that row's id (not its event_id).\n\nPostgreSQL uses a tenant-scoped row lock and one transaction for\nthe recovered row, status/link update and self-audit in namespace audit-service.\nClosed rows return 409, including a second concurrent replay after the first commits.\nA failure rolls back all three writes. Replay validates the stored input against the\ncurrent action catalog and retention settings, without ingestion's seven-day age limit.\n\nIf the same tenant, namespace and event_id already exist, replay links to that row\nwithout changing it. The operation is recorded as failed-event.replay.succeeded.\nStartup registers its definition through the SDK into actions-audit-service.\nA missing or incompatible registered replay action returns 503 and rolls back the replay.\n","parameters":[{"$ref":"#/components/parameters/FailedEventsTenant"},{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"},"example":"3f1c2a9e-7b4d-4e8a-9c21-5d6e7f8a9b0c"}],"responses":{"200":{"description":"Replay transaction committed; the failed row now has status replayed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FailedAuditEvent"}}}},"400":{"description":"Invalid UUID, invalid or missing tenant context, or a stored event that fails validation; the failed row remains open.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditError"},"example":{"errorMessage":"Stored event cannot be replayed (unknown_action). Check its action catalog and payload."}}}},"401":{"$ref":"#/components/responses/AuditUnauthorized"},"403":{"$ref":"#/components/responses/AuditForbidden"},"404":{"description":"No failed event with this ID in the resolved tenant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditError"},"example":{"errorMessage":"failed audit event with ID '3f1c2a9e-7b4d-4e8a-9c21-5d6e7f8a9b0c' could not be found."}}}},"409":{"description":"The event has already been replayed or discarded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditError"},"example":{"errorMessage":"Only open failed events can be replayed."}}}},"503":{"$ref":"#/components/responses/FailedEventsUnavailable"}}}},"/audit/v1/namespaces":{"get":{"tags":["Audit events"],"summary":"List the namespaces that have audit events in the caller's tenant.","description":"Requires the `audit-reader` role, held in the tenant or as a Core role. Returns every namespace the tenant\nhas recorded events for, whether or not an action catalog is visible to the tenant (for example core,\nplatform-level catalogs). Use it to populate a namespace picker. Tenant callers read their token's tenant. Core callers must select a tenant with `tenantId`; without it the\nrequest responds 403.\n","parameters":[{"$ref":"#/components/parameters/TenantId"}],"responses":{"200":{"description":"Namespaces, alphabetical.","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"string"}}},"example":{"results":["case-service","mcp-gateway-service"]}}}}},"400":{"$ref":"#/components/responses/AuditBadRequest"},"401":{"$ref":"#/components/responses/AuditUnauthorized"},"403":{"$ref":"#/components/responses/AuditForbidden"},"503":{"$ref":"#/components/responses/AuditStorageUnavailable"}}}},"/audit/v1/retention":{"get":{"tags":["Retention"],"summary":"Get the configured retention periods for the caller's tenant.","description":"Requires the `audit-reader` role, held in the tenant or as a Core role. Returns the retention periods as the\nservice applies them at write time: the active configuration revision (falling back to the latest), with Core\nsettings merged. Only configured periods are returned, not the built-in defaults. Application entries are\nincluded for registered action catalogs that override at least one class. Precedence is built-in defaults,\nthen `tenant`, then the application entry.\n\nTenant callers read their token's tenant. Core callers select a tenant with `tenantId`; without it both\nproperties are empty.\n","parameters":[{"$ref":"#/components/parameters/TenantId"}],"responses":{"200":{"description":"Configured retention periods.","content":{"application/json":{"schema":{"type":"object","required":["tenant","applications"],"properties":{"tenant":{"$ref":"#/components/schemas/RetentionClasses"},"applications":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/RetentionClasses"}}},"example":{"tenant":{"standard":{"days":120}},"applications":{"case-service":{"compliance":{"days":730}}}}}}}},"400":{"$ref":"#/components/responses/AuditBadRequest"},"401":{"$ref":"#/components/responses/AuditUnauthorized"},"403":{"$ref":"#/components/responses/AuditForbidden"},"503":{"description":"Retention settings could not be resolved or are out of bounds. Retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditError"},"example":{"errorMessage":"Audit retention settings are temporarily unavailable."}}}}}}},"/audit/v1/{namespace}/actions":{"get":{"tags":["Action catalogs"],"summary":"List a namespace's action definitions.","description":"Requires the `audit-reader` role, held in the tenant or as a Core role. Returns a JSON array of action\ndefinitions from the caller's tenant merged with Core, with Core winning on duplicate action names.\nThe namespace is the application identifier in audit-service:actions-<application>.\nThis endpoint does not require ownership of the namespace.\n\nTenant callers read their token's tenant. Core callers select a tenant with `tenantId`; without it only the\nCore catalog is read.\n","parameters":[{"$ref":"#/components/parameters/AuditNamespace"},{"$ref":"#/components/parameters/TenantId"}],"responses":{"200":{"description":"Resolved definitions; an empty array means the catalog is registered but empty.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AuditAction"}}}}},"400":{"$ref":"#/components/responses/AuditBadRequest"},"401":{"$ref":"#/components/responses/AuditUnauthorized"},"403":{"$ref":"#/components/responses/AuditForbidden"},"404":{"description":"No action catalog is registered for this namespace (neither Core nor the tenant supplied one). Register the namespace's actions in the audit-service configuration (actions-<application>) and retry. Configuration HTTP or converter failures handled by the SDK can also produce this response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditError"},"example":{"errorMessage":"action catalog with ID 'case-service' could not be found."}}}},"503":{"$ref":"#/components/responses/AuditCatalogUnavailable"}}},"post":{"tags":["Action catalogs"],"summary":"Add an action to the caller's tenant catalog for a namespace.","description":"Requires the `audit-admin` role, held in the tenant or as a Core role. The caller's token is forwarded to the\nconfiguration service, so configuration write permission is also required; without it the request responds\n401. The action is added to the tenant's actions-<namespace> catalog, which is created if missing.\n\nTenant callers add to their token's tenant. Core callers must select a tenant with `tenantId`; without it the\nrequest responds 400.\n\nThe name is compared in full and case-insensitively with the namespace's own catalog in fresh configuration,\nnot the cache: 409 when it already exists there or when the namespace is a Core namespace. Names in other\nnamespaces, including Core ones, are not conflicts.\n","parameters":[{"$ref":"#/components/parameters/AuditNamespace"},{"$ref":"#/components/parameters/TenantId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditAction"},"example":{"name":"case.update","version":1,"category":"administrative","severity":"info","retentionClass":"compliance","description":"A case worker updated a case.","resourceType":"case","captureChangeSet":true}}}},"responses":{"201":{"description":"The action was added. The response echoes the added definition.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditAction"}}}},"400":{"$ref":"#/components/responses/AuditBadRequest"},"401":{"description":"Missing or invalid bearer token (plain-text `Unauthorized` body), or the caller lacks permission to change configuration (JSON body).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditError"},"example":{"errorMessage":"Writing the action catalog requires permission to change configuration."}}}},"403":{"$ref":"#/components/responses/AuditForbidden"},"409":{"description":"The action name exists in the namespace's own catalog, or the namespace is a Core namespace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditError"},"example":{"errorMessage":"Action \"case.update\" already exists in the case-service catalog."}}}},"503":{"$ref":"#/components/responses/AuditCatalogUnavailable"}}}},"/audit/v1/{namespace}/events":{"get":{"tags":["Audit events"],"summary":"List events in a namespace for the caller's tenant, newest first.","description":"Requires the `audit-reader` role, held in the tenant or as a Core role. Any reader in the tenant may read any\nnamespace; ownership is not required for reads. Tenant callers read their token's tenant. Core callers must select a tenant with `tenantId`; without it the\nrequest responds 403.\n\nFilters combine with AND; time bounds are inclusive. Paginate with `top` and `after`. Repeating a query\nparameter responds 400.\n\nResponses include `actor.name` and `actor.email` as recorded by the writer, and `audit-reader` callers\nreceive them. The CSV exports omit name and email unless the caller also holds `audit-admin`.\n`retentionUntil` is fixed when the event is written. Successful reads are recorded as audit events in the\n`audit-service` namespace.\n","parameters":[{"$ref":"#/components/parameters/AuditNamespace"},{"$ref":"#/components/parameters/TenantId"},{"$ref":"#/components/parameters/Top"},{"$ref":"#/components/parameters/After"},{"$ref":"#/components/parameters/Actor"},{"$ref":"#/components/parameters/ResourceType"},{"$ref":"#/components/parameters/ResourceId"},{"$ref":"#/components/parameters/Action"},{"$ref":"#/components/parameters/Status"},{"$ref":"#/components/parameters/Category"},{"$ref":"#/components/parameters/Severity"},{"$ref":"#/components/parameters/CorrelationId"},{"$ref":"#/components/parameters/SessionId"},{"$ref":"#/components/parameters/Scope"},{"$ref":"#/components/parameters/OccurredFrom"},{"$ref":"#/components/parameters/OccurredTo"}],"responses":{"200":{"$ref":"#/components/responses/AuditEventPage"},"400":{"$ref":"#/components/responses/AuditBadRequest"},"401":{"$ref":"#/components/responses/AuditUnauthorized"},"403":{"$ref":"#/components/responses/AuditForbidden"},"503":{"$ref":"#/components/responses/AuditStorageUnavailable"}}},"post":{"tags":["Audit events"],"summary":"Validate and submit a batch of audit events.","description":"**A `202` does not mean every event was stored.** The body reports a per-event outcome:\n`accepted`, `duplicates` and `rejected`. Always inspect `rejected`; rejected events are\nnot stored and are never retried by the service, so the caller must correct and resend them.\n\n**Role:** requires the `audit-writer` role, held in the tenant or as a Core role.\n\n**Namespace ownership:** the verified token's `azp` must be a service URN. A non-Core caller may\nwrite only to the namespace equal to that service's name, and only for its own tenant; any other\nnamespace returns `403`. Core service accounts with `audit-writer` are exempt from the namespace\ncheck, may select any namespace, and must provide `tenantId`. Grant the writer role only to\nauthorized service accounts; the platform Core check does not distinguish service accounts from human users.\n\n**Limits:** 1 to 500 events per request; `metadata` and `changeSet` are each limited to 16 KiB.\n`eventId` must be a UUID. `occurredAt` must be no more than 7 days in the past and no more than\n5 minutes in the future.\n\n**Server-set fields:** `tenantId`, `writtenBy`, `namespace`, `receivedAt`, `category`, `severity`\nand `retentionClass` are set by the service from the verified token, the path, the clock and the\nregistered action. If supplied in an event they are ignored.\n\nMalformed envelopes fail the request; invalid events are rejected individually.\nMetadata and changeSet each have a 16 KiB UTF-8 JSON limit, including JSON syntax.\nThe complete request body is limited to 20 MiB. Server-owned row fields are\nalways derived from the verified caller, path, clock and resolved action/policy;\nadditional event fields are not copied into trusted row columns.\n\nEach pod buffers at most 1,000 events and 8 MiB of serialized enriched events,\nincluding retained original input. A batch that cannot fit in an empty buffer\nreturns 413 without storing any events; split it into smaller requests.\nTemporary buffer pressure returns 503 with Retry-After instead.\n\n**Rate limit:** writes are limited per tenant and namespace, counted in events rather\nthan requests (one request of 500 events uses 500 units). The platform default is\n500 events per second with a 500-event burst, per pod. A request over the limit\nreturns 429 with Retry-After and none of its events are stored. 429 means this\nwriter is sending too much; 503 means the service cannot keep up with all writers.\nAdmitted events consume allowance even if storage later fails; retries remain\nrate limited during outages. Core defaults and tenant overrides are capped at\n500 events per second per tenant and namespace, per pod.\n\nConfiguration uses the SDK's existing error handling: HTTP and conversion\nfailures can resolve to null. Such failures cannot reliably be distinguished\nfrom missing documents and may produce unknown-action rejections, partial\ncatalogs or fallback retention periods. Only errors that propagate reach\nthe endpoint's 503 handling.\n\nA 202 waits for the submitter to commit valid events or durably park storage\nfailures in PostgreSQL. Duplicate eventId values within the same tenant and\nnamespace do not overwrite existing events. If neither event nor failed-event\nstorage succeeds, the request returns 503. Requests with only validation\nrejections can return 202 without storage.\n","parameters":[{"$ref":"#/components/parameters/AuditNamespace"},{"in":"query","name":"tenantId","description":"Tenant URN, for example urn:ads:platform:tenant-service:v2:/tenants/case-team. Required for Core writers (400 without it); leave empty as a tenant caller, who cannot select a different tenant.","schema":{"type":"string"},"example":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["events"],"properties":{"events":{"type":"array","minItems":1,"maxItems":500,"items":{"$ref":"#/components/schemas/AuditEventInput"}}}},"example":{"events":[{"eventId":"0b9f6a8e-5d8c-4f6f-9a52-7c2d1f0e4b11","occurredAt":"2026-11-02T18:04:10.000Z","action":"case.update.succeeded","actionVersion":1,"status":"success","actor":{"id":"test.user@gov.ab.ca","type":"user","name":"Test User","email":"test.user@gov.ab.ca","roles":["case-worker"]},"resource":{"type":"case","id":"case-001","name":"Case 001"},"correlationId":"7d3e1f2a-4b5c-4d6e-8f9a-0b1c2d3e4f5a","metadata":{"reason":"Address updated"},"changeSet":{"before":{"state":"draft"},"after":{"state":"submitted"}}}]}}}},"responses":{"202":{"description":"The request was processed, **not** necessarily stored in full. Every input is accepted, a duplicate,\nor rejected; accepted + duplicates + rejected.length equals the input count. Check `rejected`:\nrejected events are not stored and are not resent. Correct them and submit again.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditWriteResponse"},"example":{"accepted":1,"duplicates":0,"rejected":[{"index":1,"eventId":"0b9f6a8e-5d8c-4f6f-9a52-7c2d1f0e4b11","code":"unknown_action","reason":"Action 'case.remove.failed' is not registered."}]}}}},"400":{"description":"Malformed JSON or envelope (for example no events or more than 500), invalid namespace or tenant ID, or missing Core tenant context. Fix the request; do not retry unchanged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditError"},"example":{"errorMessage":"Validation failed with error(s): events (body) - events must be an array containing 1 to 500 events."}}}},"401":{"$ref":"#/components/responses/AuditUnauthorized"},"403":{"description":"Either the caller lacks the `audit-writer` role (have it granted to the service account), or the\nnamespace is not the caller's: a non-Core caller can write only to its own service's namespace and\ntenant. A token whose `azp` is not a service URN is also refused.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditError"},"example":{"errorMessage":"User Case service (ID: 5c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f) not permitted to write audit events in another namespace."}}}},"413":{"description":"Request body exceeds 20 MiB, or the enriched batch exceeds the 8 MiB buffer capacity. Split the batch; retrying it unchanged will not help.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditError"},"example":{"errorMessage":"Audit request exceeds the 20 MB body limit."}}}},"429":{"description":"The tenant and namespace exceeded the write rate limit. No events in the request were stored; resend the whole request after Retry-After.","headers":{"Retry-After":{"description":"Seconds until enough allowance has accumulated for this request, assuming no competing writes for the same tenant and namespace.","schema":{"type":"integer","example":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditError"},"example":{"errorMessage":"Audit write rate limit exceeded for this tenant and namespace. Retry after the Retry-After delay."}}}},"503":{"description":"Configuration, retention policy or durable storage is unavailable, or the buffer is temporarily full; retry without re-registering actions.","headers":{"Retry-After":{"description":"Minimum suggested retry delay in seconds.","schema":{"type":"integer","example":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditError"},"example":{"errorMessage":"Audit buffer is at capacity."}}}}}}},"/audit/v1/{namespace}/events/export":{"get":{"tags":["Audit events"],"summary":"Export one namespace's events as CSV, newest first.","description":"Requires the `audit-reader` role, held in the tenant or as a Core role. Behaves as the export across all\nnamespaces, limited to the namespace. Tenant callers read their token's tenant. Core callers must select a tenant with `tenantId`; without it the\nrequest responds 403.\n","parameters":[{"$ref":"#/components/parameters/AuditNamespace"},{"$ref":"#/components/parameters/TenantId"},{"$ref":"#/components/parameters/Actor"},{"$ref":"#/components/parameters/ResourceType"},{"$ref":"#/components/parameters/ResourceId"},{"$ref":"#/components/parameters/Action"},{"$ref":"#/components/parameters/Status"},{"$ref":"#/components/parameters/Category"},{"$ref":"#/components/parameters/Severity"},{"$ref":"#/components/parameters/CorrelationId"},{"$ref":"#/components/parameters/SessionId"},{"$ref":"#/components/parameters/Scope"},{"$ref":"#/components/parameters/OccurredFrom"},{"$ref":"#/components/parameters/OccurredTo"}],"responses":{"200":{"$ref":"#/components/responses/AuditEventCsv"},"400":{"$ref":"#/components/responses/AuditBadRequest"},"401":{"$ref":"#/components/responses/AuditUnauthorized"},"403":{"$ref":"#/components/responses/AuditForbidden"},"503":{"$ref":"#/components/responses/AuditStorageUnavailable"}}}},"/audit/v1/{namespace}/events/{id}":{"get":{"tags":["Audit events"],"summary":"Read one event by its service-generated id.","description":"Requires the `audit-reader` role, held in the tenant or as a Core role. Use the service-generated `id` of a\nlisted event, not the writer's `eventId`. An id belonging to another tenant returns 404. Actor `name` and\n`email` are included as recorded. Tenant callers read their token's tenant. Core callers must select a tenant with `tenantId`; without it the\nrequest responds 403.\n","parameters":[{"$ref":"#/components/parameters/AuditNamespace"},{"$ref":"#/components/parameters/TenantId"},{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The event.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditEvent"}}}},"400":{"$ref":"#/components/responses/AuditBadRequest"},"401":{"$ref":"#/components/responses/AuditUnauthorized"},"403":{"$ref":"#/components/responses/AuditForbidden"},"404":{"description":"Event not found in the caller's tenant and namespace. IDs from another tenant also respond 404.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditError"},"example":{"errorMessage":"audit event with ID '9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d' could not be found."}}}},"503":{"$ref":"#/components/responses/AuditStorageUnavailable"}}}}},"components":{"securitySchemes":{"accessToken":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"parameters":{"Action":{"in":"query","name":"action","schema":{"type":"string","minLength":1,"maxLength":256},"example":"case.update.succeeded"},"Actor":{"in":"query","name":"actor","description":"Actor id.","schema":{"type":"string","minLength":1,"maxLength":256},"example":"test.user@gov.ab.ca"},"After":{"in":"query","name":"after","description":"Opaque keyset cursor from page.next of the previous response. Stable while new events arrive. An invalid cursor returns 400.","schema":{"type":"string"},"example":"eyJ0IjoiMjAyNi0xMS0wMlQxODowNDoxMS4wMDBaIiwiaSI6IjNmMWMyYTllLTdiNGQtNGU4YS05YzIxLTVkNmU3ZjhhOWIwYyJ9"},"AuditNamespace":{"in":"path","name":"namespace","required":true,"description":"Audit namespace, the application name of the writing service (for example `case-service`).","schema":{"type":"string","minLength":1,"maxLength":40,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"example":"case-service"},"Category":{"in":"query","name":"category","schema":{"type":"string","enum":["administrative","runtime","security","data-access","diagnostic"]}},"CorrelationId":{"in":"query","name":"correlationId","schema":{"type":"string","minLength":1}},"FailedEventsTenant":{"in":"query","name":"tenantId","description":"Tenant URN, for example urn:ads:platform:tenant-service:v2:/tenants/case-team. Required for Core administrators; leave empty as a tenant caller, who cannot select another tenant.","schema":{"type":"string"},"example":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7"},"OccurredFrom":{"in":"query","name":"occurredFrom","description":"Inclusive lower bound, as an ISO 8601 date or date-time.","schema":{"type":"string","format":"date-time"},"example":"2026-11-01T00:00:00Z"},"OccurredTo":{"in":"query","name":"occurredTo","description":"Inclusive upper bound. Must not be before occurredFrom.","schema":{"type":"string","format":"date-time"}},"ResourceId":{"in":"query","name":"resourceId","schema":{"type":"string","minLength":1,"maxLength":256},"example":"case-001"},"ResourceType":{"in":"query","name":"resourceType","schema":{"type":"string","minLength":1,"maxLength":256},"example":"case"},"Scope":{"in":"query","name":"scope","description":"Matches events whose scopeIds contain this value.","schema":{"type":"string","minLength":1,"maxLength":256}},"SessionId":{"in":"query","name":"sessionId","schema":{"type":"string","minLength":1,"maxLength":128}},"Severity":{"in":"query","name":"severity","schema":{"type":"string","enum":["info","warning","critical"]}},"Status":{"in":"query","name":"status","schema":{"type":"string","enum":["success","failure","blocked","error"]}},"TenantId":{"in":"query","name":"tenantId","description":"Tenant URN, for example urn:ads:platform:tenant-service:v2:/tenants/case-team. Selects the tenant for Core callers. Leave empty as a tenant caller, who always acts on the token's tenant; supplying any other tenant returns 403. A value that is not a tenant URN returns 400.","schema":{"type":"string"},"example":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7"},"Top":{"in":"query","name":"top","schema":{"type":"integer","minimum":1,"maximum":5000,"default":10}}},"responses":{"AuditBadRequest":{"description":"The request is invalid: a path or query parameter failed validation, `tenantId` is not a tenant URN, or a required tenant context is missing. Fix the request; do not retry unchanged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditError"},"example":{"errorMessage":"Validation failed with error(s): namespace (params) - Invalid value"}}}},"AuditCatalogUnavailable":{"description":"Action catalogs could not be read or checked. Retry; do not re-register actions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditError"},"example":{"errorMessage":"Action catalog is temporarily unavailable. Retry the request; do not re-register actions."}}}},"AuditEventCsv":{"description":"The matching events as CSV, with one header row.","headers":{"Content-Disposition":{"schema":{"type":"string"},"description":"Attachment with a dated `audit-events-YYYY-MM-DD.csv` filename."}},"content":{"text/csv":{"schema":{"type":"string"},"example":"id,eventId,occurredAt,namespace,action,category,severity,status,actorId,actorType,resourceType,resourceId,resourceName,scope,correlationId,sessionId,retentionClass,retentionUntil,changeSet,metadata\n9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d,0b9f6a8e-5d8c-4f6f-9a52-7c2d1f0e4b11,2026-11-02T18:04:10.000Z,case-service,case.update.succeeded,administrative,info,success,test.user@gov.ab.ca,user,case,case-001,Case 001,,,,compliance,2027-11-02T18:04:10.000Z,,\"{\"\"reason\"\":\"\"Address updated\"\"}\"\n"}}},"AuditEventPage":{"description":"A page of events, newest first by occurredAt.","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/AuditEvent"}},"page":{"type":"object","properties":{"after":{"type":"string"},"size":{"type":"integer"},"next":{"type":"string","description":"Present when more results may exist."}}}},"example":{"results":[{"id":"9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d","eventId":"0b9f6a8e-5d8c-4f6f-9a52-7c2d1f0e4b11","namespace":"case-service","writtenBy":"urn:ads:case-team:case-service","occurredAt":"2026-11-02T18:04:10.000Z","receivedAt":"2026-11-02T18:04:10.412Z","action":"case.update.succeeded","actionVersion":1,"category":"administrative","status":"success","severity":"info","actor":{"id":"test.user@gov.ab.ca","type":"user","name":"Test User","email":"test.user@gov.ab.ca","roles":["case-worker"]},"resource":{"type":"case","id":"case-001","name":"Case 001"},"scopeIds":[],"metadata":{"reason":"Address updated"},"retentionClass":"compliance","retentionUntil":"2027-11-02T18:04:10.000Z"}],"page":{"size":1,"next":"eyJ0IjoiMjAyNi0xMS0wMlQxODowNDoxMC4wMDBaIiwiaSI6IjlhOGI3YzZkLTVlNGYtNGEzYi04YzJkLTFlMGY5YThiN2M2ZCJ9"}}}}}},"AuditForbidden":{"description":"The caller lacks the role the operation requires, or a tenant caller set `tenantId` to another tenant. Have the role granted to the caller; provisioning a role in the realm does not assign it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditError"},"example":{"errorMessage":"User Case reader (ID: 4f9e2d1c-8a7b-4c6d-9e5f-1a2b3c4d5e6f) not permitted to access audit data requiring audit-reader."}}}},"AuditStorageUnavailable":{"description":"Audit event storage is unavailable. Retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditError"},"example":{"errorMessage":"Audit event storage is unavailable. Retry the request."}}}},"AuditUnauthorized":{"description":"Missing or invalid bearer token. Obtain a valid token and retry.","content":{"text/plain":{"schema":{"type":"string"},"example":"Unauthorized"}}},"FailedEventsUnavailable":{"description":"Database, action configuration or transactional self-auditing is unavailable; retry.","headers":{"Retry-After":{"schema":{"type":"integer","example":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditError"},"example":{"errorMessage":"Failed-event storage is temporarily unavailable."}}}}},"schemas":{"AuditAction":{"type":"object","required":["name","version","category","severity"],"properties":{"name":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[a-zA-Z0-9]+(?:[._:-][a-zA-Z0-9]+)*$","description":"Base action name, without a terminal `.succeeded` or `.failed` suffix.","example":"case.update"},"version":{"type":"integer","minimum":1},"category":{"type":"string","enum":["administrative","runtime","security","data-access","diagnostic"]},"severity":{"type":"string","enum":["info","warning","critical"]},"retentionClass":{"type":"string","pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$","description":"Named retention class; custom classes are allowed. Never a duration. Optional: when omitted, the class is derived from the category (administrative and data-access: compliance, security: security, runtime and diagnostic: standard). A class set on the action overrides the category default."},"description":{"type":"string","minLength":1},"resourceType":{"type":"string","minLength":1},"captureChangeSet":{"type":"boolean","default":false},"forwardToSiem":{"type":"boolean","default":false},"metadataSchema":{"type":"object","additionalProperties":true,"description":"Optional JSON Schema draft-07 for metadata; omitted means no action-specific metadata constraint."}},"example":{"name":"case.update","version":1,"category":"administrative","severity":"info","retentionClass":"compliance","description":"A case worker updated a case.","resourceType":"case","captureChangeSet":true,"forwardToSiem":false}},"AuditActionCatalog":{"type":"object","required":["application","core","actions"],"properties":{"application":{"type":"string","example":"case-service"},"core":{"type":"boolean","description":"True when Core registers a catalog for the application, so its actions are not tenant-managed."},"actions":{"type":"array","items":{"$ref":"#/components/schemas/AuditAction"}}},"example":{"application":"case-service","core":false,"actions":[{"name":"case.update","version":1,"category":"administrative","severity":"info","retentionClass":"compliance","resourceType":"case","captureChangeSet":true,"forwardToSiem":false}]}},"AuditError":{"type":"object","required":["errorMessage"],"properties":{"errorMessage":{"type":"string"}},"example":{"errorMessage":"Validation failed with error(s): top (query) - Invalid value"}},"AuditEvent":{"type":"object","description":"A stored event. tenant_id is never returned.","properties":{"id":{"type":"string","format":"uuid"},"eventId":{"type":"string","format":"uuid"},"namespace":{"type":"string"},"writtenBy":{"type":"string"},"occurredAt":{"type":"string","format":"date-time"},"receivedAt":{"type":"string","format":"date-time"},"action":{"type":"string"},"actionVersion":{"type":"integer"},"category":{"type":"string"},"status":{"type":"string"},"severity":{"type":"string"},"actor":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"roles":{"type":"array","items":{"type":"string"}}}},"resource":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"}}},"scopeIds":{"type":"array","items":{"type":"string"}},"correlationId":{"type":"string"},"sessionId":{"type":"string"},"changeSet":{"type":"object","properties":{"before":{"type":"object","nullable":true},"after":{"type":"object","nullable":true}}},"metadata":{"type":"object"},"retentionClass":{"type":"string"},"retentionUntil":{"type":"string","format":"date-time"}},"example":{"id":"9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d","eventId":"0b9f6a8e-5d8c-4f6f-9a52-7c2d1f0e4b11","namespace":"case-service","writtenBy":"urn:ads:case-team:case-service","occurredAt":"2026-11-02T18:04:10.000Z","receivedAt":"2026-11-02T18:04:10.412Z","action":"case.update.succeeded","actionVersion":1,"category":"administrative","status":"success","severity":"info","actor":{"id":"test.user@gov.ab.ca","type":"user","name":"Test User","email":"test.user@gov.ab.ca","roles":["case-worker"]},"resource":{"type":"case","id":"case-001","name":"Case 001"},"scopeIds":[],"metadata":{"reason":"Address updated"},"retentionClass":"compliance","retentionUntil":"2027-11-02T18:04:10.000Z"}},"AuditEventInput":{"type":"object","description":"One event to write. Server-set fields (tenantId, writtenBy, namespace, receivedAt, category, severity, retentionClass) are ignored if supplied.","required":["eventId","occurredAt","action","status","actor"],"properties":{"eventId":{"type":"string","format":"uuid","description":"Caller UUID; database uniqueness is scoped to tenant and namespace."},"occurredAt":{"type":"string","format":"date-time","description":"No more than 7 days old or 5 minutes in the future, inclusive."},"action":{"type":"string","pattern":"^[a-zA-Z0-9]+(?:[._:-][a-zA-Z0-9]+)*$","example":"case.update.succeeded","description":"Registered base action with an optional terminal .succeeded or .failed suffix."},"actionVersion":{"type":"integer","minimum":1,"description":"Omitted means the current catalog version; an explicit mismatch is rejected individually."},"status":{"type":"string","enum":["success","failure","blocked","error"]},"actor":{"type":"object","required":["id","type"],"properties":{"id":{"type":"string","minLength":1},"type":{"type":"string","enum":["user","service","system"]},"name":{"type":"string"},"email":{"type":"string"},"roles":{"type":"array","items":{"type":"string","minLength":1},"default":[]}}},"resource":{"type":"object","description":"Required if the action declares resourceType; type must match.","required":["type","id"],"properties":{"type":{"type":"string","minLength":1},"id":{"type":"string","minLength":1},"name":{"type":"string"}}},"scopeIds":{"type":"array","items":{"type":"string","minLength":1},"default":[]},"correlationId":{"type":"string","minLength":1},"sessionId":{"type":"string","maxLength":128},"metadata":{"type":"object","additionalProperties":true,"default":{},"description":"At most 16 KiB serialized UTF-8 JSON. Validated against metadataSchema without coercion or adding defaults."},"changeSet":{"type":"object","additionalProperties":false,"description":"At most 16 KiB serialized UTF-8 JSON. Shape is validated only when the\naction captures change sets; otherwise the value is dropped from row\ncolumns rather than rejected for its shape. The byte limit still applies.\n","properties":{"before":{"type":"object","nullable":true,"additionalProperties":true},"after":{"type":"object","nullable":true,"additionalProperties":true}}}}},"AuditWriteResponse":{"type":"object","required":["accepted","duplicates","rejected"],"properties":{"accepted":{"type":"integer","minimum":0},"duplicates":{"type":"integer","minimum":0},"rejected":{"type":"array","items":{"type":"object","required":["index","code","reason"],"properties":{"index":{"type":"integer","minimum":0,"description":"Zero-based index in the original request; results are sorted by index. Use it, and eventId when present, to identify which event the entry concerns."},"eventId":{"type":"string","description":"Caller-provided event identifier when available."},"code":{"type":"string","enum":["invalid_event","unknown_action","action_version_mismatch","invalid_resource","invalid_metadata","storage_failed"]},"reason":{"type":"string"}}}}}},"FailedAuditEvent":{"type":"object","required":["id","tenant_id","namespace","event_id","event","error","attempts","failed_at","status","replayed_as"],"properties":{"id":{"type":"string","format":"uuid"},"tenant_id":{"type":"string"},"namespace":{"type":"string"},"event_id":{"type":"string","format":"uuid","nullable":true},"event":{"description":"Original stored JSON input. Only audit-admin may access this potentially sensitive payload.","nullable":true},"error":{"type":"string"},"attempts":{"type":"integer"},"failed_at":{"type":"string","format":"date-time"},"status":{"type":"string","enum":["open","replayed","discarded"]},"replayed_as":{"type":"string","format":"uuid","nullable":true}},"example":{"id":"3f1c2a9e-7b4d-4e8a-9c21-5d6e7f8a9b0c","tenant_id":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7","namespace":"case-service","event_id":"0b9f6a8e-5d8c-4f6f-9a52-7c2d1f0e4b11","event":{"eventId":"0b9f6a8e-5d8c-4f6f-9a52-7c2d1f0e4b11","occurredAt":"2026-11-02T18:04:10.000Z","action":"case.update","status":"success","actor":{"id":"test.user@gov.ab.ca","type":"user"},"resource":{"type":"case","id":"case-001"}},"error":"Audit database write timed out.","attempts":3,"failed_at":"2026-11-02T18:04:11.000Z","status":"replayed","replayed_as":"9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d"}},"RetentionClasses":{"type":"object","description":"Retention class name to period.","additionalProperties":{"type":"object","required":["days"],"properties":{"days":{"type":"integer","minimum":1}}},"example":{"standard":{"days":120}}}}},"security":[{"accessToken":[]}],"tags":[{"name":"Audit events","description":"Write and read audit events. Requires audit-writer to write and audit-reader to read."},{"name":"Action catalogs","description":"Read the registered action definitions for a namespace. Requires audit-reader."},{"name":"Failed audit events","description":"List and replay events parked after a storage failure. Requires audit-admin."},{"name":"Retention","description":"Read the configured retention periods for a tenant. Requires audit-reader."}]}
@@ -0,0 +1 @@
1
+ {"openapi":"3.0.0","info":{"title":"Cache service","version":"0.0.0","description":"Cache service provides a read through http request cache."},"paths":{"/cache/v1/cache/{target}/{resource}":{"get":{"tags":["Cache"],"description":"Reads a resource from an upstream target through the cache. The response, including its status, is cached and returned on subsequent matching requests until the target's TTL expires or an invalidation event removes it. The resource path may contain several segments (for example files/{fileId}/download); the route matches everything after the target as the resource path, and the query string is forwarded to the upstream request.\n\nAccess: anonymous requests are allowed and share cache entries across anonymous users, except for the access service target (urn:ads:platform:access-service:v1), which requires a user. Requests with a bearer token require the cache-reader role in the tenant; core users with the cache-reader role are also allowed. The bearer token is passed to the upstream request and cache entries are per user context. A bearer token that fails validation is treated as an anonymous request.\n\nTenancy: tenant users act on the tenant of their token. Core users and anonymous requests set the tenant with the tenantId query parameter; without a tenant the request is rejected with 400. Targets are read from the tenant's cache-service configuration combined with platform configuration; a target not configured for the tenant responds 404.\n","parameters":[{"name":"target","description":"Service or API URN of the upstream target. Must be configured as a target for the tenant, and registered in the directory service.\n","in":"path","required":true,"schema":{"type":"string","pattern":"^urn:ads:[a-zA-Z0-9-]{1,50}:[a-zA-Z0-9-]{1,50}(?::[a-zA-Z0-9-]{1,50})?$"},"example":"urn:ads:platform:file-service:v1"},{"name":"resource","description":"Path of the resource relative to the upstream target's URL. May contain `/`; send it unencoded. For the access service target, the path must start with the tenant's realm.\n","in":"path","required":true,"schema":{"type":"string"},"example":"files/52269261-45c0-434e-9467-a888f0bcb4b7"},{"$ref":"#/components/parameters/CacheTenantId"},{"name":"Accept-Encoding","description":"Content encodings the client accepts. If set, it must include gzip or *, since cached content is returned in the encoding received from upstream.\n","in":"header","required":false,"schema":{"type":"string"},"example":"gzip, deflate, br"}],"responses":{"200":{"description":"Resource read through the cache. The status, content, and the Content-Type, Content-Encoding, Content-Length, Cache-Control, and Content-Disposition headers are those of the upstream response.\n","headers":{"adsp-cache-status":{"description":"HIT if the response was returned from cache, and MISS if it was requested from upstream.","schema":{"type":"string","enum":["HIT","MISS"]},"example":"HIT"}},"content":{"application/json":{"schema":{"type":"object","description":"Upstream response content; the shape depends on the target and resource.","example":{"id":"52269261-45c0-434e-9467-a888f0bcb4b7","filename":"application-form.pdf","size":248133,"typeName":"Application attachment","recordId":"urn:ads:my-tenant:my-service:v1:/applications/63a0d1f5e4b0c2a1d3e5f7a9","created":"2026-01-15T17:42:08.000Z","lastAccessed":"2026-01-16T09:12:44.000Z","scanned":true,"infected":false}}}}},"400":{"$ref":"#/components/responses/CacheBadRequest"},"401":{"$ref":"#/components/responses/CacheUnauthorized"},"403":{"$ref":"#/components/responses/CacheForbidden"},"404":{"$ref":"#/components/responses/CacheNotFound"},"default":{"description":"Any other status returned by the upstream target (for example 404 for a resource the upstream API doesn't have) is passed through with its content and the adsp-cache-status header. Upstream responses with a 5xx status are passed through but not cached.\n"}}}}},"components":{"securitySchemes":{"accessToken":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"parameters":{"CacheTenantId":{"name":"tenantId","description":"ID of the tenant to act on. Used by core (platform) users and by anonymous requests, which have no tenant in a token. Tenant users always act on the tenant of their token and this parameter is ignored for tenant resolution. The parameter is also forwarded to the upstream request as part of the query.\n","in":"query","required":false,"schema":{"type":"string"},"example":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7"}},"responses":{"CacheBadRequest":{"description":"Request is invalid: there is no tenant context, tenantId isn't a valid ADSP URN, the client doesn't accept gzip encoding, or the resource path isn't allowed for the target (for example a path that resolves outside the upstream API, or an access service path for a realm other than the tenant's).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheError"},"example":{"errorMessage":"Tenant context is required to read through cache."}}}},"CacheForbidden":{"description":"Request has a user context, and the user doesn't have the cache-reader role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheError"},"example":{"errorMessage":"User Test User (ID: 0f6c3b2e-5a1d-4f7e-9b8c-2d4e6f8a1b3c) not permitted to read through cache."}}}},"CacheNotFound":{"description":"The target isn't configured for the tenant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheError"},"example":{"errorMessage":"cache target with ID 'urn:ads:platform:pdf-service:v1' could not be found."}}}},"CacheUnauthorized":{"description":"Request is anonymous, and the target doesn't allow anonymous requests (the access service target).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheError"},"example":{"errorMessage":"Anonymous request through target is not allowed."}}}}},"schemas":{"CacheError":{"type":"object","properties":{"errorMessage":{"type":"string"}}}}},"security":[{"accessToken":[]}],"tags":[{"name":"Cache","description":"Read through cache for upstream services and APIs."}]}
@@ -0,0 +1 @@
1
+ {"openapi":"3.0.0","info":{"title":"Calendar service","version":"0.0.0","description":"\n\nThe _Calendar Service_ is a set of API's that gives developers a means to create and manage\ntime based events for general use in calendars.\n\n### Calendar Events\nA _calendar event_ is defined by:\n- a name,\n- a description,\n- a start time,\n- an end time,\n- an indication of whether or not it's a public event.\n- an indication of whether or not it's an all day event.\n\nEvents can also be associated with a list of attendees, with each attendee defined by\n- a name,\n- an email address\n\n### Special Dates\n\nThe service also includes an API you can use to populate a calendar with special dates, so that you can display them on your calendars.\nAny date returned by the API will indicate whether or not;\n- it's a weekend,\n- it's a holiday,\n- it's a business day,\n- it's an in-lieu day\n\nYou can retrieve the information for a specific date, or all dates between a min and a max.\n"},"paths":{"/calendar/v1/calendars":{"get":{"tags":["Calendar"],"description":"Retrieves the calendar definitions, with tenant and core definitions listed separately (including definitions with the same name). Public: no roles are required and anonymous requests are allowed. Anonymous requests, and core users without tenantId, receive only core definitions; tenant users receive their tenant's definitions and the core definitions.\n","security":[{},{"accessToken":[]}],"parameters":[{"$ref":"#/components/parameters/CalendarTenantId"}],"responses":{"200":{"description":"Calendar definitions successfully retrieved.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CalendarDefinition"}}}}},"400":{"$ref":"#/components/responses/CalendarBadRequest"},"502":{"$ref":"#/components/responses/CalendarBadGateway"}}},"post":{"tags":["Calendar"],"description":"Creates a tenant calendar definition. Requires the calendar-admin role in the tenant, or as a core user; core users must set tenantId, or the request responds 400. The name must not be used by a tenant or core calendar. Signals calendar-definition-created.\n","parameters":[{"$ref":"#/components/parameters/CalendarTenantId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarDefinitionInput"}}}},"responses":{"201":{"description":"Tenant calendar definition created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarDefinition"}}}},"400":{"$ref":"#/components/responses/CalendarBadRequest"},"401":{"$ref":"#/components/responses/CalendarUnauthorized"},"403":{"$ref":"#/components/responses/CalendarForbidden"},"409":{"$ref":"#/components/responses/CalendarConflict"},"502":{"$ref":"#/components/responses/CalendarBadGateway"}}}},"/calendar/v1/calendars/{name}":{"get":{"tags":["Calendar"],"description":"Retrieves a calendar of the tenant, including core calendars. Public: no roles are required and anonymous requests are allowed. The calendar is found in the tenant named by the tenant parameter; otherwise in the tenant of the token, or of tenantId for core users. Without a tenant context the request responds 400. When a tenant and a core calendar have the same name, the core calendar is returned.\n","security":[{},{"accessToken":[]}],"parameters":[{"$ref":"#/components/parameters/CalendarName"},{"$ref":"#/components/parameters/CalendarTenantName"},{"$ref":"#/components/parameters/CalendarTenantId"}],"responses":{"200":{"description":"Calendar successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Calendar"}}}},"400":{"$ref":"#/components/responses/CalendarBadRequest"},"404":{"$ref":"#/components/responses/CalendarNotFound"}}},"put":{"tags":["Calendar"],"description":"Replaces an existing tenant calendar definition. Core definitions are read-only and respond 404. Requires the calendar-admin role in the tenant, or as a core user; core users must set tenantId, or the request responds 400. The name in the body must match the path. Signals calendar-definition-updated.\n","parameters":[{"$ref":"#/components/parameters/CalendarDefinitionName"},{"$ref":"#/components/parameters/CalendarTenantId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarDefinitionInput"}}}},"responses":{"200":{"description":"Tenant calendar definition updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarDefinition"}}}},"400":{"$ref":"#/components/responses/CalendarBadRequest"},"401":{"$ref":"#/components/responses/CalendarUnauthorized"},"403":{"$ref":"#/components/responses/CalendarForbidden"},"404":{"$ref":"#/components/responses/CalendarNotFound"},"502":{"$ref":"#/components/responses/CalendarBadGateway"}}},"delete":{"tags":["Calendar"],"description":"Deletes an existing tenant calendar definition, only if the calendar has no events (409 otherwise). Core definitions are read-only and respond 404. Requires the calendar-admin role in the tenant, or as a core user; core users must set tenantId, or the request responds 400. Signals calendar-definition-deleted.\n","parameters":[{"$ref":"#/components/parameters/CalendarDefinitionName"},{"$ref":"#/components/parameters/CalendarTenantId"}],"responses":{"204":{"description":"Tenant calendar definition deleted."},"400":{"$ref":"#/components/responses/CalendarBadRequest"},"401":{"$ref":"#/components/responses/CalendarUnauthorized"},"403":{"$ref":"#/components/responses/CalendarForbidden"},"404":{"$ref":"#/components/responses/CalendarNotFound"},"409":{"$ref":"#/components/responses/CalendarConflict"},"502":{"$ref":"#/components/responses/CalendarBadGateway"}}}},"/calendar/v1/calendars/{name}/events":{"get":{"tags":["Calendar"],"description":"Retrieves calendar events. Public: anonymous requests are allowed. Callers with private access (the calendar-admin role, or one of the calendar's readRoles or updateRoles, held in the calendar's tenant or by a core user) receive private and public events; all other callers, including anonymous users and users of another tenant, receive only public events. Attendees are included only with includeAttendees, which requires private access. The calendar is found in the tenant named by the tenant parameter; otherwise in the tenant of the token, or of tenantId for core users. Without a tenant context the request responds 400.\n\nCalendar date/time values use the service timezone, America/Edmonton (Mountain time; MST or MDT depending on the date). When both from and to are specified, returns the complete set of events that overlap the requested range in a single response; top and after are ignored for range retrieval, but criteria can still be used to filter the results. An event overlaps the range when it occurs at least partially within it, including events that start before from or end after to. Range retrieval supports a maximum range of 366 days. Range retrieval returns each occurrence of a recurring event that overlaps the range, excluding cancelled occurrences; without from and to, recurring events are returned once and time criteria apply to their first occurrence.\n","security":[{},{"accessToken":[]}],"parameters":[{"$ref":"#/components/parameters/CalendarName"},{"$ref":"#/components/parameters/CalendarTenantName"},{"$ref":"#/components/parameters/CalendarTenantId"},{"$ref":"#/components/parameters/CalendarEventsTop"},{"$ref":"#/components/parameters/CalendarEventsAfter"},{"$ref":"#/components/parameters/CalendarIncludeAttendees"},{"name":"from","description":"ISO 8601 date/time for the start of a calendar display range. Must be specified with to. Events overlapping this range are returned without pagination.","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"example":"2026-10-01T00:00:00-06:00"},{"name":"to","description":"ISO 8601 date/time for the end of a calendar display range. Must be specified with from, must not be before from, and must be within 366 days of from.","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"example":"2026-10-31T23:59:59-06:00"},{"name":"criteria","description":"JSON criteria for the events to retrieve.","in":"query","required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEventCriteria"}}}}],"responses":{"200":{"description":"Calendar events successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEventsPage"}}}},"400":{"$ref":"#/components/responses/CalendarBadRequest"},"403":{"$ref":"#/components/responses/CalendarForbidden"},"404":{"$ref":"#/components/responses/CalendarNotFound"}}},"post":{"tags":["Calendar"],"description":"Creates a calendar event. Requires the calendar-admin role, or one of the calendar's updateRoles, held in the calendar's tenant or by a core user; other callers, including anonymous users, receive 403. The calendar is found in the tenant named by the tenant parameter; otherwise in the tenant of the token, or of tenantId for core users. Without a tenant context the request responds 400. Invalid recurrence rules respond 400. Signals calendar-event-created.\n","parameters":[{"$ref":"#/components/parameters/CalendarName"},{"$ref":"#/components/parameters/CalendarTenantName"},{"$ref":"#/components/parameters/CalendarTenantId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEventInput"},"examples":{"single":{"summary":"Create a single event","value":{"recordId":"inspection-1024","context":{"region":"north"},"name":"Site inspection","description":"Inspection of the Edmonton north facility.","start":"2026-11-17T09:00:00-07:00","end":"2026-11-17T10:30:00-07:00","isPublic":false}},"recurring":{"summary":"Create a weekly recurring event","value":{"name":"Team meeting","description":"Weekly inspection planning meeting.","start":"2026-09-29T10:00:00-06:00","end":"2026-09-29T11:00:00-06:00","isPublic":true,"recurrence":{"frequency":"weekly","daysOfWeek":["TU"],"end":{"until":"2026-12-15"}}}}}}}},"responses":{"200":{"description":"Calendar event successfully created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEvent"}}}},"400":{"$ref":"#/components/responses/CalendarBadRequest"},"403":{"$ref":"#/components/responses/CalendarForbidden"},"404":{"$ref":"#/components/responses/CalendarNotFound"}}}},"/calendar/v1/calendars/{name}/events/{id}":{"parameters":[{"$ref":"#/components/parameters/CalendarName"},{"$ref":"#/components/parameters/CalendarEventId"},{"$ref":"#/components/parameters/CalendarTenantName"},{"$ref":"#/components/parameters/CalendarTenantId"}],"get":{"tags":["Calendar"],"description":"Retrieves a calendar event. Public events are public: anonymous requests are allowed. Private events require private access (the calendar-admin role, or one of the calendar's readRoles or updateRoles, held in the calendar's tenant or by a core user); other callers receive 403. Attendees are included only with includeAttendees, which also requires private access. The calendar is found in the tenant named by the tenant parameter; otherwise in the tenant of the token, or of tenantId for core users. Without a tenant context the request responds 400. Events of other tenants or calendars respond 404.\n","security":[{},{"accessToken":[]}],"parameters":[{"$ref":"#/components/parameters/CalendarIncludeAttendees"}],"responses":{"200":{"description":"Calendar event successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEvent"}}}},"400":{"$ref":"#/components/responses/CalendarBadRequest"},"403":{"$ref":"#/components/responses/CalendarForbidden"},"404":{"$ref":"#/components/responses/CalendarNotFound"}}},"patch":{"tags":["Calendar"],"description":"Updates a calendar event with the properties in the request. For a recurring event, the update applies to all occurrences. Requires the calendar-admin role, or one of the calendar's updateRoles, held in the calendar's tenant or by a core user; other callers, including anonymous users, receive 403. The calendar is found in the tenant named by the tenant parameter; otherwise in the tenant of the token, or of tenantId for core users. Without a tenant context the request responds 400. Events of other tenants or calendars respond 404. Signals calendar-event-updated.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEventUpdate"},"examples":{"reschedule":{"summary":"Reschedule an event","value":{"start":"2026-11-18T09:00:00-07:00","end":"2026-11-18T10:30:00-07:00"}},"make-single":{"summary":"Stop a recurring event from repeating","value":{"recurrence":null}}}}}},"responses":{"200":{"description":"Calendar event successfully updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEvent"}}}},"400":{"$ref":"#/components/responses/CalendarBadRequest"},"403":{"$ref":"#/components/responses/CalendarForbidden"},"404":{"$ref":"#/components/responses/CalendarNotFound"}}},"delete":{"tags":["Calendar"],"description":"Deletes a calendar event and its attendees. For a recurring event, deletes all occurrences. Requires the calendar-admin role, or one of the calendar's updateRoles, held in the calendar's tenant or by a core user; other callers, including anonymous users, receive 403. The calendar is found in the tenant named by the tenant parameter; otherwise in the tenant of the token, or of tenantId for core users. Without a tenant context the request responds 400. Events of other tenants or calendars respond 404. Signals calendar-event-deleted.\n","responses":{"200":{"description":"Calendar event successfully deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarDeleteResult"}}}},"400":{"$ref":"#/components/responses/CalendarBadRequest"},"403":{"$ref":"#/components/responses/CalendarForbidden"},"404":{"$ref":"#/components/responses/CalendarNotFound"}}}},"/calendar/v1/calendars/{name}/events/{id}/attendees":{"parameters":[{"$ref":"#/components/parameters/CalendarName"},{"$ref":"#/components/parameters/CalendarEventId"},{"$ref":"#/components/parameters/CalendarTenantName"},{"$ref":"#/components/parameters/CalendarTenantId"}],"get":{"tags":["Calendar"],"description":"Retrieves the attendees of a calendar event. Attendees are never public, even for public events: requires private access (the calendar-admin role, or one of the calendar's readRoles or updateRoles, held in the calendar's tenant or by a core user); other callers, including anonymous users, receive 403. The calendar is found in the tenant named by the tenant parameter; otherwise in the tenant of the token, or of tenantId for core users. Without a tenant context the request responds 400.\n","responses":{"200":{"description":"Attendees successfully retrieved.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Attendee"}}}}},"400":{"$ref":"#/components/responses/CalendarBadRequest"},"403":{"$ref":"#/components/responses/CalendarForbidden"},"404":{"$ref":"#/components/responses/CalendarNotFound"}}},"post":{"tags":["Calendar"],"description":"Adds an attendee to a calendar event. Requires the calendar-admin role, or one of the calendar's updateRoles, held in the calendar's tenant or by a core user; other callers, including anonymous users, receive 403. Adding an attendee to a private event also requires read access, which updateRoles include. The calendar is found in the tenant named by the tenant parameter; otherwise in the tenant of the token, or of tenantId for core users. Without a tenant context the request responds 400. Signals calendar-event-updated.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttendeeInput"}}}},"responses":{"200":{"description":"Attendee successfully added.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Attendee"}}}},"400":{"$ref":"#/components/responses/CalendarBadRequest"},"403":{"$ref":"#/components/responses/CalendarForbidden"},"404":{"$ref":"#/components/responses/CalendarNotFound"}}}},"/calendar/v1/calendars/{name}/events/{id}/attendees/{attendeeId}":{"parameters":[{"$ref":"#/components/parameters/CalendarName"},{"$ref":"#/components/parameters/CalendarEventId"},{"$ref":"#/components/parameters/CalendarAttendeeId"},{"$ref":"#/components/parameters/CalendarTenantName"},{"$ref":"#/components/parameters/CalendarTenantId"}],"get":{"tags":["Calendar"],"description":"Retrieves an attendee of a calendar event. Attendees are never public, even for public events: requires private access (the calendar-admin role, or one of the calendar's readRoles or updateRoles, held in the calendar's tenant or by a core user); other callers, including anonymous users, receive 403. The calendar is found in the tenant named by the tenant parameter; otherwise in the tenant of the token, or of tenantId for core users. Without a tenant context the request responds 400.\n","responses":{"200":{"description":"Attendee successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Attendee"}}}},"400":{"$ref":"#/components/responses/CalendarBadRequest"},"403":{"$ref":"#/components/responses/CalendarForbidden"},"404":{"$ref":"#/components/responses/CalendarNotFound"}}},"put":{"tags":["Calendar"],"description":"Replaces the name and email of an attendee of a calendar event. Use the ID of an existing attendee of the event. Requires the calendar-admin role, or one of the calendar's updateRoles, held in the calendar's tenant or by a core user; other callers, including anonymous users, receive 403. The calendar is found in the tenant named by the tenant parameter; otherwise in the tenant of the token, or of tenantId for core users. Without a tenant context the request responds 400. Signals calendar-event-updated.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttendeeInput"}}}},"responses":{"200":{"description":"Attendee successfully updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Attendee"}}}},"400":{"$ref":"#/components/responses/CalendarBadRequest"},"403":{"$ref":"#/components/responses/CalendarForbidden"},"404":{"$ref":"#/components/responses/CalendarNotFound"}}},"delete":{"tags":["Calendar"],"description":"Removes an attendee from a calendar event. deleted is false if the event has no attendee with the ID. Requires the calendar-admin role, or one of the calendar's updateRoles, held in the calendar's tenant or by a core user; other callers, including anonymous users, receive 403. The calendar is found in the tenant named by the tenant parameter; otherwise in the tenant of the token, or of tenantId for core users. Without a tenant context the request responds 400. Signals calendar-event-updated.\n","responses":{"200":{"description":"Request completed successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarDeleteResult"}}}},"400":{"$ref":"#/components/responses/CalendarBadRequest"},"403":{"$ref":"#/components/responses/CalendarForbidden"},"404":{"$ref":"#/components/responses/CalendarNotFound"}}}},"/calendar/v1/calendars/{name}/events/{id}/occurrences/{occurrence}":{"parameters":[{"$ref":"#/components/parameters/CalendarName"},{"$ref":"#/components/parameters/CalendarEventId"},{"name":"occurrence","description":"Mountain time date of the occurrence (e.g. 2026-10-13), or its URL-encoded recurrenceId. Must be an ISO 8601 date or date/time.","in":"path","required":true,"schema":{"type":"string"},"example":"2026-10-13"},{"$ref":"#/components/parameters/CalendarTenantName"},{"$ref":"#/components/parameters/CalendarTenantId"}],"delete":{"tags":["Calendar"],"description":"Cancels one occurrence of a recurring event. The rest of the recurring event is unchanged. Cancelled occurrences cannot be restored. Requires the calendar-admin role, or one of the calendar's updateRoles, held in the calendar's tenant or by a core user; other callers, including anonymous users, receive 403. The calendar is found in the tenant named by the tenant parameter; otherwise in the tenant of the token, or of tenantId for core users. Without a tenant context the request responds 400. Signals calendar-event-updated when an occurrence is cancelled.\n","responses":{"200":{"description":"Request completed successfully. deleted is false if the occurrence was already cancelled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarDeleteResult"}}}},"400":{"$ref":"#/components/responses/CalendarBadRequest"},"403":{"$ref":"#/components/responses/CalendarForbidden"},"404":{"$ref":"#/components/responses/CalendarNotFound"}}}},"/calendar/v1/calendars/{name}/export":{"get":{"tags":["Calendar"],"description":"Exports a page of the calendar's events as an iCalendar (.ics) file. Public: anonymous requests are allowed. Callers with private access (the calendar-admin role, or one of the calendar's readRoles or updateRoles, held in the calendar's tenant or by a core user) export private and public events; all other callers, including anonymous users and users of another tenant, export only public events. Attendees are included only with includeAttendees, which requires private access. The calendar is found in the tenant named by the tenant parameter; otherwise in the tenant of the token, or of tenantId for core users. Without a tenant context the request responds 400.\n","security":[{},{"accessToken":[]}],"parameters":[{"$ref":"#/components/parameters/CalendarName"},{"$ref":"#/components/parameters/CalendarTenantName"},{"$ref":"#/components/parameters/CalendarTenantId"},{"$ref":"#/components/parameters/CalendarEventsTop"},{"$ref":"#/components/parameters/CalendarEventsAfter"},{"$ref":"#/components/parameters/CalendarIncludeAttendees"},{"name":"filename","description":"Name of the file to download. Defaults to the calendar name with the .ics extension.","in":"query","required":false,"schema":{"type":"string"},"example":"site-inspections.ics"},{"name":"criteria","description":"JSON criteria for the events to export. Must be valid JSON. activeOn is not supported for export.\n","in":"query","required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEventCriteria"}}}}],"responses":{"200":{"description":"Calendar successfully exported.","content":{"text/calendar":{"schema":{"type":"string"},"example":"BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//Government of Alberta//urn:ads:platform:calendar-service//EN\nNAME:Site inspections\nX-WR-CALNAME:Site inspections\nBEGIN:VEVENT\nUID:42\nDTSTART;TZID=America/Edmonton:20261117T090000\nDTEND;TZID=America/Edmonton:20261117T103000\nSUMMARY:Site inspection\nEND:VEVENT\nEND:VCALENDAR\n"}}},"400":{"$ref":"#/components/responses/CalendarBadRequest"},"403":{"$ref":"#/components/responses/CalendarForbidden"},"404":{"$ref":"#/components/responses/CalendarNotFound"}}}},"/calendar/v1/dates":{"get":{"tags":["Dates"],"description":"Retrieves calendar dates in ascending order, with information about weekends, holidays, and business days in Alberta. Public: no roles are required and anonymous requests are allowed. Dates are platform data and the same for every tenant, so no tenant context is used.\n","security":[{},{"accessToken":[]}],"parameters":[{"name":"top","description":"Number of dates to return in a page. Must be a positive integer.","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":10},"example":50},{"name":"after","description":"Cursor for the page of results to retrieve, from page.next of the previous page.","in":"query","required":false,"schema":{"type":"string"},"example":"Mg=="},{"name":"criteria","description":"JSON criteria for the dates to retrieve. Must be valid JSON. min and max are inclusive date IDs in the format yyyyMMdd.\n","in":"query","required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"max":{"type":"integer","example":20261231},"min":{"type":"integer","example":20260101},"isWeekend":{"type":"boolean"},"isHoliday":{"type":"boolean"},"isBusinessDay":{"type":"boolean"},"isInLieuOfDay":{"type":"boolean"}}},"example":{"min":20260101,"max":20261231,"isHoliday":true}}}}],"responses":{"200":{"description":"Dates successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarDatesPage"}}}}}}},"/calendar/v1/dates/{id}":{"parameters":[{"name":"id","description":"ID of the date to retrieve, in the format yyyyMMdd.","in":"path","required":true,"schema":{"type":"integer","minimum":20200000,"maximum":20600000},"example":20261111}],"get":{"tags":["Dates"],"description":"Retrieves information about a calendar date. Public: no roles are required and anonymous requests are allowed. Dates are platform data and the same for every tenant, so no tenant context is used.\n","security":[{},{"accessToken":[]}],"responses":{"200":{"description":"Date successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarDate"}}}},"400":{"$ref":"#/components/responses/CalendarBadRequest"},"404":{"$ref":"#/components/responses/CalendarNotFound"}}}}},"components":{"securitySchemes":{"accessToken":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"parameters":{"CalendarAttendeeId":{"name":"attendeeId","description":"ID of the attendee.","in":"path","required":true,"schema":{"type":"integer"},"example":7},"CalendarDefinitionName":{"name":"name","description":"Name of the tenant calendar.","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-zA-Z0-9-_ ]{1,50}$"},"example":"site-inspections"},"CalendarEventId":{"name":"id","description":"ID of the calendar event.","in":"path","required":true,"schema":{"type":"integer"},"example":42},"CalendarEventsAfter":{"name":"after","description":"Cursor for the page of results to retrieve, from page.next of the previous page.","in":"query","required":false,"schema":{"type":"string"},"example":"MjU="},"CalendarEventsTop":{"name":"top","description":"Number of events to return in a page. Must be a positive integer.","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":10},"example":25},"CalendarIncludeAttendees":{"name":"includeAttendees","description":"Set to true to include attendees in the events. Requires private access to the calendar (see the operation description), even for public events; other callers receive 403.\n","in":"query","required":false,"schema":{"type":"boolean","default":false}},"CalendarName":{"name":"name","description":"Name of the calendar.","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":50},"example":"site-inspections"},"CalendarTenantId":{"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. Must be a valid tenant URN.\n","in":"query","required":false,"schema":{"type":"string"},"example":"urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7"},"CalendarTenantName":{"name":"tenant","description":"Name of the tenant whose calendar to use. Any caller can set it, including anonymous users and users of another tenant, and it replaces the tenant of the token or tenantId parameter. Anonymous callers must set it, since they have no tenant context. An unknown tenant name responds 400.\n","in":"query","required":false,"schema":{"type":"string"},"example":"service-delivery"}},"responses":{"CalendarBadGateway":{"description":"Configuration service is unavailable, rejected the service's credentials, or returned invalid calendar definitions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarError"},"example":{"errorMessage":"Configuration service is unavailable."}}}},"CalendarBadRequest":{"description":"Request is invalid, for example a path, query, or body parameter failed validation, or there is no tenant context.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarError"},"example":{"errorMessage":"Validation failed with error(s): id (params) - Invalid value"}}}},"CalendarConflict":{"description":"Request conflicts with the current state of the calendar.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarError"},"example":{"errorMessage":"Calendar 'site-inspections' already exists."}}}},"CalendarForbidden":{"description":"User does not have the role required for the operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarError"},"example":{"errorMessage":"User Test User (ID: 9f1c2a3b-4c5d-4e6f-8a9b-0c1d2e3f4a5b) not permitted to create calendar event."}}}},"CalendarNotFound":{"description":"Calendar, event, occurrence, attendee, or date not found in the tenant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarError"},"example":{"errorMessage":"Calendar with ID 'site-inspections' could not be found."}}}},"CalendarUnauthorized":{"description":"Request does not include a valid bearer token.","content":{"text/plain":{"schema":{"type":"string"},"example":"Unauthorized"}}}},"schemas":{"Attendee":{"type":"object","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string"},"email":{"type":"string","format":"email"}},"example":{"id":7,"name":"Test User","email":"test.user@gov.ab.ca"}},"AttendeeInput":{"type":"object","properties":{"name":{"type":"string","description":"Name of the attendee. Can be an empty string."},"email":{"type":"string","format":"email","description":"Email of the attendee. An event can't have two attendees with the same email."}},"required":["name","email"],"example":{"name":"Test User","email":"test.user@gov.ab.ca"}},"Calendar":{"type":"object","properties":{"urn":{"type":"string","readOnly":true},"name":{"type":"string"},"displayName":{"type":"string"},"description":{"type":"string"},"readRoles":{"type":"array","description":"Roles that can read private events and the attendees of events.","items":{"type":"string"}},"updateRoles":{"type":"array","description":"Roles that can read private events, and create, update, and delete events and attendees.","items":{"type":"string"}}},"example":{"urn":"urn:ads:platform:calendar-service:v1:/calendars/site-inspections","name":"site-inspections","displayName":"Site inspections","description":"Calendar of scheduled site inspections.","readRoles":["inspection-viewer"],"updateRoles":["inspection-scheduler"]}},"CalendarDate":{"type":"object","properties":{"id":{"type":"integer","description":"ID of the date in the format yyyyMMdd."},"date":{"type":"string","format":"date-time"},"dayOfWeek":{"type":"integer","minimum":1,"maximum":7,"description":"ISO day of the week, from 1 (Monday) to 7 (Sunday)."},"isWeekend":{"type":"boolean"},"isHoliday":{"type":"boolean"},"isBusinessDay":{"type":"boolean"},"holiday":{"type":"string","nullable":true,"description":"Name of the holiday, if the date is a holiday."},"isInLieuOfDay":{"type":"boolean","description":"Indicates the date is a day off in lieu of a holiday that falls on a weekend."}},"example":{"id":20261111,"date":"2026-11-11T00:00:00.000Z","dayOfWeek":3,"isWeekend":false,"isHoliday":true,"isBusinessDay":false,"holiday":"Remembrance Day","isInLieuOfDay":false}},"CalendarDatesPage":{"type":"object","properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/CalendarDate"}},"page":{"$ref":"#/components/schemas/CalendarPage"}},"example":{"results":[{"id":20261111,"date":"2026-11-11T00:00:00.000Z","dayOfWeek":3,"isWeekend":false,"isHoliday":true,"isBusinessDay":false,"holiday":"Remembrance Day","isInLieuOfDay":false},{"id":20261225,"date":"2026-12-25T00:00:00.000Z","dayOfWeek":5,"isWeekend":false,"isHoliday":true,"isBusinessDay":false,"holiday":"Christmas Day","isInLieuOfDay":false}],"page":{"next":"Mg==","size":2}}},"CalendarDefinition":{"allOf":[{"$ref":"#/components/schemas/Calendar"},{"type":"object","required":["source"],"properties":{"source":{"type":"string","enum":["tenant","core"],"readOnly":true,"description":"tenant for calendars managed by the tenant; core for read-only calendars registered by platform services."}}}],"example":{"urn":"urn:ads:platform:calendar-service:v1:/calendars/site-inspections","name":"site-inspections","displayName":"Site inspections","description":"Calendar of scheduled site inspections.","readRoles":["inspection-viewer"],"updateRoles":["inspection-scheduler"],"source":"tenant"}},"CalendarDefinitionInput":{"type":"object","additionalProperties":false,"properties":{"name":{"type":"string","pattern":"^[a-zA-Z0-9-_ ]{1,50}$","description":"Must not be the reserved __proto__ property. On update, must match the name in the path."},"displayName":{"type":"string","minLength":1,"maxLength":32,"pattern":"\\S"},"description":{"type":"string","maxLength":250},"readRoles":{"type":"array","items":{"type":"string"}},"updateRoles":{"type":"array","items":{"type":"string"}}},"required":["name","displayName","readRoles","updateRoles"],"example":{"name":"site-inspections","displayName":"Site inspections","description":"Calendar of scheduled site inspections.","readRoles":["inspection-viewer"],"updateRoles":["inspection-scheduler"]}},"CalendarDeleteResult":{"type":"object","properties":{"deleted":{"type":"boolean"}},"example":{"deleted":true}},"CalendarError":{"type":"object","properties":{"errorMessage":{"type":"string"}}},"CalendarEvent":{"type":"object","properties":{"urn":{"type":"string","readOnly":true},"id":{"type":"integer","readOnly":true},"recordId":{"type":"string","nullable":true,"description":"ID of a record in another system that the event relates to."},"context":{"type":"object","nullable":true,"description":"Properties of the event that can be used as criteria to find it."},"name":{"type":"string"},"description":{"type":"string"},"isPublic":{"type":"boolean","description":"Public events can be read by anyone, including anonymous users. Their attendees are not public."},"isAllDay":{"type":"boolean"},"start":{"type":"string","format":"date-time","description":"Start in the service timezone (America/Edmonton)."},"end":{"type":"string","format":"date-time","nullable":true,"description":"End in the service timezone (America/Edmonton)."},"recurrenceId":{"type":"string","format":"date-time","readOnly":true,"description":"Original start of the occurrence (RFC 5545 RECURRENCE-ID). Only included on occurrences of recurring events returned by range retrieval; id is the recurring event."},"recurrence":{"allOf":[{"$ref":"#/components/schemas/EventRecurrence"}],"description":"Only included for recurring events. exclusions is only included when retrieving the recurring event itself."},"attendees":{"type":"array","description":"Only included when includeAttendees is true.","items":{"$ref":"#/components/schemas/Attendee"}}},"example":{"urn":"urn:ads:platform:calendar-service:v1:/calendars/site-inspections/events/42","id":42,"recordId":"inspection-1024","context":{"region":"north"},"name":"Site inspection","description":"Inspection of the Edmonton north facility.","isPublic":false,"isAllDay":false,"start":"2026-11-17T09:00:00.000-07:00","end":"2026-11-17T10:30:00.000-07:00"}},"CalendarEventCriteria":{"type":"object","properties":{"recordId":{"type":"string"},"context":{"type":"object","description":"Matches events whose context contains these properties and values."},"isPublic":{"type":"boolean","description":"Only applies to callers with private access; other callers always receive only public events."},"startsAfter":{"type":"string","format":"date-time"},"endsBefore":{"type":"string","format":"date-time"},"activeOn":{"type":"string","format":"date-time"},"attendeeCriteria":{"type":"object","properties":{"nameEquals":{"type":"string","nullable":true},"emailEquals":{"type":"string","nullable":true}}},"orderBy":{"type":"string","enum":["id","start"]}},"example":{"recordId":"inspection-1024","startsAfter":"2026-11-01T00:00:00-06:00"}},"CalendarEventInput":{"type":"object","properties":{"recordId":{"type":"string","nullable":true},"context":{"type":"object","nullable":true},"name":{"type":"string","minLength":1,"maxLength":50},"description":{"type":"string"},"start":{"type":"string","format":"date-time","description":"ISO 8601 date/time. Values without an offset are read in the service timezone (America/Edmonton)."},"end":{"type":"string","format":"date-time","description":"ISO 8601 date/time. Must not be before start."},"isPublic":{"type":"boolean","default":false},"isAllDay":{"type":"boolean","default":false},"recurrence":{"allOf":[{"$ref":"#/components/schemas/EventRecurrence"}],"nullable":true}},"required":["name","start","end"]},"CalendarEventUpdate":{"type":"object","description":"Properties to change. Omitted properties are unchanged. end, name, description, and context can't be cleared, and recordId can't be changed.\n","properties":{"context":{"type":"object"},"name":{"type":"string","minLength":1,"maxLength":50},"description":{"type":"string"},"start":{"type":"string","format":"date-time"},"end":{"type":"string","format":"date-time","description":"Must not be before start."},"isPublic":{"type":"boolean"},"isAllDay":{"type":"boolean"},"recurrence":{"allOf":[{"$ref":"#/components/schemas/EventRecurrence"}],"nullable":true,"description":"Replaces the whole recurrence. Set to null to make the event a single event."}}},"CalendarEventsPage":{"type":"object","properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/CalendarEvent"}},"page":{"allOf":[{"$ref":"#/components/schemas/CalendarPage"}],"description":"Not included for range retrieval with from and to."}},"example":{"results":[{"urn":"urn:ads:platform:calendar-service:v1:/calendars/site-inspections/events/42","id":42,"recordId":"inspection-1024","context":{"region":"north"},"name":"Site inspection","description":"Inspection of the Edmonton north facility.","isPublic":false,"isAllDay":false,"start":"2026-11-17T09:00:00.000-07:00","end":"2026-11-17T10:30:00.000-07:00"},{"urn":"urn:ads:platform:calendar-service:v1:/calendars/site-inspections/events/43/occurrences/2026-11-17","id":43,"name":"Team meeting","description":"Weekly inspection planning meeting.","isPublic":true,"isAllDay":false,"start":"2026-11-17T13:00:00.000-07:00","end":"2026-11-17T14:00:00.000-07:00","recurrenceId":"2026-11-17T13:00:00.000-07:00","recurrence":{"frequency":"weekly","interval":1,"daysOfWeek":["TU"],"end":{"until":"2026-12-15"}}}],"page":{"next":"Mg==","size":2}}},"CalendarPage":{"type":"object","properties":{"after":{"type":"string","description":"Cursor of the current page, if one was requested."},"next":{"type":"string","nullable":true,"description":"Cursor of the next page; not set when there are no more results."},"size":{"type":"integer"}}},"EventRecurrence":{"type":"object","description":"Recurrence of an event based on a subset of the RFC 5545 RRULE. Occurrences are generated in Mountain time (America/Edmonton) and keep the local start time across daylight saving changes.","properties":{"frequency":{"type":"string","enum":["daily","weekly","monthly","yearly"],"description":"Monthly and yearly recurrence use the day of the event start; months or years without that day are skipped."},"interval":{"type":"integer","minimum":1,"maximum":99,"default":1,"description":"Interval of the frequency; e.g. 2 with weekly is every two weeks."},"daysOfWeek":{"type":"array","description":"Weekly recurrence only. Must include the day of the event start. Defaults to the day of the event start.","items":{"type":"string","enum":["MO","TU","WE","TH","FR","SA","SU"]}},"end":{"type":"object","description":"Optional end of the recurrence. Specify until or count, not both.","properties":{"until":{"type":"string","format":"date","description":"Last date (inclusive) on which an occurrence can start."},"count":{"type":"integer","minimum":1,"maximum":1000,"description":"Number of occurrences, including the first and any cancelled occurrences."}}},"exclusions":{"type":"array","readOnly":true,"description":"Recurrence IDs of cancelled occurrences.","items":{"type":"string","format":"date-time"}}},"required":["frequency"],"example":{"frequency":"weekly","interval":1,"daysOfWeek":["TU"],"end":{"until":"2026-12-15"}}}}},"security":[{"accessToken":[]}],"tags":[{"name":"Calendar","description":"API to manage calendars, calendar events, and event attendees."},{"name":"Dates","description":"API to retrieve information about dates, such as holidays and business days."}]}