Data Exchange & ICPC API Reference

Inter-agency data exchange and Interstate Compact on the Placement of Children (ICPC) workflow management.

Endpoints

Agreements

List data sharing agreements

GET /v1/exchange/agreements

Table 1. Parameters
Name In Required Description

page

query

No

1-based page number; default 1, at most 10000 (a deeper page is a 400).

per_page

query

No

Page size; default 25, capped at 500. 0 returns no rows but still reports total.

partner_id

query

No

Only agreements covering this partner.

status

query

No

Only agreements in this status (draft, active, expired or terminated).

search

query

No

Full-text search across agreement_title.

sort_by

query

No

Sort column: agreement_title, status, effective_date (default: created_at).

sort_dir

query

No

Sort direction: asc or desc (default: desc).

Responses
  • 200: Page of agreements

  • 400: A page past the depth cap; a malformed query parameter (e.g. a non-UUID partner_id) is the extractor’s value-free bad-request problem, before the handler

  • 401: Unauthorized

  • 403: Forbidden — including a worker- or supervisor-scoped caller: these rows carry no per-worker ownership, so an assignment scope is refused rather than widened

  • 422: A filter over its length cap: status / sort_by / sort_dir 32, search 500 bytes (validation-failed)

  • 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.


Create data sharing agreement

POST /v1/exchange/agreements

Table 2. Request Fields
Field Type Required Description

agreement_title

string

Yes

The agreement title. A NUL (U+0000), which the column cannot store, is a 422 validation-failed on this field.

client_request_id

UUID

Yes

Client-minted idempotency id — REQUIRED. Same id + identical intent replays the original agreement; a different intent under the same id is a 409 idempotency-conflict.

data_elements

object

No

The data elements the agreement covers (an extensible JSON document). It may nest at most 16 levels, hold at most 2,000 values, and no string or key longer than 16,384 bytes. Past a limit, or with a NUL (U+0000) in any string or object key, it is a 422 validation-failed on this field.

effective_date

date

Yes

First day the agreement admits a disclosure (YYYY-MM-DD).

expiration_date

date (optional)

No

Last day the agreement admits a disclosure (YYYY-MM-DD); omit for an open-ended agreement.

legal_authority

string (optional)

No

The legal authority for the exchange. A NUL (U+0000), which the column cannot store, is a 422 validation-failed on this field.

object_key

string (optional)

No

Object-store key of the signed agreement document: 1-1024 bytes of /-separated non-empty segments (never . or ..), with no leading or trailing segment whitespace, backslash \, control, Unicode format (Cf), or line/paragraph separator character (admitting every key craig_store::derive_object_key builds from a StoredFileName, which strips both). Any other value is a 422 validation-failed on object_key.

partner_id

UUID

Yes

The partner the agreement covers; an unknown partner is a 404.

Responses
  • 200: Agreement created (or replayed — same client_request_id + intent)

  • 401: Unauthorized

  • 403: Forbidden

  • 409: client_request_id claimed by a different operation, or replayed entity gone

  • 422: Validation failure (including a missing client_request_id, a NUL in agreement_title, legal_authority or any data_elements string or key, or an object_key outside its object-store key grammar)

  • 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 data sharing agreement by ID

GET /v1/exchange/agreements/{id}

Table 3. Parameters
Name In Required Description

id

path

Yes

Agreement ID

Responses
  • 200: Agreement details

  • 401: Unauthorized

  • 403: Forbidden

  • 404: Not found

  • 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.


Update data sharing agreement

PUT /v1/exchange/agreements/{id}

Table 4. Parameters
Name In Required Description

id

path

Yes

Agreement ID

Table 5. Request Fields
Field Type Required Description

agreement_title

string (optional)

No

The agreement title. A NUL (U+0000), which the column cannot store, is a 422 validation-failed on this field.

approved_by

string (optional)

No

