Financial & Claims API Reference
Foster care payments, kinship and guardianship subsidies, payment adjustments, rate schedules, and Title IV-E fiscal claiming under the Social Security Act.
Endpoints
AFCARS Export
Service-to-service: one page of the children AFCARS element (b)(18) answers yes for, over a window
GET /v1/financial/afcars-facts
The children with a title IV-E foster care maintenance payment issued in [from, to) with Federal reimbursement claimed or intended (§1355.44(b)(18)): a per-diem payment (no subsidy agreement) whose status is issued or cleared, whose IV-E share as it stood at as_of is above zero, and whose issued_at is in [from, to) and at or before as_of. The share at as_of is the stored net_amount less the adjustments approved after as_of, times ffp_rate, rounded as ffp_amount is, so an approval recorded after as_of does not move the answer; status needs no history, since a payment issued at or before as_of was issued then and can only have become cleared. Every column answers as of as_of, so the pages of one walk agree. Distinct child ids, ascending, paged by child id. from and to are local midnights on the jurisdiction clock; as_of is at least five minutes in the past and is held fixed across one walk. An absent child is (b)(18) no. Cache-Control: no-store. No audit (ids only). Service-only: craig-reporting only; a relayed actor is refused.
| Name | In | Required | Description |
|---|---|---|---|
from |
query |
Yes |
The window’s first instant, inclusive: a local midnight (RFC 3339). |
to |
query |
Yes |
The window’s end, exclusive: a local midnight after |
as_of |
query |
Yes |
The instant payments are fenced at: at least five minutes in the past (RFC 3339). Hold it fixed across every page of one walk. |
after |
query |
No |
The previous page’s |
limit |
query |
No |
Child ids per page, |
-
200: One page of child ids;
next= the last child’s opaque cursor when the page is full, null on exhaustion.Cache-Control: no-store -
400:
bad-requestnaming the field:from/tonot a local midnight,fromnot beforeto,as_ofless than five minutes in the past,limitoutside 1..=1000, or a malformedaftercursor. A malformed, missing or unknown query parameter is the extractor’s value-freebad-requestproblem -
401: Missing or invalid bearer
-
403: Not the bare craig-reporting service principal: not a service caller, another service identity, or a delegated (actor) token
-
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.
Adjustments
List payment adjustments
GET /v1/financial/adjustments
| Name | In | Required | Description |
|---|---|---|---|
page |
query |
No |
1-based page number (default 1); a page past 10000 is refused with 400. |
per_page |
query |
No |
Rows per page (default 25, capped at 500); 0 returns only the total. |
search |
query |
No |
Full-text search across reason, status, |
sort_by |
query |
No |
Sort column: status, reason, amount (default: |
sort_dir |
query |
No |
Sort direction: asc or desc (default: desc). |
-
200: Page of adjustments
-
400: A page past the depth cap; a malformed query parameter (e.g. a non-integer
page) is the extractor’s value-freebad-requestproblem, before the handler -
401: Unauthorized
-
403: Forbidden
-
422: A filter over its length cap:
search500,sort_by/sort_dir32 bytes; or a NUL (U+0000) insearch(validation-failednaming the parameter, 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 a payment adjustment
GET /v1/financial/adjustments/{id}
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Adjustment ID |
-
200: Payment adjustment
-
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.
Delete a pending payment adjustment
DELETE /v1/financial/adjustments/{id}
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Adjustment ID |
-
204: Adjustment deleted
-
400: Adjustment is not pending (
invalid-state-transition) -
401: Unauthorized
-
403: Forbidden
-
404: Not found
-
409: The adjustment left pending after it was read: a concurrent transition won (
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.
Approve a payment adjustment
PUT /v1/financial/adjustments/{id}/approve
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Adjustment ID |
-
200: Adjustment approved
-
400: Invalid state transition
-
401: Unauthorized
-
403: Forbidden
-
404: Not found
-
409: Status moved concurrently since your read, the parent payment is aggregated by a submitted/accepted claim —
claimed-payment-frozen— or the approval would drive net_amount below zero —net-amount-floor -
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.
Deny a payment adjustment
PUT /v1/financial/adjustments/{id}/deny
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Adjustment ID |
-
200: Adjustment denied (terminal — the resolver is recorded in the approved_by/approved_at columns, which record the RESOLVER for both outcomes)
-
400: Invalid state transition
-
401: Unauthorized
-
403: Forbidden
-
404: Not found
-
409: Status moved concurrently since your read — 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.
Create a payment adjustment
POST /v1/financial/payments/{id}/adjustments
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Payment ID |
| Field | Type | Required | Description |
|---|---|---|---|
amount |
string |
Yes |
Signed adjustment amount (negative for a clawback; rides the wire as a
string via |
client_request_id |
UUID |
Yes |
Client-minted idempotency id — REQUIRED. Same id + identical intent replays the original adjustment; a different intent under the same id is a 409 idempotency-conflict. |
reason |
string |
Yes |
Free-text justification for the adjustment. A NUL (U+0000), which the
column cannot store, is a 422 |
-
200: Adjustment created (or replayed — same client_request_id + intent)
-
401: Unauthorized
-
403: Forbidden
-
404: Payment not found
-
409: client_request_id claimed by a different operation, or replayed entity gone
-
422: Validation failure (
validation-failed): a missingclient_request_id,reasonover 1000 bytes or containing a NUL (U+0000), or an out-of-rangeamount -
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/financial/jobs/{id}
The generic read-only poll of a financial background job: the job as a LOGICAL resource — state (queued / running / succeeded / failed; the last two are terminal and immutable), the current attempt and the attempts[] ledger (an interrupted / crash attempt re-queues a convergent kind up to max_attempts), the typed progress document (phase = waiting_for_lease while the hourly scheduled generator holds the subsidy-gen lease — a 5 s re-dispatch, never a failure; done = children checkpointed in the running attempt), result (the kind’s report — for subsidy_generate the GenerationReport the route answered as its 200 body before generation became a background job — present iff succeeded), error (a CLOSED token + a categorical detail — exhausted after three crashed / interrupted attempts, engine_failed naming the engine error’s variant — present iff failed), and resource when the kind links its own row. Authorized on the BackgroundJob resource type: admin realm-flat, the creator (human or service principal) by assigned_worker_sub; another actor is the fleet’s typed 403; an unknown id is 404 (no existence collapse — the row is looked up before the check). Cache-Control: no-store. Never writes.
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Job id — the last segment of the |
-
200: The job (
Cache-Control: no-store) -
401: Unauthorized
-
403: Forbidden — not the creator and not 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.
Claims
List claiming records
GET /v1/financial/claims
| Name | In | Required | Description |
|---|---|---|---|
page |
query |
No |
1-based page number (default 1); a page past 10000 is refused with 400. |
per_page |
query |
No |
Rows per page (default 25, capped at 500); 0 returns only the total. |
claiming_period |
query |
No |
Filter by claiming period. A NUL (U+0000), which the query’s |
payment_type |
query |
No |
Filter by payment type. A NUL (U+0000), which the query’s |
status |
query |
No |
Filter by claim status. A NUL (U+0000), which the query’s |
search |
query |
No |
Full-text search across |
sort_by |
query |
No |
Sort column: |
sort_dir |
query |
No |
Sort direction: asc or desc (default: desc). |
-
200: Page of claiming records
-
400: A page past the depth cap; a malformed query parameter (e.g. a non-integer
page) is the extractor’s value-freebad-requestproblem, 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:
claiming_period/payment_type64,status/sort_by/sort_dir32,search500 bytes; or a NUL (U+0000) inclaiming_period,payment_type,status, orsearch(validation-failednaming the parameter, 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.
Generate a claiming record from disbursed (issued or cleared) payments
POST /v1/financial/claims/generate
| Field | Type | Required | Description |
|---|---|---|---|
ccwis_operations_cost |
string |
No |
CCWIS operations cost rolled into the claim (defaults to zero; rides the
wire as a string via |
claiming_period |
string |
Yes |
Claiming-period label (e.g. |
client_request_id |
UUID |
Yes |
Client-minted idempotency id — REQUIRED. Same id + identical intent replays the ORIGINAL claiming record (its aggregated money as of the first execution — never recomputed); a different intent under the same id is a 409 idempotency-conflict. |
payment_type |
string |
Yes |
Payment type the claim covers. A NUL (U+0000), which the column and
aggregate query cannot store or bind, is a 422 |
period_end |
date |
Yes |
Last day of the claiming period (inclusive). |
period_start |
date |
Yes |
First day of the claiming period (inclusive). |
-
200: Claiming record generated (a replay returns the ORIGINAL record — same client_request_id + intent; the money is never recomputed)
-
401: Unauthorized
-
403: Forbidden
-
409: client_request_id claimed by a different operation, or replayed entity gone
-
422: Validation failure (
validation-failed): a missingclient_request_id,claiming_period/payment_typeover 64 bytes or containing a NUL (U+0000), or an invalidccwis_operations_cost -
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 claiming record by ID
GET /v1/financial/claims/{id}
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Claiming record ID |
-
200: Claiming record details, including the build-time exclusion evidence
-
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.
Record federal acceptance of a submitted claiming record
PUT /v1/financial/claims/{id}/accept
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Claiming record ID |
-
200: Federal acceptance recorded (actor + timestamp frozen onto the record)
-
400: Invalid state transition
-
401: Unauthorized
-
403: Forbidden
-
404: Not found
-
409: Status moved concurrently since your read — 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.
Submit a draft claiming record
PUT /v1/financial/claims/{id}/submit
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Claiming record ID |
-
200: Claiming record submitted
-
400: Invalid state transition
-
401: Unauthorized
-
403: Forbidden
-
404: Not found
-
409: Status moved concurrently since your read, or the draft’s totals are stale / its window unrecorded —
claim-totals-stale: regenerate before submitting -
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.
| Name | In | Required | Description |
|---|---|---|---|
from |
query |
Yes |
RFC 3339 inclusive lower bound on |
to |
query |
Yes |
RFC 3339 inclusive upper bound on |
event_type |
query |
No |
Optional |
dry_run |
query |
No |
If true, return the would-replay count without modifying rows. |
resume_from |
query |
No |
The |
-
200: The window’s count and what this call re-staged
-
400:
bad-request: a malformed or missingfrom/to, a non-booleandry_run,fromafterto,fromolder than the outbox retention window, or aresume_fromthat is not a replay cursor (fieldnames 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_typelonger 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.
Foster Portal
One unit’s payments as the caregiver may see them
GET /v1/financial/portal/units/{unit}/payments
Portal channel only. The unit must be one of the relayed subject’s CURRENT caregiver units — resolved against craig-placement on every request (no cache); no current binding → 403, a unit outside the set → 404, placement not answering → 503 portal-bindings-unavailable. Rows are a home’s per-diem payments plus the subsidy payments of agreements the bound person signed; a kinship household has no per-diem rows; its subsidy rows are those of agreements anchored on any of its arrangements but cancelled ones. Newest period first. Each row carries exactly payment_id, child_id, payment_type, period_start, period_end, day_count, net_amount, status, issued_at — nothing else.
| Name | In | Required | Description |
|---|---|---|---|
unit |
path |
Yes |
Unit id (foster home or kinship household) |
page |
query |
No |
1-based page number; defaults to 1. |
per_page |
query |
No |
Items per page; defaults to 25, hard-clamped to 500. |
-
200: Page of the unit’s payments
-
400: Page depth past the cap; a malformed query parameter (e.g. a non-integer
page) is the extractor’s value-freebad-requestproblem, before the handler -
401: Unauthorized
-
403: Not the portal channel, or no current caregiver binding
-
404: Not one of the subject’s units
-
503: craig-placement did not answer the bindings read (
portal-bindings-unavailable) -
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.
Payments
List payments
GET /v1/financial/payments
| Name | In | Required | Description |
|---|---|---|---|
page |
query |
No |
1-based page number (default 1); a page past 10000 is refused with 400. |
per_page |
query |
No |
Rows per page (default 25, capped at 500); 0 returns only the total. |
case_id |
query |
No |
Only payments for this case. |
foster_home_id |
query |
No |
Only placement payments to this foster home. |
agreement_id |
query |
No |
Narrow to one subsidy agreement’s payment stream. |
child_id |
query |
No |
Narrow to one child (spans both origins). |
status |
query |
No |
Filter by payment status. A NUL (U+0000), which the query’s |
period_start |
query |
No |
Only payments whose period starts on or after this date. |
period_end |
query |
No |
Only payments whose period ends on or before this date. |
ive_eligible |
query |
No |
Only payments with this Title IV-E eligibility flag. |
search |
query |
No |
Full-text search across status, |
sort_by |
query |
No |
Sort column: status, |
sort_dir |
query |
No |
Sort direction: asc or desc (default: desc). |
-
200: Page of payments
-
400: A page past the depth cap; a malformed query parameter (e.g. a non-UUID
case_id) is the extractor’s value-freebad-requestproblem, before the handler -
401: Unauthorized
-
403: Forbidden
-
422: A filter over its length cap:
status/sort_by/sort_dir32,search500 bytes; or a NUL (U+0000) instatusorsearch(validation-failednaming the parameter, 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.
Calculate a payment preview
POST /v1/financial/payments/calculate
Looks up the applicable rate and calculates a payment preview without persisting.
| Field | Type | Required | Description |
|---|---|---|---|
case_id |
UUID |
Yes |
Case the payment belongs to. |
child_age |
integer |
Yes |
Child’s age, used to select the matching rate band (0..=21 — the extended-IV-E ceiling; out-of-band ages refuse typed instead of silently matching no rate). |
child_id |
UUID |
Yes |
Child the payment is for. |
foster_home_id |
UUID |
Yes |
Foster home receiving the payment. |
jurisdiction |
string |
Yes |
Jurisdiction whose rate table applies. A NUL (U+0000), which the
rate-lookup |
payment_type |
string |
Yes |
Payment type (e.g. |
period_end |
date |
Yes |
Last day of the payment period (inclusive). |
period_start |
date |
Yes |
First day of the payment period (inclusive). |
placement_id |
UUID |
Yes |
Placement the payment derives from. |
-
200: Payment preview
-
401: Unauthorized
-
403: Forbidden
-
404: No applicable rate found
-
422: A body field whose value does not deserialize, e.g. a non-date
period_start(validation-failed; the field is named, the value never echoed), or apayment_type/jurisdictionover 64 bytes or containing a NUL (U+0000), or achild_ageoutside 0..=21 (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.
Get payment by ID
GET /v1/financial/payments/{id}
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Payment ID |
-
200: Payment 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.
Approve a pending payment
PUT /v1/financial/payments/{id}/approve
Advances pending → approved atomically and stages financial.payment_approved in the same transaction.
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Payment ID |
-
200: Payment approved
-
400: Invalid state transition
-
401: Unauthorized
-
403: Forbidden
-
404: Not found
-
409: Concurrent modification
-
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.
Clear an issued payment
PUT /v1/financial/payments/{id}/clear
Records reconciliation clearance: advances issued → cleared atomically and stages financial.payment_cleared in the same transaction.
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Payment ID |
-
200: Payment cleared
-
400: Invalid state transition
-
401: Unauthorized
-
403: Forbidden
-
404: Not found
-
409: Concurrent modification
-
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.
Issue an approved payment
PUT /v1/financial/payments/{id}/issue
Records disbursement: advances approved → issued atomically and stages financial.payment_issued in the same transaction. Issued payments enter Title IV-E claim aggregation.
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Payment ID |
-
200: Payment issued
-
400: Invalid state transition
-
401: Unauthorized
-
403: Forbidden
-
404: Not found
-
409: Concurrent modification
-
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.
Void an undisbursed payment (deliberate manual void)
PUT /v1/financial/payments/{id}/void
Voids a single pending/approved payment atomically, stamping who/when/why on the row and staging financial.payment_voided in the same transaction. issued/cleared payments are refused (typed 400 disbursed-payment-void): disbursed IV-E funds are corrected via payment adjustments, never clawed back — the same policy boundary as the system bulk voids. The reason stays on the row; it never rides the event.
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Payment ID |
| Field | Type | Required | Description |
|---|---|---|---|
reason |
string |
Yes |
Why this payment is being voided (data-entry error, duplicate, …).
Must contain at least one non-whitespace character; a NUL (U+0000),
which the column cannot store, is a 422 |
-
200: Payment voided
-
400: Already voided (invalid-state-transition), disbursed (disbursed-payment-void), or validation failure
-
401: Unauthorized
-
403: Forbidden
-
404: Not found
-
409: Defensive arm: a still-voidable row after a zero-row CAS miss — unreachable today (no writer reverses payment status)
-
422: Validation failure (
validation-failed): blank, oversized, or NUL-bearing (U+0000)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.
Enqueue subsidy payment generation for one month
POST /v1/financial/subsidy-payments/generate
Enqueues ONE reconcile-then-generate run of the monthly subsidy payment stream as a background job. Body = { client_request_id, month? } (the id is REQUIRED; the same id replays the SAME job whatever its state, a fresh id is a new job; any other field is 422 validation-failed; month is a YYYY-MM token, omitted = the current month on the jurisdiction’s business clock, bounded to the last 12 months — out of range is 400 invalid-date). Gated on the subsidy-writes capability: 400 unsupported-jurisdiction when the jurisdiction’s state bundle does not declare subsidy writes. Answers 202 with Location: /v1/financial/jobs/{id} and the job (state = queued); poll the Location until succeeded (result = the GenerationReport this route answered as its 200 body before generation became a background job — partial success is still success: per-child failures count into errors and the run continues) or failed (error.token closed: exhausted after three crashed / interrupted attempts, engine_failed naming the engine error’s variant, or engine_failed with detail below_reconcile_floor when the month fell below the 12-month floor between the enqueue and an attempt — terminal, nothing is written; re-POST only for a month inside the bound). Every generated row is attributed to the enqueuing worker (created_by / created_by_name), and the run writes ONE subsidy_generation_runs row carrying the job id + attempt. A second enqueue for the same month while one is queued or running is 409 job-already-active (other months queue behind it — every month’s job holds the subsidy-gen lease, one running month per instance); the hourly scheduled tick holding that lease is NOT a refusal — the attempt waits for it (progress.phase = waiting_for_lease). Authorized as approve on the subsidy-agreement collection; the check, the jurisdiction gate and the month bound run synchronously BEFORE the claim (a refusal mints nothing).
| Field | Type | Required | Description |
|---|---|---|---|
client_request_id |
UUID |
Yes |
The client-minted operation id. Mint one per invocation; re-send the same id ONLY to resume polling the same job. |
month |
string (optional) |
No |
Target month as a canonical |
-
202: Run enqueued (or a replay of the stored job — nothing re-enqueued);
Location=/v1/financial/jobs/{id} -
400: Out-of-range month (
invalid-date) or unsupported jurisdiction (unsupported-jurisdiction) -
401: Unauthorized
-
403: Forbidden
-
409: A generation for this month is already queued or running in this jurisdiction (
job-already-active), or this client_request_id was used with a different intent (idempotency-conflict) -
422: Validation failure — a malformed month token, a missing
client_request_idor a forged field (validation-failed) -
500: Internal error
-
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.
Rates
List payment rate tables
GET /v1/financial/rates
| Name | In | Required | Description |
|---|---|---|---|
page |
query |
No |
1-based page number (default 1); a page past 10000 is refused with 400. |
per_page |
query |
No |
Rows per page (default 25, capped at 500); 0 returns only the total. |
jurisdiction |
query |
No |
Filter by jurisdiction. A NUL (U+0000), which the query’s |
payment_type |
query |
No |
Filter by payment type. A NUL (U+0000), which the query’s |
search |
query |
No |
Full-text search across jurisdiction, |
sort_by |
query |
No |
Sort column: jurisdiction, |
sort_dir |
query |
No |
Sort direction: asc or desc (default: desc). |
-
200: Page of rate tables
-
400: A page past the depth cap; a malformed query parameter (e.g. a non-integer
page) is the extractor’s value-freebad-requestproblem, 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:
jurisdiction/payment_type64,search500,sort_by/sort_dir32 bytes; or a NUL (U+0000) injurisdiction,payment_type, orsearch(validation-failednaming the parameter, 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.
Create a payment rate table entry
POST /v1/financial/rates
| Field | Type | Required | Description |
|---|---|---|---|
age_max |
integer |
Yes |
Inclusive upper bound of the child-age band the rate applies to (0..=21). |
age_min |
integer |
Yes |
Inclusive lower bound of the child-age band the rate applies to (0..=21 — the extended-IV-E ceiling; band ordering is the handler’s cross-field check). |
client_request_id |
UUID |
Yes |
Client-minted idempotency id — REQUIRED. Same id + identical intent replays the original rate row; a different intent under the same id is a 409 idempotency-conflict. |
daily_rate |
string |
Yes |
Daily maintenance rate (rides the wire as a string via |
effective_date |
date |
Yes |
Date the rate becomes effective (window ordering vs |
end_date |
date (optional) |
No |
Optional date the rate stops applying (open-ended when absent). |
jurisdiction |
string |
Yes |
Jurisdiction the rate applies to. A NUL (U+0000), which the column
cannot store, is a 422 |
payment_type |
string |
Yes |
Payment type the rate covers (e.g. |
-
200: Rate 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 (
validation-failed): a missingclient_request_id,jurisdiction/payment_typeover 64 bytes or containing a NUL (U+0000), or an out-of-rangeage_min,age_max, ordaily_rate -
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 a rate table entry
GET /v1/financial/rates/{id}
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Rate ID |
-
200: Rate table entry
-
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 a rate table entry
PUT /v1/financial/rates/{id}
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Rate ID |
If-Match |
header |
Yes |
REQUIRED row version from your last read, e.g. |
| Field | Type | Required | Description |
|---|---|---|---|
age_max |
integer (optional) |
No |
New age-band upper bound, or unchanged when absent (0..=21). |
age_min |
integer (optional) |
No |
New age-band lower bound, or unchanged when absent (0..=21). |
daily_rate |
string (optional) |
No |
New daily rate, or unchanged when absent (positive,
≤ 2 dp, bounded — same rules as create; |
effective_date |
date (optional) |
No |
New effective date, or unchanged when absent. |
end_date |
date (optional) |
No |
|
jurisdiction |
string (optional) |
No |
New jurisdiction, or unchanged when absent. A NUL (U+0000), which the
column cannot store, is a 422 |
payment_type |
string (optional) |
No |
New payment type, or unchanged when absent. A NUL (U+0000), which the
column cannot store, is a 422 |
-
200: Rate updated
-
400: Missing or malformed If-Match
-
401: Unauthorized
-
403: Forbidden
-
404: Not found (including a tombstoned rate)
-
409: Version moved since your read (stale If-Match) — re-read and retry
-
422: A body field whose value does not deserialize, e.g. a non-date
effective_date(validation-failed; the field is named, the value never echoed), or ajurisdiction/payment_typeover 64 bytes or containing a NUL (U+0000), anage_min/age_maxoutside 0..=21, or adaily_ratethat is not positive, carries more than two decimal places or exceeds the money bound (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 rate table entry
DELETE /v1/financial/rates/{id}
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Rate ID |
-
204: Rate deleted
-
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.
Subsidy Agreements
List subsidy agreements
GET /v1/financial/subsidy-agreements
Pages agreement summaries (identity + current term). Enum filter tokens are validated up front (unknown → 400); a caller whose list scope resolves to denied receives an explicit 403, never an empty page.
| Name | In | Required | Description |
|---|---|---|---|
page |
query |
No |
1-based page number (default 1); a page past 10000 is refused with 400. |
per_page |
query |
No |
Rows per page (default 25, capped at 500); 0 returns only the total. |
child_id |
query |
No |
Filter by the subsidized child. |
case_id |
query |
No |
Filter by owning case. |
program |
query |
No |
Program token ( |
current_status |
query |
No |
Projection-status token (e.g. |
-
200: Page of subsidy-agreement summaries
-
400: Unrecognized program / status filter token, or a page past the depth cap; a malformed query parameter (e.g. a non-UUID
child_id) is the extractor’s value-freebad-requestproblem, before the handler -
401: Unauthorized
-
403: Forbidden — including a denied list scope
-
422: Query 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.
Native subsidy enrollment, program-tagged (ERR / guardianship)
POST /v1/financial/subsidy-agreements
-
200: The created agreement’s full detail (also the exact-replay response)
-
400: Wire validation / placement eligibility / date-rule / per-diem-conflict failure, a signatory craig-cases does not know (the detail names the index), a signatory who is not a current caregiver of the placement’s unit on the enrollment date (only with CRAIG_FINANCIALSUBSIDY_CAREGIVER_CHECKENABLED; the detail names the index) — or an age refusal on the ERR arm (over-age at the coverage-start basis date, DOB missing/invalid, child not found)
-
401: Missing or invalid token
-
403: Authorization denied, the ERR feature gate is OFF (the detail names the knob), or craig-rules refused the relayed eligibility consult
-
409: Same client_request_id with a different payload, or an open episode already exists
-
422: sg / nrsg: the anchoring placement’s setting is not caregiving (
subsidy-anchor-not-caregiving; the detail names the setting); a body that does not deserialize (e.g. an unknownprogram) or a stored text field carrying a NUL (U+0000) is a value-freevalidation-failedproblem -
503: craig-placement, craig-cases, or craig-rules unreachable — the placement/age/signatories cannot be verified (fail-closed); with the caregiver check ON, a placement read carrying no caregiver facts (
PORTAL_BINDINGS_UNAVAILABLE); The administrative-authority surface is not verified or its evaluator is unavailable (SUBSIDY_AUTHORITY_NOT_READY; the detail is the closed reason token) — every human approval act resolves its floor from the jurisdiction family; 403SUBSIDY_AUTHORITY_UNCONFIGUREDwhen the family has no row for the act -
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 a subsidy agreement by ID
GET /v1/financial/subsidy-agreements/{id}
Full agreement detail: identity + provenance, signatory parties, and the complete term-revision and status-interval ledgers (each ordered (effective_from, id)).
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Subsidy agreement ID |
-
200: Subsidy agreement 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.
Witnessed guardianship activation
POST /v1/financial/subsidy-agreements/{id}/activate
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Agreement id |
| Field | Type | Required | Description |
|---|---|---|---|
court_order_evidence_key |
string |
Yes |
UNVERIFIED evidence reference: the permanent-guardianship court
order (required non-blank). A NUL (U+0000), which the column cannot
store, is a 422 |
expected_head_interval_id |
UUID |
Yes |
CAS: the open pending head interval the caller decided on. |
legal_reference |
string (optional) |
No |
Court order / docket reference — NULL→value records it; a value
DIFFERENT from the recorded one is a typed conflict. A NUL (U+0000),
which the column cannot store, is a 422 |
tanf_terminated_on |
date (optional) |
No |
Operator ATTESTATION (unverified, past-dated): the date TANF for the child terminated, when the caregiver received it — shifts the money boundary later. TANF still active ⇒ activate after it ends (runbook). |
-
200: The activated agreement’s detail (also the recognized-replay response)
-
400: Witness failure: placement still active / no guardianship exit from the placement / exit reason not guardianship / exit day differs from the residence run’s end day / no residence run served / child mismatch / reunification goal / signing, residence-floor or date-window refusal — or an age refusal (over-age at the transfer basis date, DOB missing/invalid, child not found) — or, with CRAIG_FINANCIALSUBSIDY_CAREGIVER_CHECKENABLED, a persisted party who is not a current caregiver of the placement’s unit at the transfer (the detail names the party index)
-
401: Missing or invalid token
-
403: Authorization denied, the SG feature gate is OFF (the detail names the knob), or craig-rules refused the relayed eligibility consult
-
404: Agreement not found
-
409: Stale head (CAS — incl. a mismatched retry after success), a differing legal reference, an open sibling agreement, or the agreement re-anchored to another placement after its transfer was witnessed (
concurrent-modification; re-read and retry) -
422: A body field whose value does not deserialize, e.g. a non-UUID
expected_head_interval_id, or a NUL (U+0000) incourt_order_evidence_keyorlegal_reference(validation-failed; the field is named, the value never echoed) -
503: craig-placement, craig-cases, or craig-rules unreachable — the transfer/age cannot be verified (fail-closed); the craig-cases permanency-plan lookup unreachable or past its 4 s budget — the child’s plan at the transfer cannot be verified (fail-closed); with the caregiver check ON, a placement read carrying no caregiver facts (
PORTAL_BINDINGS_UNAVAILABLE); The administrative-authority surface is not verified or its evaluator is unavailable (SUBSIDY_AUTHORITY_NOT_READY; the detail is the closed reason token) — every human approval act resolves its floor from the jurisdiction family; 403SUBSIDY_AUTHORITY_UNCONFIGUREDwhen the family has no row for the act -
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 /financial/subsidy-agreements/{id}/reviews — schedule the
type’s open slot. Replay with the open slot’s due → 200 with the existing row (no event); a different due → 409 naming it.
POST /v1/financial/subsidy-agreements/{id}/reviews
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Agreement id |
| Field | Type | Required | Description |
|---|---|---|---|
due_on |
date |
Yes |
Statutory due date for the slot. |
review_type |
string |
Yes |
Review type token: |
-
200: The open slot (created or replayed)
-
400: Validation / window-authority failure
-
401: Missing or invalid token
-
403: Authorization denied
-
404: Agreement not found
-
409: An open slot exists with a different due
-
422: A body field whose value does not deserialize, e.g. a non-date
due_on(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 — or the administrative-authority surface is not verified or its evaluator is unavailable (
SUBSIDY_AUTHORITY_NOT_READY; the detail is the closed reason token) — every human approval act resolves its floor from the jurisdiction family; 403SUBSIDY_AUTHORITY_UNCONFIGUREDwhen the family has no row for the act -
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 /financial/subsidy-agreements/{id}/reviews/{review_id}/completion
— complete a review with its linkage orchestrated in ONE transaction:
a continued/amended RENEWAL re-signs (term append, kind
Renewal) and links resulting_term_id; suspended/terminated outcomes
perform the CAS transition and link resulting_interval_id. An
identical replay returns the prior record (200); a differing one is a
409 — the fingerprint check runs BEFORE any append/transition, so a
replay can never duplicate a revision.
POST /v1/financial/subsidy-agreements/{id}/reviews/{review_id}/completion
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Agreement id |
review_id |
path |
Yes |
The open slot being completed |
| Field | Type | Required | Description |
|---|---|---|---|
completed_on |
date |
Yes |
Business date the review was completed (never in the future). |
evidence_document_key |
string (optional) |
No |
Object-store key of supporting verification evidence (untrusted reference; namespace-shape validated at the API). |
outcome |
string |
Yes |
Outcome token: |
terms |
ReviewTermsPayload (optional) |
No |
Terms |
transition |
ReviewTransitionPayload (optional) |
No |
Transition |
-
200: The completed review record
-
400: Shape / authority / validation failure
-
401: Missing or invalid token
-
403: Authorization denied
-
404: Agreement or review not found
-
409: Differing replay, superseded slot, or stale CAS head
-
422: A body field whose value does not deserialize, e.g. a non-date
completed_on, or a NUL (U+0000) interms.amount_basis,terms.education_basis,terms.education_verified_by, ortransition.note(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 — or the administrative-authority surface is not verified or its evaluator is unavailable (
SUBSIDY_AUTHORITY_NOT_READY; the detail is the closed reason token) — every human approval act resolves its floor from the jurisdiction family; 403SUBSIDY_AUTHORITY_UNCONFIGUREDwhen the family has no row for the act -
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 /financial/subsidy-agreements/{id}/reviews/{review_id}/reschedule
— audited supersession + same-cycle successor. Idempotent on
(slot, new_due_on); the successor’s due obeys the natural window.
POST /v1/financial/subsidy-agreements/{id}/reviews/{review_id}/reschedule
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Agreement id |
review_id |
path |
Yes |
The slot being superseded |
| Field | Type | Required | Description |
|---|---|---|---|
new_due_on |
date |
Yes |
The successor slot’s due date (same cycle — cycle is the identity; due dates are data). |
reason |
string |
Yes |
Why the due date moved — retained forever on the superseded row’s
audit triple. A NUL (U+0000), which the column cannot store, is a 422
|
-
200: The live successor slot
-
400: Validation / window-authority failure
-
401: Missing or invalid token
-
403: Authorization denied
-
404: Agreement or review not found
-
409: Slot completed, or superseded with a different due
-
422: A body field whose value does not deserialize, e.g. a non-date
new_due_on, or a NUL (U+0000) inreason(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 — or the administrative-authority surface is not verified or its evaluator is unavailable (
SUBSIDY_AUTHORITY_NOT_READY; the detail is the closed reason token) — every human approval act resolves its floor from the jurisdiction family; 403SUBSIDY_AUTHORITY_UNCONFIGUREDwhen the family has no row for the act -
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 /financial/subsidy-agreements/{id}/terms — CAS terms
amendment. The request carries NO anchor fields: the store
derives renewal_review_due/paper_review_due (anchor
preservation) — the head’s values below are placeholders it
overwrites.
POST /v1/financial/subsidy-agreements/{id}/terms
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Agreement id |
| Field | Type | Required | Description |
|---|---|---|---|
amount_basis |
string |
Yes |
Rate-schedule citation backing the amount. A NUL (U+0000), which the
column cannot store, is a 422 |
education_basis |
string (optional) |
No |
Extension basis (school/GED enrollment description), when the
flag is set. A NUL (U+0000), which the column cannot store, is a 422
|
education_expires_on |
date (optional) |
No |
Date the education verification lapses, when the flag is set. |
education_extension |
boolean |
Yes |
Age-19 school/GED extension flag (22.8). |
education_verified_by |
string (optional) |
No |
Worker who verified the education basis, when the flag is set. A NUL
(U+0000), which the column cannot store, is a 422 |
effective_from |
date |
Yes |
Business-effective start of the appended revision (closes the current revision at the same date — half-open windows). |
expected_head_term_id |
UUID |
Yes |
The open term revision the caller last read — the
optimistic-concurrency token the store compares-and-swaps on
(stale → typed 409; retry-after-success → 409, see
|
monthly_amount |
string |
Yes |
New monthly subsidy amount (Decimal wire string, e.g. |
-
200: The new term revision
-
400: Validation / supervisor-session / office-authority failure, or unsupported jurisdiction (the jurisdiction’s state bundle does not declare subsidy writes)
-
401: Missing or invalid token
-
403: Authorization denied
-
404: Agreement not found
-
409: Stale head term (CAS) — re-read and retry
-
422: A body field whose value does not deserialize, e.g. a non-boolean
education_extension, or a NUL (U+0000) inamount_basis,education_basis, oreducation_verified_by(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 — or the administrative-authority surface is not verified or its evaluator is unavailable (
SUBSIDY_AUTHORITY_NOT_READY; the detail is the closed reason token) — every human approval act resolves its floor from the jurisdiction family; 403SUBSIDY_AUTHORITY_UNCONFIGUREDwhen the family has no row for the act -
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 /financial/subsidy-agreements/{id}/transitions — CAS status
transition. Rejects pending → active outright: activation
requires eligibility evidence and ships with the ERR and guardianship flows.
POST /v1/financial/subsidy-agreements/{id}/transitions
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Agreement id |
| Field | Type | Required | Description |
|---|---|---|---|
business_date |
date |
Yes |
Business-effective start of the new interval (strictly after the open head’s start, never in the future). |
expected_head_interval_id |
UUID |
Yes |
The open status interval the caller last read — the optimistic-concurrency token the store compares-and-swaps on. |
note |
string (optional) |
No |
Free-text protected note carried on the interval (never traced).
A NUL (U+0000), which the column cannot store, is a
422 |
reason_code |
string (optional) |
No |
Controlled-vocabulary cause — required for reason statuses (suspended/terminated/withdrawn/declined), forbidden otherwise; membership is validated server-side. |
to_status |
string |
Yes |
Target status token ( |
-
200: The new head interval
-
400: Validation / vocabulary / office-authority failure, or unsupported jurisdiction (the jurisdiction’s state bundle does not declare subsidy writes)
-
401: Missing or invalid token
-
403: Authorization denied
-
404: Agreement not found
-
409: Stale head (CAS) — re-read and retry
-
422: A body field whose value does not deserialize, e.g. a non-date
business_date, or a NUL (U+0000) innote(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 — or the administrative-authority surface is not verified or its evaluator is unavailable (
SUBSIDY_AUTHORITY_NOT_READY; the detail is the closed reason token) — every human approval act resolves its floor from the jurisdiction family; 403SUBSIDY_AUTHORITY_UNCONFIGUREDwhen the family has no row for the act -
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.
Enqueue a review-sweep preview (backgrounded)
POST /v1/financial/subsidy-reviews/sweep/preview
Enqueues ONE sweep_preview job: the attempt collects the current actionable sets as of the jurisdiction’s business today and pins them into a previewed run row written in the SAME transaction that completes the job (result = the pinned sets with token_state: available; resource = the run). NO token rides the result: issue it exactly once with POST /v1/financial/subsidy-reviews/sweep/runs/{run_id}/token inside the run’s 15-minute window, then execute. Body = { client_request_id } (REQUIRED; the same id replays the SAME job whatever its state, never a fresh token; a fresh id is a new job; any other field is 422 validation-failed). One active preview per jurisdiction: a second enqueue while one is queued or running is 409 job-already-active. Authz, the subsidy-writes gate and the claim run synchronously (a refusal mints nothing). Answers 202 with Location: /v1/financial/jobs/{id} and the job.
| Field | Type | Required | Description |
|---|---|---|---|
client_request_id |
UUID |
Yes |
Client-minted idempotency id — REQUIRED.
Replaying it returns the SAME |
-
202: Preview enqueued (or a replay of the stored job — nothing re-enqueued);
Location=/v1/financial/jobs/{id} -
400: Unsupported jurisdiction (the jurisdiction’s state bundle does not declare subsidy writes)
-
401: Missing or invalid token
-
403: Authorization denied
-
409: A preview is already queued or running in this jurisdiction (
job-already-active), or this client_request_id was used with a different intent (idempotency-conflict) -
422: Validation failure — a missing
client_request_idor a forged field (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.
GET /financial/subsidy-reviews/sweep/runs — recent run records,
newest first (the operator surface).
GET /v1/financial/subsidy-reviews/sweep/runs
| Name | In | Required | Description |
|---|---|---|---|
limit |
query |
No |
Max rows (default 50, clamped 1..=200). |
-
200: Recent sweep runs
-
400: A malformed query parameter (e.g. a non-integer
limit) is the extractor’s value-freebad-requestproblem, before the handler -
401: Missing or invalid token
-
403: Authorization 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.
GET /financial/subsidy-reviews/sweep/runs/{run_id} — one run
record (the job’s resource link target).
GET /v1/financial/subsidy-reviews/sweep/runs/{run_id}
| Name | In | Required | Description |
|---|---|---|---|
run_id |
path |
Yes |
Run id |
-
200: The run record
-
401: Missing or invalid token
-
403: Authorization denied
-
404: Run 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.
Issue a previewed run’s single-use execute token — exactly once
POST /v1/financial/subsidy-reviews/sweep/runs/{run_id}/token
The ONE issuance of a previewed run’s execute token. Requires the run previewed (its sweep_preview job succeeded by construction — the row and the job complete in one transaction) inside started_at + 15 min, and no prior issuance: the CAS on token_issued_at IS NULL admits exactly one of two concurrent POSTs. The token is minted and hashed AT issuance — the server keeps only its SHA-256 digest — and returned once under Cache-Control: no-store; it is never retrievable again (a lost token means a fresh preview). Authorized by the supervisor review_sweep row AND the background_job read row on the preview job (its creator, or an admin). Refusals: 404 unknown run; 409 sweep-token-issued (a second POST); 409 sweep-preview-expired (the window closed first — the run is stamped expired); 409 sweep-run-state (any other state, or a run no preview job wrote). No body.
| Name | In | Required | Description |
|---|---|---|---|
run_id |
path |
Yes |
The previewed run (the preview job’s |
-
200: The single-use token + its expiry (
Cache-Control: no-store) -
400: Unsupported jurisdiction (the jurisdiction’s state bundle does not declare subsidy writes)
-
401: Missing or invalid token
-
403: Authorization denied — not a supervisor-or-above session, or neither the preview job’s creator nor an admin
-
404: Run not found
-
409: Token already issued (
sweep-token-issued), the preview window closed (sweep-preview-expired, the run nowexpired), or the run is notpreviewed/ was not written by a preview job (sweep-run-state) -
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.
Redeem a preview: enqueue the sweep execute (backgrounded)
POST /v1/financial/subsidy-reviews/sweep/{run_id}/execute
Enqueues ONE sweep_execute job for a previewed run. Body = { client_request_id, execute_token, acknowledged_suspend, acknowledged_terminate, acknowledged_handoff } (the id is REQUIRED; the same id replays the SAME job whatever its state; any other field is 422 validation-failed). Synchronous, before the claim: the token’s wire shape, authz, the subsidy-writes gate and the regional SweepExecute office proof (its 400 / 403 / 503 set unchanged), then an aged previewed run is stamped expired (409 sweep-preview-expired); INSIDE the claim transaction: the consent act — the single-use token by digest (400), the acknowledged per-leg counts against the pinned sets (409 sweep-preview-stale), then the run flips previewed → consented (a replayed or concurrent execute reads 409 sweep-run-state naming the state) — a refusal aborts the claim, so the run stays previewed and the same id may retry. Answers 202 with Location: /v1/financial/jobs/{id} and the job (resource = the run, state = consented until the attempt takes the sweep lease and moves it executing; a scheduled pass holding the lease is the attempt’s waiting_for_lease); poll until succeeded (result = the run’s SweepReport — partial success is still success) or failed (crash / lost_proof / interrupted / engine_failed — the run reads failed with its counters as committed per agreement; a fresh preview is the remedy).
| Name | In | Required | Description |
|---|---|---|---|
run_id |
path |
Yes |
The previewed run |
| Field | Type | Required | Description |
|---|---|---|---|
acknowledged_handoff |
integer |
No |
Leg-3 handoff candidates the caller rendered. |
acknowledged_suspend |
integer |
No |
Leg-1 candidates the caller rendered (must equal the pinned suspend set’s size). |
acknowledged_terminate |
integer |
No |
Leg-2 candidates the caller rendered. |
client_request_id |
UUID |
Yes |
Client-minted idempotency id — REQUIRED. The same
id replays the SAME |
execute_token |
string |
Yes |
The preview’s single-use token (server-validated by digest). |
-
202: Execute enqueued (or a replay of the stored job — nothing re-enqueued);
Location=/v1/financial/jobs/{id} -
400: Bad token (shape or digest), office authority below the floor, or an unsupported jurisdiction
-
401: Missing or invalid token
-
403: Authorization denied, or the administrative-authority family declares no floor for the act (
SUBSIDY_AUTHORITY_UNCONFIGURED) -
404: Run not found
-
409: Run not previewed (
sweep-run-state— replayed / concurrent / already consented), the preview window closed (sweep-preview-expired), acknowledged counts stale (sweep-preview-stale), an execute already queued or running for this run (job-already-active), or this client_request_id used with a different intent (idempotency-conflict) -
422: Validation failure — a missing
client_request_idor a forged field (validation-failed) -
503: Service Unavailable (RFC 9457): a database degradation class, or the administrative-authority surface not verified / its evaluator unavailable (
SUBSIDY_AUTHORITY_NOT_READY; the detail is the closed reason token) -
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.
Subsidy Backpay
Recent backpay batches with live record counts, newest first (readable knob-off for audit)
GET /v1/financial/backpay/batches
| Name | In | Required | Description |
|---|---|---|---|
limit |
query |
No |
Max batches (default 50, 1..=200; out of range is a 422). |
-
200: Recent batches
-
400: A malformed query parameter (e.g. a non-integer
limit) is the extractor’s value-freebad-requestproblem, before the handler -
401: Missing or invalid token
-
403: Authorization denied
-
422: limit outside 1..=200
-
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 a below-floor backpay batch (knob-gated, admin-only)
POST /v1/financial/backpay/batches
| Field | Type | Required | Description |
|---|---|---|---|
client_request_id |
UUID |
Yes |
Client-minted idempotency id (REQUIRED): the same id with the same intent replays the batch; a different intent under it is a 409. |
expected_count |
integer |
Yes |
The manifest’s record count (1..=50000; the DDL CHECK backstops). |
manifest_checksum |
string |
Yes |
|
-
200: The created batch (a replay, the same client_request_id and intent, returns the batch with its CURRENT record counts)
-
400: a 64-character manifest_checksum that is not lowercase hex, or the jurisdiction does not support subsidy writes
-
401: Missing or invalid token
-
403: Authorization denied, or the backpay gate is OFF (
feature-disabled, the detail names the knob) -
409: client_request_id claimed by a different intent (
idempotency-conflict), or the replayed batch is gone (replay-entity-gone) -
422: Validation failure: a missing client_request_id, an expected_count outside 1..=50000, a manifest_checksum that is not 64 characters, or a forged field
-
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.
Backpay batch detail: live counts plus one keyset page of records (readable knob-off for audit)
GET /v1/financial/backpay/batches/{id}
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Batch ID |
after |
query |
No |
The previous page’s |
limit |
query |
No |
Max records (default 500, 1..=1000; out of range is a 422). |
-
200: The batch and one page of its records in id order;
next_afteris set iff the page is full -
400: A malformed query parameter (e.g. a non-UUID
after) is the extractor’s value-freebad-requestproblem, before the handler -
401: Missing or invalid token
-
403: Authorization denied
-
404: Batch not found
-
422: limit outside 1..=1000
-
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.
Abort a staging backpay batch, freeing its agreement-months
POST /v1/financial/backpay/batches/{id}/abort
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Batch ID |
-
200: The aborted batch with its record counts (an already-aborted batch replays)
-
400: The jurisdiction does not support subsidy writes
-
401: Missing or invalid token
-
403: Authorization denied, or the backpay gate is OFF (
feature-disabled) -
404: Batch not found
-
409: The batch is
finalizingorfinalized(batch-state): money consent has started -
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.
Enqueue finalize (or resume finalizing): the backpay money-consent act, backgrounded
POST /v1/financial/backpay/batches/{id}/finalize
Enqueues ONE backpay_finalize job for the batch. Body = { client_request_id, content_checksum } (client_request_id is REQUIRED and the same id with the same intent replays the SAME job whatever its state; a fresh id is a new job, which is also the resume; content_checksum is the 64-lowercase-hex checksum over the live records the finalizer reviewed; any other field is 422 validation-failed). Synchronous, before the claim: the consent knob, authz, the subsidy-writes gate and the state-floor BackpayFinalize proof (its 400 / 403 / 500 / 503 set). INSIDE the claim transaction: the consent gate. On a staging batch it runs the stager-is-not-finalizer leg (409 backpay-finalizer-staged), then the manifest gate (409 manifest-mismatch, the leg named), then flips the batch to finalizing; on finalizing (the resume) it runs the separation leg only; aborted is 409 batch-state; an already-finalized batch still enqueues (its one pass is the deterministic replay). A refusal aborts the claim, so the same id may retry. Answers 202 with Location: /v1/financial/jobs/{id} and the job (resource = the batch). Poll until succeeded (result = the LAST pass’s BackpayFinalizeReport: finalized, or staging when records diverged or a manifest key is not materialized; supersede, re-stage and finalize again) or failed (error.token closed: no_progress after three consecutive passes that moved nothing; refused_at_start when the knob is OFF at attempt start; lost_proof for a queued job across a restart; interrupted (a graceful restart) or crash (a killed process) for a running one. The batch stays finalizing, and a fresh client_request_id re-POST resumes, paying each record exactly once). A second enqueue while one is queued or running for this batch is 409 job-already-active; a peer replica holding the engine’s lease is the attempt’s waiting_for_lease, never a refusal.
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Batch ID |
| Field | Type | Required | Description |
|---|---|---|---|
client_request_id |
UUID |
Yes |
REQUIRED: the same id with the same intent replays the SAME job. |
content_checksum |
string |
Yes |
|
-
202: Finalize enqueued (or a replay of the stored job, nothing re-enqueued);
Location=/v1/financial/jobs/{id} -
400: a 64-character content_checksum that is not lowercase hex, the session’s held office is below the resolved floor, or the jurisdiction does not support subsidy writes
-
401: Missing or invalid token
-
403: Authorization denied, the backpay gate is OFF (
feature-disabled), or the administrative-authority family declares no floor for the act (SUBSIDY_AUTHORITY_UNCONFIGURED) -
404: Batch not found
-
409: Manifest mismatch (
manifest-mismatch, the leg named), batch state (batch-state), the finalizer staged records of the batch (backpay-finalizer-staged), a finalize job already queued or running for this batch (job-already-active), this client_request_id used with a different intent (idempotency-conflict), or the approval proof’s key no longer matches (SUBSIDY_APPROVAL_CONTEXT_STALE) -
422: Validation failure: a missing client_request_id, a missing content_checksum or one that is not 64 characters, or a forged field (
validation-failed) -
500: The family evaluated but answered no usable office (
SUBSIDY_AUTHORITY_EVALUATION_FAILED) -
503: The administrative-authority surface is not verified or its evaluator is unavailable (
SUBSIDY_AUTHORITY_NOT_READY) -
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.
Stage one below-floor agreement-month into a batch (replay-honest)
POST /v1/financial/backpay/batches/{id}/records
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Batch ID |
| Field | Type | Required | Description |
|---|---|---|---|
agreement_id |
UUID |
Yes |
The subsidy agreement the month pays. |
payment_month |
date |
Yes |
First day of the month (a mid-month date is a 400). |
-
200: Replay outcome (
already_staged|already_imported) with the ORIGINAL record -
201: Fresh record:
staged, orrejectedwith typed blockers (a successful outcome) -
400: payment_month is not the first day of a month, the session’s held office is below the resolved floor, or the jurisdiction does not support subsidy writes
-
401: Missing or invalid token
-
403: Authorization denied, the backpay gate is OFF (
feature-disabled), or the administrative-authority family declares no floor for the act (SUBSIDY_AUTHORITY_UNCONFIGURED) -
404: Subsidy agreement not found (answered BEFORE authz), or batch not found
-
409: Batch state (
batch-state), another batch staged the month (batch-conflict), the judgment moved since the record froze (backpay-judgment-moved), the record diverged at finalize (backpay-record-diverged), or the approval proof’s key no longer matches (SUBSIDY_APPROVAL_CONTEXT_STALE) -
422: Validation failure: a malformed body or a forged field (an amount is never accepted)
-
500: The family evaluated but answered no usable office (
SUBSIDY_AUTHORITY_EVALUATION_FAILED) -
503: The administrative-authority surface is not verified or its evaluator is unavailable (
SUBSIDY_AUTHORITY_NOT_READY) -
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.
Supersede a backpay record, freeing its agreement-month to re-stage
POST /v1/financial/backpay/records/{id}/supersede
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Record ID |
-
200: The superseded record (an already-superseded record replays unchanged)
-
400: A rejected record (
invalid-state-transition: a fresh stage frees its month), the session’s held office is below the resolved floor, or the jurisdiction does not support subsidy writes -
401: Missing or invalid token
-
403: Authorization denied, the backpay gate is OFF (
feature-disabled), or the administrative-authority family declares no floor for the act (SUBSIDY_AUTHORITY_UNCONFIGURED) -
404: Record not found (answered BEFORE authz)
-
409: An undisbursed payment references the record (
backpay-supersede-void-first; the detail names the/voidroute; the refusal lifts after the void), a disbursed payment references it (backpay-month-disbursed; the detail names the/adjustmentsroute; the month is never superseded), the batch leftstaging(batch-state), or the approval proof’s key no longer matches (SUBSIDY_APPROVAL_CONTEXT_STALE) -
500: The family evaluated but answered no usable office (
SUBSIDY_AUTHORITY_EVALUATION_FAILED) -
503: The administrative-authority surface is not verified or its evaluator is unavailable (
SUBSIDY_AUTHORITY_NOT_READY) -
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.
Subsidy Imports
Create a conversion batch (knob-gated, admin-only)
POST /v1/financial/subsidy-imports
| Field | Type | Required | Description |
|---|---|---|---|
client_request_id |
UUID |
Yes |
Client-minted idempotency id — REQUIRED.
Same id + identical intent replays the original batch (its
detail view with CURRENT record counts); a different intent
under the same id is a 409 idempotency-conflict. The xtask
import tool pins it via |
cutover_month |
date |
Yes |
The inter-system money boundary (month-start; > |
expected_count |
integer |
Yes |
The manifest’s record count (1..=50000 — DDL-checked). |
manifest_checksum |
string |
Yes |
sha256 hex over the sorted |
snapshot_date |
date |
Yes |
The named conversion baseline: CRAIG’s review chain starts here; SHINES stays authoritative for earlier history. |
source_system |
string |
Yes |
Conversion source vocabulary token ( |
-
200: The created batch (a replay returns its detail view with CURRENT record counts — same client_request_id + intent)
-
400: Wire validation failure (vocabulary, month shape, checksum shape)
-
401: Missing or invalid token
-
403: Authorization denied, or the import gate is OFF (the detail names the knob)
-
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.
Batch detail + live per-status counts (readable knob-off for audit)
GET /v1/financial/subsidy-imports/{id}
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Batch ID |
-
200: Batch detail
-
401: Missing or invalid token
-
403: Authorization denied
-
404: Batch 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.
Abort a staging batch (frees every live claim; replay-honest)
POST /v1/financial/subsidy-imports/{id}/abort
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Batch ID |
-
200: The aborted batch (also the already-aborted replay)
-
401: Missing or invalid token
-
403: Authorization denied, or the import gate is OFF
-
404: Batch not found
-
409: Abort is forbidden once finalize started (typed batch-state)
-
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.
Enqueue finalize (or resume finalizing) — the single money-consent act, backgrounded
POST /v1/financial/subsidy-imports/{id}/finalize
Enqueues ONE import_finalize job for the batch. Body = { client_request_id } (REQUIRED; the same id replays the SAME job whatever its state, a fresh id is a new job — also the resume after a failed job; any other field is 422 validation-failed). Synchronous, before the claim: the consent knob, authz, the subsidy-writes gate and the state-floor ImportHistory proof (its 400 / 403 / 503 set unchanged); INSIDE the claim transaction: the consent gate — the manifest gate on a staging batch, the resume on finalizing, the typed refusal on aborted (a 404 / 409 aborts the claim, so the same id may retry) — then the queued row; an already-finalized batch still enqueues (its one pass is the deterministic replay). Answers 202 with Location: /v1/financial/jobs/{id} and the job (resource = the batch); poll until succeeded (result = the LAST pass’s FinalizeReport — finalized, or staging when live rejections sent the batch back for correction) or failed (error.token closed: no_progress after three consecutive passes that moved nothing, with remaining_staged / passes in detail; crash / lost_proof / interrupted / refused_at_start — the batch stays finalizing; a fresh client_request_id re-POST resumes per record exactly once). A second enqueue while one is queued or running for this batch is 409 job-already-active; a peer replica holding the engine’s lease is the attempt’s waiting_for_lease, never a refusal.
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Batch ID |
| Field | Type | Required | Description |
|---|---|---|---|
client_request_id |
UUID |
Yes |
The client-minted operation id: the same id replays the SAME job (whatever its state); a fresh id is a new job. |
-
202: Finalize enqueued (or a replay of the stored job — nothing re-enqueued);
Location=/v1/financial/jobs/{id} -
400: The session’s held office is below the resolved floor (the office refusal names it)
-
401: Missing or invalid token
-
403: Authorization denied, the import gate is OFF, or the administrative-authority family declares no floor for the import act (
SUBSIDY_AUTHORITY_UNCONFIGURED) -
404: Batch not found
-
409: Manifest mismatch (the four numbers), batch state, a finalize job already queued or running for this batch (
job-already-active), this client_request_id used with a different intent (idempotency-conflict), or the approval proof’s key no longer matches the locked row (SUBSIDY_APPROVAL_CONTEXT_STALE) -
422: Validation failure — a missing
client_request_idor a forged field (validation-failed) -
500: The family evaluated but answered no usable office (
SUBSIDY_AUTHORITY_EVALUATION_FAILED) -
503: The administrative-authority surface is not verified or its evaluator is unavailable (
SUBSIDY_AUTHORITY_NOT_READY; the detail is the closed reason token) -
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.
The records ledger — the reconciliation export (readable knob-off)
GET /v1/financial/subsidy-imports/{id}/records
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Batch ID |
page |
query |
No |
1-based page number (default 1); 0 is a 422 and a page past 10000 a 400. |
per_page |
query |
No |
Records per page, 1 to 500 (default 25); outside that range is a 422. |
-
200: One page of records (staging order) + total
-
400: A page past the depth cap; a malformed query parameter (e.g. a non-integer
page) is the extractor’s value-freebad-requestproblem, before the handler -
401: Missing or invalid token
-
403: Authorization denied
-
404: Batch not found
-
422: A
pagebelow 1 or aper_pageoutside 1..=500 (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.
Stage one source record (full validation now; replay-honest)
POST /v1/financial/subsidy-imports/{id}/records
| Name | In | Required | Description |
|---|---|---|---|
id |
path |
Yes |
Batch ID |
| Field | Type | Required | Description |
|---|---|---|---|
agreement_document_key |
string (optional) |
No |
Object-store key of the scanned artifact, when available. A NUL
(U+0000), which |
approving_county |
string |
Yes |
Approving county. A NUL (U+0000), which |
case_id |
UUID (optional) |
No |
Owning case, when known. |
child_id |
UUID |
Yes |
The subsidized child (S2S-verified at the service). |
external_reference |
string |
Yes |
The source system’s record identifier (the replay key — one LIVE
claim across all batches). NUL / newline are refused: they are
the manifest checksum’s pair-framing bytes
( |
form_number |
string |
Yes |
Signed form identity (may be a legacy placeholder token). A NUL
(U+0000), which |
form_version |
string |
Yes |
Signed form version. A NUL (U+0000), which |
intervals |
array of ImportIntervalRecord |
Yes |
Full historical interval chain (1..=200, contiguous, last open). |
legal_county |
string (optional) |
No |
Legal county, when distinct. A NUL (U+0000), which |
legal_reference |
string (optional) |
No |
Court order / docket reference. A NUL (U+0000), which
|
parties |
array of ImportPartyRecord |
Yes |
Signatories (≥1 caregiver on non-terminal heads; ≤16). |
predecessor_external_reference |
string (optional) |
No |
Predecessor EXTERNAL reference (same source system) — resolved
to the materialized predecessor’s agreement id at validation
(same child, same family, terminal, closed before this chain). A NUL
(U+0000), which |
program |
enum (rcs, ercs, ersg, enrsg) |
Yes |
The four closed subsidy cohorts — the ONLY programs a conversion import can carry. Open-program conversion is a recorded non-goal (native re-enrollment). |
signed_at |
date |
Yes |
Signature date. |
terms |
array of ImportTermsRecord |
Yes |
Full term-revision chain (1..=200, ordered, last open). |
-
200: Replay outcome (already_staged / restaged / already_imported) with the ORIGINAL facts
-
201: Fresh row staged (or rejected with typed blockers — a successful reconciliation outcome)
-
400: Wire validation failure
-
401: Missing or invalid token
-
403: Authorization denied, or the import gate is OFF
-
404: Batch not found
-
409: Batch state / batch conflict / post-finalize content conflict (typed)
-
422: A body field whose value does not deserialize, e.g. an unknown
program(validation-failed; the field is named, the value never echoed), or a field or list outside its declared length bounds, or anexternal_referenceholding a NUL or newline, or a NUL (U+0000) in any stored record text member (validation-failed) -
503: craig-cases unreachable — record references cannot be verified (fail-closed)
-
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.