Composition API Reference

The composition engine: resolves the composed dashboard and case-detail surfaces by merging the jurisdiction baseline, the jurisdiction-live override (written from the Studio admin surface), and the worker’s own personalization layer.

Endpoints

EventReplay

Replay outbox events in a time window

POST /v1/admin/events/replay

Re-stages the published outbox rows created in [from, to] (optionally one event_type) so the outbox worker republishes them. At most 100000 rows per call; when more is true, call again with the same window and resume_from. Rows already pending are left alone. dry_run=true only counts. A from older than the service’s outbox retention window is refused. Each batch commits on its own, so after a 5xx the committed batches stay re-staged and re-running the same window picks up the rest. Every admitted call, a dry run included, records an admin.events_replayed act naming the worker.

Table 1. Parameters
Name In Required Description

from

query

Yes

RFC 3339 inclusive lower bound on event_outbox.created_at.

to

query

Yes

RFC 3339 inclusive upper bound on event_outbox.created_at.

event_type

query

No

Optional event_type scope. When present, only rows whose event_type equals this value are counted and re-staged; when absent, the whole [from, to] window is in scope.

dry_run

query

No

If true, return the would-replay count without modifying rows.

resume_from

query

No

The resume_from cursor a previous response returned with more = true. Passed back with the same from / to / event_type, the re-stage continues strictly past that key. A string that is not a cursor is a 400 naming this field.

Responses
  • 200: The window’s count and what this call re-staged

  • 400: bad-request: a malformed or missing from / to, a non-boolean dry_run, from after to, from older than the outbox retention window, or a resume_from that is not a replay cursor (field names it)

  • 401: Missing or invalid bearer token

  • 403: The acting identity is not an admin, or is a bare service principal (worker-required): a replay is a worker’s act

  • 422: validation-failed: event_type longer than 255 bytes

  • 500: Internal error (the re-staged count overflowed, or an unclassified database error); batches already committed stay committed

  • 503: Service Unavailable (RFC 9457 problem document): database pool exhaustion (carries Retry-After: 5), db-connection-lost, db-outcome-unknown, or a synchronous upstream dependency refusal.

  • 504: Gateway Timeout (RFC 9457 problem document): the route-class request ceiling elapsed (request-timeout) or the database canceled the statement (db-timeout) — the server yields first.


compositions

Resolve the composed surface named by {surface} for the acting worker.

GET /v1/compositions/{surface}

Authz-gated (Action::Read on the composition resource); the post-merge role filter then governs which panels the worker’s role actually sees. The resolution role, jurisdiction, and user_sub come from the request principal — honoring the X-Craig-Actor on-behalf-of actor when present. The user_sub makes the worker’s own personalization (the user layer) apply on read, so a personalized layout "survives reload"; a service principal / non-UUID subject resolves the role baseline (no user layer).

Table 2. Parameters
Name In Required Description

surface

path

Yes

Surface to resolve: dashboard or case_detail

Responses
  • 200: The merged, role-filtered surface with its content version

  • 401: Missing or invalid bearer token

  • 403: The principal may not read compositions

  • 404: Unknown surface

  • 503: Service Unavailable (RFC 9457 problem document): database pool exhaustion (carries Retry-After: 5), db-connection-lost, db-outcome-unknown, or a synchronous upstream dependency refusal.

  • 504: Gateway Timeout (RFC 9457 problem document): the route-class request ceiling elapsed (request-timeout) or the database canceled the statement (db-timeout) — the server yields first.


GET /v1/compositions/{surface}/override — the current jurisdiction-live

override delta + ETag, or 404 when the jurisdiction has not customized this surface yet.

GET /v1/compositions/{surface}/override

Table 3. Parameters
Name In Required Description

surface

path

Yes

dashboard or case_detail

Responses
  • 200: The current jurisdiction-live override + its ETag

  • 403: Not permitted to manage composition overrides

  • 404: Unknown surface, or no override set yet

  • 503: Service Unavailable (RFC 9457 problem document): database pool exhaustion (carries Retry-After: 5), db-connection-lost, db-outcome-unknown, or a synchronous upstream dependency refusal.

  • 504: Gateway Timeout (RFC 9457 problem document): the route-class request ceiling elapsed (request-timeout) or the database canceled the statement (db-timeout) — the server yields first.


PUT /v1/compositions/{surface}/override — write the jurisdiction-live

override (validate → persist + stage-invalidation in one txn → evict cache).

PUT /v1/compositions/{surface}/override

Table 4. Parameters
Name In Required Description

surface

path

Yes

dashboard or case_detail

Responses
  • 200: Written; returns the new ETag

  • 400: Missing precondition, or the override would break the surface

  • 403: Not permitted to manage composition overrides

  • 404: Unknown surface, or If-Match replace with no existing row

  • 409: Optimistic-concurrency conflict (ETag mismatch / already exists)

  • 422: A NUL (U+0000) in any string or object key of the delta, which the jsonb column cannot store (validation-failed naming delta, value-free)

  • 503: Service Unavailable (RFC 9457 problem document): database pool exhaustion (carries Retry-After: 5), db-connection-lost, db-outcome-unknown, or a synchronous upstream dependency refusal.

  • 504: Gateway Timeout (RFC 9457 problem document): the route-class request ceiling elapsed (request-timeout) or the database canceled the statement (db-timeout) — the server yields first.


GET /v1/compositions/{surface}/user-delta — the acting worker’s current

personalization envelope + ETag, or 404 when they have not personalized this surface yet.

GET /v1/compositions/{surface}/user-delta

Table 5. Parameters
Name In Required Description

surface

path

Yes

dashboard (the only personalizable surface)

Responses
  • 200: The worker’s current user_delta_v1 envelope + its ETag

  • 400: The acting worker is a service principal or has no UUID subject

  • 403: Not permitted to read compositions

  • 404: Unknown surface, or no personalization set yet

  • 422: The surface does not support user-delta personalization

  • 503: Service Unavailable (RFC 9457 problem document): database pool exhaustion (carries Retry-After: 5), db-connection-lost, db-outcome-unknown, or a synchronous upstream dependency refusal.

  • 504: Gateway Timeout (RFC 9457 problem document): the route-class request ceiling elapsed (request-timeout) or the database canceled the statement (db-timeout) — the server yields first.


PUT /v1/compositions/{surface}/user-delta — validate + persist the acting

worker’s personalization (validate → persist + stage-invalidation in one txn → evict this worker’s cache entry).

PUT /v1/compositions/{surface}/user-delta

Table 6. Parameters
Name In Required Description

surface

path

Yes

dashboard (the only personalizable surface)

Responses
  • 200: Written; returns the new ETag

  • 400: Missing precondition, malformed request body, or the acting worker has no UUID subject

  • 403: Not permitted to read compositions

  • 404: Unknown surface, or If-Match replace with no existing row

  • 409: Optimistic-concurrency conflict (ETag mismatch / already exists)

  • 422: The surface is unsupported, or the delta is invalid (unknown slug / repeated slug / forbidden panel / over-budget row), or a body that does not deserialize as a user_delta_v1 envelope, e.g. a non-integer span_overrides entry (validation-failed naming user_delta; the value never echoed)

  • 503: Service Unavailable (RFC 9457 problem document): database pool exhaustion (carries Retry-After: 5), db-connection-lost, db-outcome-unknown, or a synchronous upstream dependency refusal.

  • 504: Gateway Timeout (RFC 9457 problem document): the route-class request ceiling elapsed (request-timeout) or the database canceled the statement (db-timeout) — the server yields first.


Edit this page · latest