Subject UUID or IdP username of the approving actor: 1-100 bytes, either a UUID accepted by Uuid::parse_str (resolved by name_if_acting_worker when matching the acting worker’s sub) or a trimmed username (e.g. jane.doe, jane.doe@localhost, Jane.Doe@Contoso.com) with no control, Unicode format (Cf, the joiners U+200C/U+200D included, as UTS #39 restricts them), or line/paragraph separator (U+2028/U+2029) character. Any other value is a 422 validation-failed on approved_by.

data_elements

object

No

The data elements the agreement covers (an extensible JSON document), under the same size limits as on create. Past a limit, or with a NUL (U+0000) in any string or object key, it is a 422 validation-failed on this field.

expiration_date

date (optional)

No

New last day of the agreement (YYYY-MM-DD); omitting it keeps the current date.

legal_authority

string (optional)

No

The legal authority for the exchange. A NUL (U+0000), which the column cannot store, is a 422 validation-failed on this field.

object_key

string (optional)

No

Object-store key of the signed agreement document: 1-1024 bytes of /-separated non-empty segments (never . or ..), with no leading or trailing segment whitespace, backslash \, control, Unicode format (Cf), or line/paragraph separator character (admitting every key craig_store::derive_object_key builds from a StoredFileName, which strips both). Any other value is a 422 validation-failed on object_key.

status

string (optional)

No

Target status. Allowed moves: draft → active; active → expired or terminated. Any other move is a 400 invalid-state-transition.

Responses
  • 200: Agreement updated. The approval stamp is first-write-wins: a later write carrying approved_by cannot rewrite it. A replayed approve that repeats the status transition is a 400 (same-to-same is illegal); only a stamp-bearing write WITHOUT a status change converges to 200.

  • 401: Unauthorized

  • 403: Forbidden

  • 404: Not found

  • 409: Status moved concurrently since your read — re-read and retry

  • 422: A body field whose value does not deserialize, e.g. a non-date expiration_date (validation-failed; the field is named, the value never echoed), a field over its length cap, a NUL in agreement_title, legal_authority or any data_elements string or key, or an object_key or approved_by outside its grammar (validation-failed)

  • 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.


Delete a draft data sharing agreement

DELETE /v1/exchange/agreements/{id}

Table 6. Parameters
Name In Required Description

id

path

Yes

Agreement ID

Responses
  • 204: Agreement deleted

  • 400: Only draft agreements can be deleted (invalid-state-transition)

  • 401: Unauthorized

  • 403: Forbidden

  • 404: Not found

  • 409: A partner references the agreement (the refusal names the blocking partner), or it left draft since it was read (concurrent-modification — re-read and retry)

  • 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.


Background Jobs

Poll a background job

GET /v1/exchange/jobs/{id}

The read-only poll of a craig-exchange background job: its state (queued / running / succeeded / failed; the last two are terminal and never change), the current attempt and the attempts[] ledger (an interrupted or crash attempt is run again, up to max_attempts), the progress document (for collection_run, done of total admitted reports posted), result (present only when succeeded: for collection_run the recorded run, with its transaction id, status, failure and counts) and error (present only when failed: a closed token and a categorical detail). Authorized on the BackgroundJob resource type: an admin, or the job’s creator; any other caller is 403. An unknown id is 404, looked up before the check. Cache-Control: no-store. Never writes.

Table 7. Parameters
Name In Required Description

id

path

Yes

Job id: the last segment of the Location the enqueuing 202 answered

Responses
  • 200: The job (Cache-Control: no-store)

  • 401: Unauthorized

  • 403: Forbidden: neither the job’s creator nor an admin

  • 404: No such job

  • 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.


Collections

Collect what a partner published (human admin)

POST /v1/exchange/collections/run

Enqueues one collection run as a background job (kind = collection_run) and answers 202 with Location: /v1/exchange/jobs/{id} and the job; poll the Location until the job is succeeded or failed. Body = { client_request_id, interface, leg }: the same client_request_id replays the same job whatever its state, a fresh one is a new job. The run fetches one partner document (for doe_slds / weekly_records, the education agency’s weekly student file) and, for each record about a person this deployment currently lists with that partner, posts the reported fact, with the listing it was admitted under, to the service that owns it. A record about anyone else is counted not_listed and dropped, as is one whose listing ended while it was on its way (the owner refuses it); a record that names no person is counted unattributable; stale counts the reports the owner already held, or held a later one for. craig-exchange stores no reported value: the run leaves one transaction (origin = collection, direction = inbound, no payload) and one exchange.collection_completed event carrying the counts. A succeeded job recorded a run, and its result is that run: transaction_id, status (completed, or failed), failure (the class of a failed run: the partner failure’s class when its document could not be read, apply-failed:<n> when the owning service did not take n admitted reports; once three posts in a row say the owner is not taking reports, a run stops posting and counts the rest failed) and the counts. A failed run is safe to run again: every report is posted again. A failed job with error.token = refused_at_start called no partner and recorded nothing; error.detail names what did not hold when the run started: collection-disabled, collection-undeclared, partner-unresolved:<class> (no single active partner with an endpoint and a usable credential) or agreement-does-not-admit. A run interrupted by a shutdown is recorded as a failed run (interrupted) and the job runs again, up to three attempts (exhausted after the third). One run at a time per deployment: a second enqueue while one is queued or running is 409 job-already-active, and a job that finds the run’s lease held waits for it (progress.phase = waiting_for_lease). Collecting is off until CRAIG_EXCHANGECOLLECTIONS<INTERFACE>__ENABLED is set, separately from the interface’s send consent.

Table 8. Request Fields
Field Type Required Description

client_request_id

UUID

Yes

The client-held idempotency id (ADR-062): the same id replays the same job whatever its state; a fresh id is a new job.

interface

string

Yes

The partner interface: an adapter-kind token this deployment’s configuration lists (doe_slds).

leg

string

Yes

Which of the interface’s documents to collect (weekly_records).

Responses
  • 202: The run is enqueued (or this is a replay of the stored job, and nothing was enqueued again); Location = /v1/exchange/jobs/{id}

  • 400: collection-undeclared — this deployment holds no collection for that interface and leg (field leg); or a body that is not JSON

  • 401: Unauthorized

  • 403: Service callers and non-admin humans are refused

  • 409: Nothing was enqueued: collection-disabled (the interface’s collection consent is off), job-already-active (a run is already queued or running) or idempotency-conflict (this client_request_id was used for a different interface or leg)

  • 413: The body is larger than the request body limit

  • 415: The body is not application/json

  • 422: Validation failure: a missing client_request_id, an unknown field, or a field outside its bounds

  • 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.


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 9. 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.


ICPC

List ICPC requests

GET /v1/exchange/icpc

Table 10. Parameters
Name In Required Description

page

query

No

1-based page number; default 1, at most 10000 (a deeper page is a 400).

per_page

query

No

Page size; default 25, capped at 500. 0 returns no rows but still reports total.

direction

query

No

Only requests with this direction (outgoing or incoming).

status

query

No

Only requests in this status.

overdue

query

No

true: only overdue requests, those whose deadline_at has passed while the home study is still undecided: the status is none of approved, denied, conditional, completed or withdrawn. A conditional decision counts as decided, as approved and denied do, because the deadline is the window for completing the home study (42 U.S.C. § 671(a)(26)(A)(i)). false: every other request, a request with no deadline included. Absent: no deadline filter.

search

query

No

Full-text search across sending_state, receiving_state.

sort_by

query

No

Sort column: direction, status (default: created_at).

sort_dir

query

No

Sort direction: asc or desc (default: desc).

Responses
  • 200: Page of ICPC requests

  • 400: A page past the depth cap; a malformed query parameter (e.g. a non-boolean overdue) is the extractor’s value-free bad-request problem, before the handler

  • 401: Unauthorized

  • 403: Forbidden

  • 422: A filter over its length cap: direction / status / sort_by / sort_dir 32, search 500 bytes (validation-failed)

  • 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.


Create ICPC request

POST /v1/exchange/icpc

Table 11. Request Fields
Field Type Required Description

case_id

UUID

Yes

The case the placement request belongs to.

child_id

UUID

Yes

The child the request would place.

client_request_id

UUID

Yes

Client-minted idempotency id — REQUIRED. Same id + identical intent replays the original ICPC request; a different intent under the same id is a 409 idempotency-conflict.

direction

string

Yes

outgoing (this jurisdiction sends the child) or incoming (another state sends the child here). Any other value is a 400 invalid-enum-value.

receiving_state

string

Yes

The receiving state’s USPS code: exactly two ASCII letters, any case, stored upper case. Any other value is a 400 invalid-enum-value naming receiving_state.

request_type

string

Yes

Placement type: foster_care, relative_placement, adoptive_placement, residential_treatment or parent_relocation. Any other value is a 400 invalid-enum-value.

sending_state

string

Yes

The sending state’s USPS code: exactly two ASCII letters, any case, stored upper case. Any other value is a 400 invalid-enum-value naming sending_state.

Responses
  • 200: ICPC request created (or replayed — same client_request_id + intent)

  • 400: An unknown direction, request_type, sending_state or receiving_state (invalid-enum-value, value-free). A state must be exactly two ASCII letters naming a USPS code, any case, and is stored upper case; its refusal names the field

  • 401: Unauthorized

  • 403: Forbidden

  • 409: client_request_id claimed by a different operation, or replayed entity gone

  • 422: Validation failure (including a missing client_request_id)

  • 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 ICPC request detail

GET /v1/exchange/icpc/{id}

Table 12. Parameters
Name In Required Description

id

path

Yes

ICPC request ID

Responses
  • 200: ICPC request detail

  • 401: Unauthorized

  • 403: Forbidden

  • 404: Not found

  • 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.


Update ICPC request status

PUT /v1/exchange/icpc/{id}

Table 13. Parameters
Name In Required Description

id

path

Yes

ICPC request ID

Table 14. Request Fields
Field Type Required Description

status

string

Yes

Target status. Allowed moves: draft → submitted; draft or submitted → withdrawn; submitted → received (starts the response deadline); received → home_study_in_progress → approved, conditional or denied → completed.

Responses
  • 200: ICPC request updated

  • 400: Invalid transition

  • 401: Unauthorized

  • 403: Forbidden

  • 404: Not found

  • 409: Status moved concurrently since your read — re-read and retry

  • 422: A body field whose value does not deserialize, e.g. a non-string status (validation-failed; the field is named, the value never echoed), or a status over 32 bytes (validation-failed)

  • 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.


List ICPC attachments

GET /v1/exchange/icpc/{id}/attachments

Table 15. Parameters
Name In Required Description

id

path

Yes

ICPC request ID

Responses
  • 200: Attachments list

  • 401: Unauthorized

  • 403: Forbidden

  • 404: Not found

  • 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.


Upload ICPC attachment

POST /v1/exchange/icpc/{id}/attachments

Table 16. Parameters
Name In Required Description

id

path

Yes

ICPC request ID

Table 17. Request Form Fields (multipart/form-data)
Field Type Required Description

attachment_type

string (optional)

No

The attachment type token: 1-64 bytes of lowercase ASCII letters, digits, , . and -, starting with a lowercase letter or digit (^[a-z0-9][a-z0-9.-]*$); document when absent. Any other value is refused as a 422 validation-failed on attachment_type.

client_request_id

UUID

Yes

The client-held idempotency id: a byte- and metadata-identical retry under the same id replays the same attachment.

file

binary

Yes

The attachment file part.

file_sha256

string

Yes

The lowercase-hex SHA-256 of the file bytes (64 characters).

Responses
  • 200: Attachment uploaded (a byte- and metadata-identical retry under the same client_request_id replays the SAME attachment)

  • 400: Validation error (including a missing client_request_id / file_sha256 text field or a digest that does not match the bytes)

  • 401: Unauthorized

  • 403: Forbidden (including a foreign actor replaying another’s client_request_id)

  • 404: Not found

  • 409: Concurrent retries kept finalizing this upload; retry the request

  • 422: client_request_id reused with a different upload, or an attachment_type outside its 1-64 byte identifier token grammar (validation-failed)

  • 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.


Download ICPC attachment

GET /v1/exchange/icpc/{id}/attachments/{attachment_id}

Table 18. Parameters
Name In Required Description

id

path

Yes

ICPC request ID

attachment_id

path

Yes

Attachment ID

Responses
  • 200: Attachment file

  • 206: Partial content: the one Range slice (bytes=a-b, a- or -n) with Content-Range, Accept-Ranges: bytes and the slice’s Content-Length; honoured only when an If-Range strong-matches the ETag. A multi-range request is the full 200

  • 401: Unauthorized

  • 403: Forbidden

  • 404: Not found

  • 416: Range not satisfiable: Content-Range: bytes */<length>

  • 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 home study for ICPC request

GET /v1/exchange/icpc/{id}/home-study

Table 19. Parameters
Name In Required Description

id

path

Yes

ICPC request ID

Responses
  • 200: Home study detail

  • 401: Unauthorized

  • 403: Forbidden

  • 404: Not found

  • 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.


Submit home study assessment

POST /v1/exchange/icpc/{id}/home-study

Table 20. Parameters
Name In Required Description

id

path

Yes

ICPC request ID

Table 21. Request Fields
Field Type Required Description

background_checks

string

No

Background checks: pending (the default), pass or fail.

client_request_id

UUID

Yes

Client-minted idempotency id — REQUIRED. Same id + identical intent replays the original home study; a different intent under the same id is a 409 idempotency-conflict.

coordinator_decision

string (optional)

No

Coordinator decision token: one of approve, approved, conditional, deny, or denied (setting completed_at when present). Any other value is refused as a 422 validation-failed on coordinator_decision.

education_access

string

No

Education access check: pending (the default), pass or fail.

home_safety

string

No

Home safety check: pending (the default), pass or fail; any other value is a 400 invalid-enum-value naming the field.

medical_access

string

No

Medical access check: pending (the default), pass or fail.

override_justification

string (optional)

No

The coordinator’s documented override justification. A NUL (U+0000), which the column cannot store, is a 422 validation-failed on override_justification.

references_check

string

No

References check: pending (the default), pass or fail.

rules_recommendation

string (optional)

No

Rules-engine recommendation token: one of approve, approved, conditional, deny, or denied. Any other value is refused as a 422 validation-failed on rules_recommendation.

space_capacity

string

No

Space and capacity check: pending (the default), pass or fail.

support_systems

string

No

Support systems check: pending (the default), pass or fail.

Responses
  • 200: Home study recorded (or replayed — same client_request_id + intent)

  • 400: A per-check value outside pending|pass|fail — problem type invalid-enum-value, naming the field

  • 401: Unauthorized

  • 403: Forbidden

  • 404: Not found

  • 409: Home study already exists, client_request_id claimed by a different operation, or replayed entity gone

  • 422: Validation failure (including a missing client_request_id, a NUL in override_justification, or a rules_recommendation / coordinator_decision outside approve | approved | conditional | deny | denied)

  • 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.


Outbound triggers

Retire held admissions with a recorded reason (human admin)

POST /v1/exchange/triggers/admissions/dismiss

Terminal: a dismissed admission is never released. The ids are always explicit — there is no dismiss-everything — and the reason is stored on the row. An interface this deployment declares no leg for is refused.

Table 22. Request Fields
Field Type Required Description

ids

array of UUID

Yes

The admissions to retire — always explicit. There is no "dismiss everything held": a terminal act names what it is retiring.

interface

string

Yes

The partner interface whose backlog to address.

reason

string

Yes

Why, for the record. Bounded because it is persisted and rendered: a reason is a sentence, not a paste buffer. A NUL (U+0000), which the column cannot store, is a 422 validation-failed on reason.

Responses
  • 200: The pass completed

  • 400: trigger-interface-undeclared — this deployment declares no leg for that interface (field interface)

  • 401: Unauthorized

  • 403: Service callers and non-admin humans are refused

  • 422: Validation failure (including a NUL in reason)

  • 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.


POST /v1/exchange/triggers/admissions/release

Held admissions are the substrate’s record that nothing was dropped when the interface knob was off, no partner was configured, or the agreement had lapsed. This act re-evaluates the chain over them: whatever now admits becomes a staged resolve job, whatever still refuses is re-held with the reason as it stands today. One pass addresses at most 500 admissions: those no pass has re-held yet first (oldest first), then the least recently re-held, so repeated passes reach every held row; the act is idempotent, so a larger backlog is drained by running it again. An interface this deployment declares no leg for is refused rather than answered with a pass that touched nothing. With record_class the act addresses failed record jobs instead: each job of the interface whose last_error class is that auth class (auth-unsupported, auth-misconfigured, auth-unavailable, auth-refused), not yet re-staged, re-runs the chain; one the chain admits for its own partner is staged again under a fresh correlation with a fresh attempt budget, and its old row keeps its class and names the replacement in restaged_as. ids then names send jobs. A re-staged job is never re-staged again, so a repeated or concurrent pass re-stages nothing. A refused job stays selectable and every pass re-reads it; past 500 refused jobs, name newer ones with ids.

Table 23. Request Fields
Field Type Required Description

held_reason

string (optional)

No

Only rows held for this exact reason; omit for every reason. Closed vocabulary: the eight admission-time hold reasons (knob-off, no-partner, partner-ambiguous, dsa-missing, dsa-inactive, dsa-not-yet-effective, dsa-expired, dsa-not-owned) or one of the 23 settlement class tokens (transport, timeout, bad-status, partner-unavailable, malformed-response, partner-rejected, ack-mismatch, assembly-refused, assembly-unavailable, partner-changed, superseded, retries-exhausted, payload-invalid, unresolvable-dispatch, predecessor-unsettled, superseded-by-reentry, auth-unsupported, auth-misconfigured, auth-unavailable, auth-refused, partner-inactive, receipt-unapplied, receipt-conflict). Any other value is refused as a 422 validation-failed on held_reason.

ids

array of UUID (optional)

No

Only these admissions (with record_class, these send jobs); omit for the whole (reason- or class-filtered) backlog.

interface

string

Yes

The partner interface whose backlog to address.

record_class

string (optional)

No

Re-stage FAILED record jobs instead of releasing held admissions — those whose last_error class is this auth class (auth-unsupported, auth-misconfigured, auth-unavailable, auth-refused). Exclusive with held_reason; ids then names send jobs.

Responses
  • 200: The pass completed

  • 400: trigger-interface-undeclared — this deployment declares no leg for that interface (field interface)

  • 401: Unauthorized

  • 403: Service callers and non-admin humans are refused

  • 422: Validation failure (including a held_reason outside the closed trigger held-reason and settlement-class vocabulary); held_reason and record_class together (validation-failed, field record_class); a record_class outside the auth classes (release-record-class-unsupported, field record_class)

  • 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.


Admit the open stages no event admitted (human admin)

POST /v1/exchange/triggers/catch-up

Walks the cases open-stages projection for one interface and stage kind, writing a stage_opened admission for every open stage the admission ledger does not already cover, under a deployment-wide lease. Idempotent: a stage an event already admitted collides on the ledger’s identity and is counted as existing. This is both the catalogue’s initial pre-population of open stages at release and the repair for events an older binary consumed during a rolling deploy. Nothing is sent here — the send worker drains the resolve jobs under the ordinary consent chain.

Table 24. Request Fields
Field Type Required Description

interface

string

Yes

The partner interface — an adapter-kind token this deployment declares a trigger matrix for.

kind

enum (case, investigation, custody_episode, medicaid_application)

Yes

Which CRAIG entity plays the partner’s stage.

Responses
  • 200: The walk completed; the counts say what it did

  • 400: No opening leg is declared for that interface and stage kind

  • 401: Unauthorized

  • 403: Service callers and non-admin humans are refused

  • 409: Another catch-up walk holds the lease

  • 422: Validation failure

  • 503: The cases projection could not be walked

  • 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.


Partners

List exchange partners

GET /v1/exchange/partners

Table 25. Parameters
Name In Required Description

page

query

No

1-based page number; default 1, at most 10000 (a deeper page is a 400).

per_page

query

No

Page size; default 25, capped at 500. 0 returns no rows but still reports total.

partner_type

query

No

Only partners of this category token.

active

query

No

true or false to filter on the active flag; absent lists active and deactivated partners alike.

search

query

No

Full-text search across partner_name.

sort_by

query

No

Sort column: partner_name, partner_type (default: created_at).

sort_dir

query

No

Sort direction: asc or desc (default: desc).

Responses
  • 200: Page of exchange partners

  • 400: A page past the depth cap; a malformed query parameter (e.g. a non-boolean active) is the extractor’s value-free bad-request problem, before the handler

  • 401: Unauthorized

  • 403: Forbidden — including a worker- or supervisor-scoped caller: these rows carry no per-worker ownership, so an assignment scope is refused rather than widened

  • 422: A filter over its length cap: partner_type 64, search 500, sort_by / sort_dir 32 bytes (validation-failed)

  • 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.


Create exchange partner

POST /v1/exchange/partners

Table 26. Request Fields
Field Type Required Description

adapter_kind

string

No

Wire-protocol token driving adapter dispatch. One of the registry-backed snake_case tokens (an open String on the wire; registry membership is validated at the handler — discover via GET /v1/exchange/registry/adapter-kinds). Default shines.

auth_config

object

No

Secret REFERENCE names only, shaped by auth_type: {} | {token_ref} | {username, password_ref} | {header, key_ref}. Write-only. An update names auth_type and auth_config together, or neither.

auth_type

string

No

Outbound credential scheme: none, bearer, basic or api_key; any other token is a 422.

client_request_id

UUID

Yes

Client-minted idempotency id — REQUIRED. Same id + identical intent replays the original partner; a different intent under the same id is a 409 idempotency-conflict.

direction

string

Yes

inbound, outbound or bidirectional; any other value is a 400 invalid-enum-value.

endpoint_url

string (optional)

No

The partner’s endpoint. A NUL (U+0000), which the column cannot store, is a 422 validation-failed on endpoint_url.

exchange_format

string

No

Wire format token: 1-64 bytes of lowercase ASCII letters, digits, , . and -, starting with a lowercase letter or digit (^[a-z0-9][a-z0-9.-]*$), e.g. json, xml, csv, flat_file, hl7; defaults to json. Any other value is a 422 validation-failed on exchange_format.

partner_name

string

Yes

The partner’s display name. A NUL (U+0000), which the column cannot store, is a 422 validation-failed on partner_name.

partner_type

string

Yes

Category token, one of GET /v1/exchange/registry/partner-types; any other value is a 400 invalid-enum-value.

Responses
  • 200: Partner created (or replayed — same client_request_id + intent)

  • 401: Unauthorized

  • 403: Forbidden (including a typed-only adapter kind, which may not be active)

  • 409: Duplicate partner name, client_request_id claimed by a different operation, or replayed entity gone

  • 422: Validation failure (including a missing client_request_id, a NUL in partner_name or endpoint_url, or an exchange_format outside its identifier token grammar), or a partner-auth-type-unknown, partner-auth-config-invalid, partner-endpoint-userinfo or partner-auth-requires-https refusal naming the field only

  • 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 exchange partner by ID

GET /v1/exchange/partners/{id}

Table 27. Parameters
Name In Required Description

id

path

Yes

Partner ID

Responses
  • 200: Partner details

  • 401: Unauthorized

  • 403: Forbidden

  • 404: Not found

  • 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.


Update exchange partner

PUT /v1/exchange/partners/{id}

Table 28. Parameters
Name In Required Description

id

path

Yes

Partner ID

If-Match

header

Yes

REQUIRED row version from your last read, e.g. "3" or 3

Table 29. Request Fields
Field Type Required Description

adapter_kind

string (optional)

No

New wire-protocol token from GET /v1/exchange/registry/adapter-kinds.

auth_config

object (optional)

No

Secret REFERENCE names only, shaped by auth_type: {} | {token_ref} | {username, password_ref} | {header, key_ref}. Write-only. An update names auth_type and auth_config together, or neither.

auth_type

string (optional)

No

Outbound credential scheme: none, bearer, basic or api_key; any other token is a 422.

caller_partner_id

UUID (optional)

No

The craig-security partner whose approved client certificates may call CRAIG as this partner. Omitting it keeps the current one. An id that names no security partner is stored and matches no caller; a second active partner of the same adapter_kind for one caller is a 409.

data_sharing_agreement_id

UUID (optional)

No

Agreement to link to the partner; it must exist (else a 400). Omitting it keeps the current link.

direction

string (optional)

No

New direction: inbound, outbound or bidirectional.

endpoint_url

string (optional)

No

The partner’s endpoint. A NUL (U+0000), which the column cannot store, is a 422 validation-failed on endpoint_url, whatever active says.

exchange_format

string (optional)

No

Wire format token: 1-64 bytes of lowercase ASCII letters, digits, , . and -, starting with a lowercase letter or digit (^[a-z0-9][a-z0-9.-]*$), e.g. json, xml, csv, flat_file, hl7. Any other value is a 422 validation-failed on exchange_format.

partner_name

string (optional)

No

The partner’s display name. A NUL (U+0000), which the column cannot store, is a 422 validation-failed on partner_name.

partner_type

string (optional)

No

New category token from GET /v1/exchange/registry/partner-types.

Responses
  • 200: Partner updated

  • 400: Missing or malformed If-Match, or a data_sharing_agreement_id that does not name an existing agreement

  • 401: Unauthorized

  • 403: Forbidden (including a typed-only adapter kind left/made active by the effective post-merge state)

  • 404: Not found

  • 409: Version moved since your read (stale If-Match) — re-read and retry; or the new partner_name is already another partner’s, a deactivated one included (duplicate-resource; value-free); or the update would leave a second active partner of one adapter_kind answering for one caller_partner_id (duplicate-resource; value-free)

  • 422: partner-auth-type-unknown, partner-auth-config-invalid (including auth_type and auth_config not named together), partner-endpoint-userinfo (checked on every update, whatever active says) or partner-auth-requires-https, each naming the field only; a field over its length cap, a NUL in partner_name or endpoint_url, an exchange_format outside its identifier token grammar, or a body field whose value does not deserialize (e.g. a non-UUID data_sharing_agreement_id), is validation-failed (the field is named, 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.


Soft-delete exchange partner (sets active=false)

DELETE /v1/exchange/partners/{id}

Table 30. Parameters
Name In Required Description

id

path

Yes

Partner ID

Responses
  • 204: Partner deactivated

  • 401: Unauthorized

  • 403: Forbidden

  • 404: Not found (including an already-deactivated partner — fleet delete convention)

  • 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.


Test partner connectivity

POST /v1/exchange/partners/{id}/test

Table 31. Parameters
Name In Required Description

id

path

Yes

Partner ID

Responses
  • 200: Connectivity test result: result is ok, error: <reason>, or error: <auth class>[ ref=<name>] when the stored row’s credential is refused before anything is sent; auth_applied names the scheme presented (applied, not verified: /health may ignore it), null when nothing was sent

  • 401: Unauthorized

  • 403: Forbidden: the probe presents the partner’s credential, so it needs partner update

  • 404: Not found

  • 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.


Person Index

Service-to-service: ask the person index about a person

POST /v1/exchange/person-index/matches

Table 32. Request Fields
Field Type Required Description

person_id

UUID

Yes

The person asked about (cases-side logical ref), for the log.

requested_by

UUID

Yes

The worker the request is relayed for.

subject

object

Yes

The person a find asks about: all a find sends.

Responses
  • 200: The index’s candidates, best first; possibly none

  • 401: Unauthorized

  • 403: Caller is not the craig-cases service identity, the person index is not consented to for its interface (feature-disabled), the request carries no verified X-Craig-Actor naming a worker (worker-required), or requested_by is not that worker (forbidden)

  • 409: The index’s partner has no active data-sharing agreement (dsa-not-active), or the index refused the request as sent (person-index-refused)

  • 422: A body field over its bound or of the wrong type (validation-failed; the field is named, the value never echoed)

  • 503: No person index is registered, no single active partner of its interface is configured, its credential cannot be resolved, or the index did not answer (the failure’s class is named; nothing the index said is)

  • 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.


Service-to-service: tell the person index the product holds a person

POST /v1/exchange/person-index/participations

Table 33. Request Fields
Field Type Required Description

index_id

string

Yes

The index’s id for the person, as the worker chose it.

person_id

UUID

Yes

The person (cases-side logical ref): the id the index is given for them, and the one the log holds.

requested_by

UUID

Yes

The worker the request is relayed for.

subject

object

Yes

The person a find asks about: all a find sends.

Responses
  • 204: The index was told

  • 401: Unauthorized

  • 403: Caller is not the craig-cases service identity, the person index is not consented to for its interface (feature-disabled), the request carries no verified X-Craig-Actor naming a worker (worker-required), or requested_by is not that worker (forbidden)

  • 409: The index’s partner has no active data-sharing agreement (dsa-not-active), or the index refused: it knows no person under that id, or index_id is not an id an index could have given (person-index-refused)

  • 422: A body field over its bound or of the wrong type (validation-failed; the field is named, the value never echoed)

  • 503: No person index is registered, no single active partner of its interface is configured, its credential cannot be resolved, or the index did not answer

  • 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.


Service-to-service: register a person in the person index

POST /v1/exchange/person-index/registrations

Table 34. Request Fields
Field Type Required Description

birth_city

string (optional)

No

The city the person was born in.

birth_date_verification

string

Yes

How the date of birth was verified.

birth_state

string (optional)

No

The state the person was born in, as its two-letter code.

date_of_birth

date

Yes

Date of birth.

ethnicity

string (optional)

No

The person’s ethnicity.

first_name

string

Yes

Given name.

last_name

string

Yes

Family name.

marital_status

string (optional)

No

The person’s marital status.

middle_name

string (optional)

No

Middle name.

person_id

UUID

Yes

The person registered (cases-side logical ref), for the log.

primary_language

string (optional)

No

The person’s primary language.

races

array of string

No

The person’s races; empty when none is recorded.

requested_by

UUID

Yes

The worker the request is relayed for.

residence_county

string

Yes

The county the person lives in, as the product’s admin-unit code.

sex

string

Yes

The person’s sex.

suffix

string (optional)

No

Name suffix.

Responses
  • 200: The id the index gave the person

  • 401: Unauthorized

  • 403: Caller is not the craig-cases service identity, the person index is not consented to for its interface (feature-disabled), the request carries no verified X-Craig-Actor naming a worker (worker-required), or requested_by is not that worker (forbidden)

  • 409: The index’s partner has no active data-sharing agreement (dsa-not-active), or the index refused the registration as sent (person-index-refused)

  • 422: A body field over its bound or of the wrong type (validation-failed; the field is named, the value never echoed)

  • 503: No person index is registered, no single active partner of its interface is configured, its credential cannot be resolved, or the index did not answer: whether the person was created is then unknown

  • 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.


Registry

List registered adapter-kind tokens

GET /v1/exchange/registry/adapter-kinds

Responses
  • 200: Sorted adapter-kind tokens

  • 401: Unauthorized

  • 403: Forbidden — including a worker- or supervisor-scoped caller: these rows carry no per-worker ownership, so an assignment scope is refused rather than widened

  • 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.


List registered partner-type taxonomy tokens

GET /v1/exchange/registry/partner-types

Responses
  • 200: Sorted partner-type tokens

  • 401: Unauthorized

  • 403: Forbidden — including a worker- or supervisor-scoped caller: these rows carry no per-worker ownership, so an assignment scope is refused rather than widened

  • 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.


SSA Screening

Re-admit paused SSA screening jobs (human admin)

POST /v1/exchange/ssa-screening-jobs/resume

Table 35. Request Fields
Field Type Required Description

reason

string (optional)

No

Re-admit only jobs paused with this categorical reason token (one of the pause-reason vocabulary).

run_id

UUID (optional)

No

Re-admit only the given run’s paused jobs.

Responses
  • 200: Matching paused jobs re-admitted (0 matches is a legal no-op)

  • 400: required-field-missing — neither filter (reason, run_id) was given; or invalid-enum-value — reason is not a pause-reason token

  • 401: Unauthorized

  • 403: Service callers and non-admin humans are refused

  • 409: A live precondition still holds the pause condition — the detail names the token

  • 422: Validation failure (the reason token’s length bounds)

  • 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.


Service-to-service: stage an SSA screening run atomically

POST /v1/exchange/ssa-screening-runs

Table 36. Request Fields
Field Type Required Description

as_of

date

Yes

The business date the cohort was bound (cases-side BusinessClock date; the freshness horizon counts from this).

case_id

UUID

Yes

The case whose household is being screened.

client_request_id

UUID

Yes

The client-held operation id, forwarded unchanged from the original caller.

cohort_hash

string

Yes

The cohort hash cases computed via the ONE shared crate::screening_cohort::cohort_hash; exchange recomputes and refuses on mismatch.

cohort_revision

integer

Yes

The case’s screening_cohort_revision, read in the same request that assembled the cohort: any cohort change committed after that read carries a higher revision and invalidates this run. Required.

members

array of StageScreeningMember

Yes

The cohort (1..=SCREENING_MEMBERS_MAX members; duplicate person ids are refused — the members table makes them unrepresentable, the handler refuses them typed).

requested_by

UUID

Yes

The requesting caseworker’s sub (stage-time actor attribution; becomes ssa_screening_runs.created_by).

requested_by_name

string

Yes

The requesting caseworker’s display name (per-member attribution). A NUL (U+0000) is a 422 validation-failed on requested_by_name.

Responses
  • 202: Run staged (or a replay of the stored run — nothing re-staged)

  • 400: duplicate-entry — the cohort lists one person id twice (field members); or screening-cohort-hash-mismatch — cohort_hash is not the hash of the members + as_of sent (field cohort_hash). Nothing was staged

  • 401: Unauthorized

  • 403: Caller is not the craig-cases service identity, the SSA screening knob is off (FEATURE_DISABLED), the request carries no verified X-Craig-Actor naming a worker (worker-required), or requested_by is not that worker (forbidden)

  • 409: A screening run is already active for the case (SCREENING_RUN_ACTIVE), the submitted cohort revision is below the case watermark (SCREENING_COHORT_STALE — re-read the case and re-screen), or the partner’s DSA is missing/inactive/expired (DSA_NOT_ACTIVE)

  • 422: A body field whose value does not deserialize, e.g. a non-date as_of (validation-failed; the field is named, the value never echoed), or a cohort_hash that is not 64 bytes, an empty or over-200-byte requested_by_name or one holding a NUL, a negative cohort_revision, or an empty or over-50-member members list (validation-failed)

  • 503: No SSA screening source is registered, or no active partner of its interface is configured, or more than one is (all categorical)

  • 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.


Service-to-service: the case’s latest screening run status

GET /v1/exchange/ssa-screening-runs/latest

Table 37. Parameters
Name In Required Description

case_id

query

Yes

The case id.

Responses
  • 200: The latest run’s status view

  • 400: A malformed query parameter (e.g. a missing or non-UUID case_id) is the extractor’s value-free bad-request problem, before the handler

  • 401: Unauthorized

  • 403: Caller is not the craig-cases service identity

  • 404: The case has never staged a screening run

  • 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.


Service-to-service: operator cancel of one screening run

POST /v1/exchange/ssa-screening-runs/{run_id}/cancel

Table 38. Parameters
Name In Required Description

run_id

path

Yes

Screening run ID

Table 39. Request Fields
Field Type Required Description

case_id

UUID

Yes

The case the run must belong to (the relay’s binding check — a run id from another case answers 404, never a cross-case cancel).

requested_by

UUID

Yes

The acting worker (attribution).

requested_by_name

string

Yes

Display attribution.

Responses
  • 200: Invalidated (or a deterministic already-invalidated replay)

  • 401: Unauthorized

  • 403: Caller is not the craig-cases service identity, the request carries no verified X-Craig-Actor naming a worker (worker-required), or requested_by is not that worker (forbidden)

  • 404: No such run for this case

  • 409: The run is completed and past the freshness horizon — quiesced for archive (a no-op)

  • 422: A body field whose value does not deserialize, e.g. a non-UUID case_id (validation-failed; the field is named, the value never echoed), or an empty or over-200-byte requested_by_name (validation-failed)

  • 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.


POST /v1/exchange/ssa-screening-runs/{run_id}/hold

Table 40. Parameters
Name In Required Description

run_id

path

Yes

Screening run ID

Table 41. Request Fields
Field Type Required Description

reason

string

Yes

Why this run’s records must not be pruned or archived (set) / why the hold is released (clear). A NUL (U+0000), which the audit event’s jsonb cannot store, is a 422 validation-failed on reason.

Responses
  • 200: Held (changed=false is the already-held replay)

  • 401: Unauthorized

  • 403: Service callers and non-admin humans are refused

  • 404: No such run

  • 422: Validation failure (reason length bounds, or a NUL in reason)

  • 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.


DELETE /v1/exchange/ssa-screening-runs/{run_id}/hold

Table 42. Parameters
Name In Required Description

run_id

path

Yes

Screening run ID

Table 43. Request Fields
Field Type Required Description

reason

string

Yes

Why this run’s records must not be pruned or archived (set) / why the hold is released (clear). A NUL (U+0000), which the audit event’s jsonb cannot store, is a 422 validation-failed on reason.

Responses
  • 200: Cleared (changed=false is the already-clear replay)

  • 401: Unauthorized

  • 403: Service callers and non-admin humans are refused

  • 404: No such run

  • 422: Validation failure (reason length bounds, or a NUL in reason)

  • 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.


Transactions

Send outbound data exchange

POST /v1/exchange/send

Table 44. Request Fields
Field Type Required Description

client_request_id

UUID

Yes

Client-minted idempotency id — REQUIRED. Same id + identical intent replays the original 202 with the stored transaction (nothing restaged); a different intent under the same id is a 409 idempotency-conflict.

exchange_type

string

Yes

The transaction’s type token: 1-64 bytes of lowercase ASCII letters, digits, _, . and -, starting with a letter or digit, e.g. case_data. Anything else (a NUL, whitespace, or a control, format or BiDi character included) is a 422 validation-failed on exchange_type; a registered outbound-trigger token is refused as exchange-type-reserved.

partner_id

UUID

Yes

The partner to send to; it must exist and be active.

payload

object

No

The opaque record the partner receives. It may nest at most 32 levels, hold at most 100,000 values, and no string or key longer than 65,536 bytes, and no string or object key in it may contain a NUL (U+0000): otherwise it is a 422 validation-failed on payload.

record_count

integer (optional)

No

Number of records the payload carries, recorded on the transaction as given.

Responses
  • 202: Send accepted; will be dispatched asynchronously by the send-worker (a replay — same client_request_id + intent — returns 202 with the stored transaction, staging nothing)

  • 400: The partner is not active (bad-request), or exchange_type is a registered outbound-trigger token or a collection’s <interface>.<leg> (exchange-type-reserved): a triggered send is staged by its domain event and a collection’s transaction by its run, never by hand

  • 401: Unauthorized

  • 403: Forbidden

  • 404: The partner does not exist (not-found)

  • 409: client_request_id claimed by a different operation, or replayed entity gone

  • 422: Validation failure: a missing client_request_id, an exchange_type outside its grammar or a NUL in payload, or a typed-only adapter kind refusing generic dispatch

  • 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.


List exchange transactions

GET /v1/exchange/transactions

Table 45. Parameters
Name In Required Description

page

query

No

1-based page number; default 1, at most 10000 (a deeper page is a 400).

per_page

query

No

Page size; default 25, capped at 500. 0 returns no rows but still reports total.

partner_id

query

No

Only transactions with this partner.

status

query

No

Only transactions in this status (pending, success or failed).

direction

query

No

Only transactions with this direction (every transaction today is outbound).

origin

query

No

Where the transaction came from: manual — the POST /v1/exchange/send route — trigger — exchange’s own outbound-trigger admission path — collection — a run that fetched what a partner published — or return — a partner’s call to the return listener. Any other token of up to 32 bytes is a typed 400 invalid-enum-value; a longer one fails the query’s length validation first (422 validation-failed).

search

query

No

Full-text search across exchange_type, partner_name.

sort_by

query

No

Sort column: direction, exchange_type (default: initiated_at).

sort_dir

query

No

Sort direction: asc or desc (default: desc).

Responses
  • 200: Page of transactions

  • 400: invalid-enum-value on field origin: origin is not manual, trigger, collection or return; or a generic bad-request on field page past the pagination depth cap

  • 401: Unauthorized

  • 403: Forbidden — including a worker- or supervisor-scoped caller: these rows carry no per-worker ownership, so an assignment scope is refused rather than widened

  • 422: Validation failure (the query): a parameter past its maxLength, an origin longer than 32 bytes included

  • 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 transaction detail

GET /v1/exchange/transactions/{id}

Table 46. Parameters
Name In Required Description

id

path

Yes

Transaction ID

Responses
  • 200: Transaction detail

  • 401: Unauthorized

  • 403: Forbidden

  • 404: Not found

  • 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.


Retry a failed transaction

POST /v1/exchange/transactions/{id}/retry

Table 47. Parameters
Name In Required Description

id

path

Yes

Transaction ID

Responses
  • 200: Transaction retried

  • 400: Not retryable: the transaction does not exist or is not failed (invalid-state-transition), or no worker staged it (exchange-type-reserved): an outbound trigger’s record is assembled at dispatch and a collection run sent nothing, so this route cannot re-send either

  • 401: Unauthorized

  • 403: Forbidden

  • 422: Typed-only adapter kind refuses generic restage

  • 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