canopy-caps API Reference
Overview
Cross-link: canopy-caps Data Model (#419)
CAPS / CCDF program service (45 CFR Part 98). Computes childcare eligibility: income test against State Median Income (initial 50% SMI / continued 85% SMI), a per-parent activity requirement (24 hours/week minimum across employment / education / training, The per-parent activity test (#3183)), age gate (under 13, or under 19 for a child with a documented disability finding), sliding-scale copayment, and provider authorization with rate, approval period and type of care.
All eligibility logic runs through the rules engine (ADR-003): each pack’s caps-eligibility.json decides, for each child, the income test, the activity test, the child age test and their combination. Its limits arrive as context.thresholds.* (build_caps_eligibility_thresholds in src/determine.rs): the income threshold from jurisdiction.toml [caps] and the federal SMI edition in force on the determination date (Which SMI edition a determination uses (#1669)), and the [caps] min_work_hours_per_week, child_age_max, special_needs_child_age_max and disabled_parent_care_waiver (the pack key).
- Base URL
-
container port 8016 (host:
CANOPY_PORT_CANOPY_CAPS_8016in.ports.env); every route below is mounted under/v1 - Authentication
-
Bearer token: a canopy-identity token for this receiver (its
audisurn:canopy:service:canopy-caps), authenticated by the service’s identity receiver (ADR-049 Amendment 14): no bearer is 401token_missing, a token it refuses 401token_rejected, anX-Canopy-Actorheader 400actor_header_retired, and no trustworthy key set in time 503keys_unavailable. - Access
-
canopy-reporting holds the one system edge to canopy-caps; canopy-web, canopy-cli and canopy-eligibility (onward from a worker’s determine) reach it by delegation. The writes admit a system caller or the writer bar (the two worker-fact creates the writer bar alone, Worker facts (#3182)), the reads a system caller or caseworker+ (canopy-web’s case readers on the listed reads), the §B4 batch and the provider registry’s list and writes system callers alone, the redaction
data_stewardalone, the snapshot read a system caller,adminorquality_control, or canopy-eligibility's onward delegation at caseworker+ (GET /v1/determinations/{id}/snapshot), and the held-determination list a determination operator’s delegation through canopy-eligibility alone (GET /v1/held-determinations). A refusal is 403 with itsReceiverDenialcode (ADR-049 Amendment 14); each route’s constant is in the authorization inventory. - Swagger UI
-
/swagger-uion the same host port - Database
-
canopy_caps(isolated per ADR-001; no FTI scope — state-administered)
Admission specifics
Access legend: system = any system caller but the portal; writer = a user’s delegation holding a CASEWORKER_WRITER_ROLES role; caseworker+ = CASEWORKER_OR_ABOVE_ROLES; case reader = CASE_READER_ROLES (all crates/canopy-auth/src/roles.rs); via canopy-web = only a delegation canopy-web presents; with no client named, the bar admits a delegation through any client.
-
The admissions are
WRITERandREADER(src/api/handlers.rs), inlineAdmission::system()andAdmission::user_roles(&["data_steward"]), and thedelegated::CAPS_*rows. No handler checks anything beyond its admission, except the two authorization writes' household consistency check, which authorizes nothing (#2545; thePUT /v1/authorizations/{id}section below), the worker-fact creates'recorder_subject, which refuses the system callerWRITERadmits with 403service_class_on_user_only(#3182), and the determine’senforce_operation_gate, which refuses anoperation_idfrom any caller but canopy-eligibility with 403 (#3185, Operation binding (#3185)). -
The writer bar leaves out
quality_control: QC reviews an authorization and neither issues nor reassigns one, so it is 403required_role_missingonPOST /v1/determine, bothPUT /v1/authorizations/…writes and the two worker-fact creates. -
Attribution: the redaction event’s actor
subisprincipal.attribution_sub(), the steward’s canopy subject (the route admits users alone). The authorization writes record no actor; the body names none. A worker fact records the delegation’s OIDC subject asrecorded_by(recorder_subject); its body names none. -
Outbound calls: the determine’s canopy-rules call rides the request’s outbound (
RequestOutbound), which on canopy-caps’s system-only edge to canopy-rules is canopy-caps’s own system token whoever the caller; the boot signing-key registration with canopy-security uses itsIdentitySender(system origin).
Determination
POST /v1/determine
Run a CAPS eligibility determination. Called by canopy-eligibility orchestrator.
- Access
-
system; writer (
WRITER,src/api/handlers.rs)
Request: CapsApplicationContext, version 3 (#3183): a household context (household_size, gross_monthly_income, eligibility_type, jurisdiction) naming the family unit’s parents (parents[], each a person_id) and carrying a per-child children[] list (each child’s person_id, age_years and optional provider_id), and the optional operation_id (Operation binding (#3185)). The body carries no worker fact: each parent’s activity standing and each child’s care need are canopy-caps' own records (Worker facts (#3182)), read per person on the run’s legal day (Which SMI edition a determination uses (#1669)). CAPS is multi-subject (ADR-035): each child is individually authorized. Shapes: crates/canopy-contracts-caps/src/determine.rs.
{
"application_id": "0196eb5b-1f60-7e3f-9000-9a0bf1cfc9e1",
"household_id": "0196eb5b-1f60-7e3f-9000-9a0bf1cfc9e2",
"household_size": 3,
"gross_monthly_income": "2000.00",
"parents": [
{ "person_id": "0196eb5b-1f60-7e3f-9000-9a0bf1cfc9e3" },
{ "person_id": "0196eb5b-1f60-7e3f-9000-9a0bf1cfc9e4" }
],
"children": [
{ "person_id": "0196eb5b-1f60-7e3f-9000-9a0bf1cfc9e5", "age_years": 4, "provider_id": null }
],
"jurisdiction": "georgia",
"eligibility_type": "initial"
}
Operation binding (#3185)
operation_id is the determination operation canopy-eligibility claimed for the dispatch (ADR-002 Operation binding); a direct caller sends none. canopy-caps signs and dedupes it as canopy-wic does (#3158), keyed per child:
-
Gate: a body naming an
operation_idis 403 from any caller but canopy-eligibility, on its system token or its onward delegation (enforce_operation_gate,src/api/handlers.rs), before any read or write. The refusal is logged with the caller’s client alone. -
Signing: every child’s envelope signs the operation (
envelope.operation_id,determine::sign), so canopy-eligibility binds each envelope to the operation that asked for it. Eachcaps_determinationsrow stores the operation andsigned_payload, the exact bytes itsjws_tokencovers; a direct caller’s rows store the bytes and no operation. -
Replay: when the body’s
operation_idalready has determinations, the handler answers 200DeterminationListwith them, inchild_person_idorder, each parsed from its row’ssigned_payloadwith its storedjws_token(determine::replayed_determinations). It reads no worker fact, makes no rules call, and writes no row and stages no event. A dispatch retried after its first execution committed therefore binds the same determinations. canopy-caps serves no operation read, so a replay is answered here rather than refused. -
Race: when a concurrent execution of the same operation commits its determinations after this one’s replay check found none, this one’s insert trips
caps_determinations_operation_subject_uq, one row per operation and child. Every execution writes its children inchild_person_idorder whatever orderchildren[]lists them in (persist_order,src/api/persist.rs), so two executions listing them differently cannot deadlock; the first execution’s response keeps thechildren[]order. It answers 409operation_already_determined, the code canopy-eligibility reads, whose detail names no database object, and its transaction rolls back every child. The orchestrator’s next retry is answered from the store.
The handler reads the worker facts once (WorkerFacts::read, src/determine/worker_facts.rs), the household's family asset certification among them, and evaluates the federal asset test once for the household (The family asset test (#3547)). Then, per child:
-
Evaluates
caps-eligibilityfor that child through the rules engine (#3079). Theinput.*isCapsEligibilityInput: the household’s income, size and eligibility type, each parent’s recorded activity (parents[]:activity_weekly_hours,activity_verified,care_waived), then the child’s age andchild_has_documented_disability. The ruleset returnsincome_eligible,tested_parentsandactivity_eligible,age_eligible, the age ceiling it applied (child_age_limit) and their combinationeligible, which alone decides approval. An output missing any gate fails the request with a 500, never a denial. -
Gives a denied child one denial reason per failing test, and per failing parent (
src/determine/reasons.rs): income; activity (The per-parent activity test (#3183)); age, statingchild_age_limit, and, for a child held to the standard ceiling, that no documented disability finding is recorded. -
Gives an eligible child its share of the family fee (#2226). The handler evaluates every child first, then prices one fee for the run from the pack's
[caps.family_fee]edition in force (the pack key;src/family_fee.rs). The fee is the charge of the band the household's income falls in, for as many children in care as the run finds eligible, capped at[caps] copay_income_ceiling_pctof income (CapsParamsInForce::family_fee_weekly_cents); with no income the cap is zero, whatever the band charges (#3326). The fee is one per family, not one per child (DECAL CAPS/00-9 §9.4.3), so the run then shares it among the eligible children as the pack'sallocationelects (#3321;Allocation::shares). The share is the child'scopayment_weekly_centson its envelope, its determination row and its authorization. A denied child carries none and is not counted, and a run with no eligible child prices no fee. The two elections:-
divide_evenly(georgia,default): inchild_person_idorder each eligible child takesfee / ncents and the firstfee % none cent more, so the shares sum to the fee. HH4 at $2,000 a month owes $23 a week: two eligible children carry 1150 each, three carry 767, 767 and 766. -
youngest_child(test-max, the Texas shape): the youngest eligible child carries the whole fee, the lowerchild_person_idon a tie, and the other eligible children carry 0.
-
-
Selects approved-provider rate (12-month authorization period). An eligible child’s authorization authorizes the greatest tested parent’s recorded weekly hours (the envelope’s
authorized_weekly_hours) and carries the child’s recordedscholarship_type, null when no care need is recorded (#3183). -
Assembles + persists the determination input snapshot (ADR-028, #685): the child’s
rules_inputand its ruleset output (rules_output), the gate results, the resolved policy params, and the corpus-hash of the child’s own evaluation. Its derivation graph holds the ruleset’s firing for each test and foreligible, and the copayment as the one Rust-side edge. CAPS carries no itemized fact arrays, so the snapshot’s fact record is the household composition. Its SHA-256 (RFC 8785 canonical) becomes thesnapshot_hashsigned into the determination; the snapshot is stored immutably indetermination_snapshotsin the same transaction. CAPS is non-FTI, so (unlike tanf/medicaid) the snapshot does not join the ADR-014 chain. -
Signs the determination with ECDSA P-256,
person_idand the dispatch’soperation_idset before signing (ADR-002 / ADR-035, Operation binding (#3185)) — the signature now coverssnapshot_hash
All N per-child determinations + snapshots + snapshot DEKs (redaction_keys rows, generated without a write) + authorizations + outbox events persist in one transaction (all-or-nothing, api/persist.rs), so a request that does not commit leaves no key (#2382). An empty children[] list returns 422, an empty parents[] 422 coded caps_parents_required (#3183), and a household_size below 1 422, each before any read, rules call or key mint (#2685); a determination date with no SMI edition or no family-fee edition in force returns 422 coded params_unstaged (below); an eligible child whose provider id names no caps_providers row fails its authorization insert and returns 422 foreign_key_violation, the whole transaction rolled back. A body naming an operation_id from a caller other than canopy-eligibility is 403, and a concurrent execution of the same operation that committed first makes this one 409 operation_already_determined, nothing written (Operation binding (#3185)).
The family asset test (#3547)
45 CFR 98.20(a)(2)(ii) makes a child eligible only in a family whose assets do not exceed $1,000,000, "as certified by such family member", at determination or redetermination. The rule is federal and the same in every State, so it is the federal layer's decision caps-family-assets, evaluated once per run beside the pack's caps-eligibility (src/determine/family_assets.rs). No pack carries or changes it.
canopy-caps sends:
| Name | Value |
|---|---|
|
What the household's standing certification says (Family asset certification (#3546)): the row certified latest on or before the run's legal day. |
|
Whole days from that certification's day to the run's legal day; |
|
The pack's |
The decision answers asset_eligible, asset_limit_dollars (the federal limit; canopy-caps records it and names it in a denial, and compares nothing against it) and, when not eligible, a denial_reason_code. The test is the certification, never a dollar comparison.
-
A child is approved only when the pack's
eligibleand the federalasset_eligibleboth hold.caps-eligibilitystill runs for every child, so a denial lists every failing test, the asset reason last. -
family_assets_not_certified: no certification is on record, or the latest is older than the pack allows. The reason reads "No current family asset certification is on record (45 CFR 98.20(a)(2)(ii))." Recording one and determining again clears it. -
family_assets_over_limit: a current certification says the assets exceed the limit. The reason names the limit. -
A child denied on assets carries no copayment, hours or authorization, and does not count toward the family fee.
-
The envelope's
program_extensioncarriesasset_eligible. The row'sincome_eligible,activity_eligibleandage_eligiblestay the pack's own. -
The snapshot's sealed
program_input.family_assetsholds the decision's exact input and output and the certification read (its id, certifier, day and answer;nullwhen none);policy_paramsholdsasset_certification_valid_daysandasset_limit_dollars. The decision's firings join each child's derivation graph.
Refusals: an answer missing asset_eligible or asset_limit_dollars, or an ineligible answer whose code is neither of the two, is a 500 and nothing is stored. canopy-caps refuses to start when no configuration layer ships the decision, or when the decision reads an input or threshold this build does not send (family_assets::check_at_boot).
Every run that reaches canopy-caps applies the test, a mid-period run included; the test has no notion of the eligibility period. The case-by-case waiver of 98.20(a)(3)(ii)(A) for protective-services families is not modelled (#3548).
Which SMI edition a determination uses (#1669)
The determination date is the run’s LEGAL day — today in the pack’s [jurisdiction].timezone (CapsParameterTable::in_force_today, via canopy_common::clock::legal_today; #2240), never the UTC day, which is already tomorrow every evening in a western timezone. The timezone is required: a pack without a valid IANA [jurisdiction].timezone refuses boot. That one date is the SMI-selection date, the envelope’s effective_date (and so the authorization start) and the snapshot’s as_of; only the determined_at and row timestamps are wall-clock instants. canopy-caps scores it with the federal SMI edition the booted pack had adopted by that date:
-
At boot,
services/canopy-caps/src/smi_editions.rsparses everysmi-*.jsonfile of the federal layer (each edition identified by its_effective_date) and binds the pack’sjurisdiction.toml[caps.smi_adoptions]schedule to them — edition_effective_date→ the day the state adopted it (the pack key). Each edition’s figures are its 45 CFR 96.85(b) ladder applied to the 4-person estimate in the row the pack’s[jurisdiction].fips_state_codenames, or to the pack’s[caps.smi_override]base where the file publishes none (#3279). A defective family file or schedule refuses boot. -
Per determination, the edition in force is the one adopted most recently on or before the determination date. It stays in force until the pack’s next adoption — a state’s chart is law until the state replaces it — so no deploy is tied to a date and no code names a year.
-
A date before the pack’s first adoption has no edition: the request is refused 422 with
codeparams_unstagednaming the date and the first adoption. No other edition is substituted. -
The income threshold (
monthly SMI × [caps] income_limit_{initial,continued}_pct_smi / 100) and the income’s percentage of SMI that apct_smifee edition compares against its edges both come from the selected edition. The fee edition is selected on the same date, the latest effective on or before it, and a date before the pack's first fee edition is refused the same way. The snapshot’spolicy_params.smi_editionrecords the SMI edition —effective_date(the federal edition),adopted_on(the pack’s date) andfile— beside the frozenincome_threshold, andpolicy_params.family_fee_editionrecords the fee edition by itseffective_date(#2226), so a replay names the tables that scored and priced the verdict. Beside it,family_fee_weekly_cents(the whole family fee in cents, 0 when no child is eligible),family_fee_children(the eligible children it is shared among) andfamily_fee_allocation(divide_evenlyoryoungest_child) let each child's share be recomputed from its snapshot (#3321). The edition is named, not digested: an in-place correction of an edition’s figures (as #1668 made) is a parameter revision the operator labels by bumping the pack’s[meta].version, which every snapshot carries aspolicy_params_version(ADR-028 §39).
Georgia adopted the FFY2026 edition (smi-2026.json, _effective_date 2025-10-01) on 2026-03-02 and the FFY2027 edition (smi-2027.json, _effective_date 2026-10-01) on 2026-10-05, each on the effective date of DECAL’s CAPS Appendix A chart; the default and test-max packs adopt FFY2026 on its federal date.
Response (200): DeterminationList — one signed SignableDetermination envelope per child (ADR-035), each carrying its person_id, the snapshot_hash binding the input snapshot (ADR-028) and the dispatch’s operation_id, absent for a direct caller; per ADR-002 (status, benefit amount, effective/expiration/renewal dates, basis, JWS signature, CAPS-specific data under program_extension). The orchestrator receives only outcome + hash, never the snapshot cleartext.
The per-parent activity test (#3183)
Every parent must meet the activity requirement (45 CFR 98.20(a)(3)(i); DECAL CAPS/00-6 §6.8.1.7 in Georgia). Each pack’s expr-activity-test reads input.parents:
-
tested_parentsis every parent, less one whose care waiver applies when the pack’sdisabled_parent_care_waiveristrue(filter(input.parents, not #.care_waived)). -
activity_eligibleholds when at least one parent is tested and each tested parent is verified atmin_work_hours_per_weekor more (len(..) >= 1 and all(.., ..)).
A care waiver applies only when the parent’s record claims unable_to_provide_care and names its care_waiver_verification (§6.8.1.8). The facts read fail-closed:
-
A parent with no record reads as unverified with zero hours.
-
A claim without a verification waives nothing: the parent is tested.
-
A child with no care need reads as no documented disability finding and no type of care.
A denied child’s activity reasons name each failing tested parent by position in parents[], from 1:
| The parent | Reason |
|---|---|
has no record |
|
is unverified |
|
is verified under the minimum |
|
claims a waiver without verification (waiver on) |
|
none tested: every parent waived |
|
GET /v1/determinations
List determinations: one household’s when household_id is given, else the jurisdiction’s newest across households (#2002 — the unscoped list SNAP, TANF and Medicaid already serve; the worker dashboard’s recent-determinations panel reads ?limit=2).
- Access
-
system; caseworker+; case reader via canopy-web (
delegated::CAPS_GET_DETERMINATIONS) — the admission SNAP’s unscoped list carries
Query parameters: household_id (optional; only that household’s determinations, newest-first, bounded at 100), limit (optional; the unscoped list’s page size, default 50, clamped to 1..=200; ignored when household_id is given).
Response (200): array of CapsDeterminationRead (each the CapsDetermination fields flattened, including the required snapshot_hash — #911 retired the snapshot_status marker with the ADR-028 §58 legacy backstop).
GET /v1/determinations/{id}
Fetch a determination by ID.
- Access
-
system; caseworker+ (
READER,src/api/handlers.rs)
Response (200): CapsDeterminationRead — the CapsDetermination fields flattened, including the required snapshot_hash (#911: legacy pre-snapshot rows were deleted and the ADR-028 §58 snapshot_status marker retired). Returns 404 if no determination exists for the supplied ID.
GET /v1/determinations/{id}/snapshot
Return a determination's frozen ADR-028 input snapshot, exactly as stored (#3427): the read canopy-snap serves for its own determinations.
- Access
-
system;
adminorquality_control; caseworker+ via canopy-eligibility (delegated::CAPS_GET_DETERMINATIONS_ID_SNAPSHOT,src/api/snapshot.rs): canopy-snap's snapshot admission, arm for arm. The snapshot carries the proven facts, their provenance, income and household composition, so a worker's direct delegation needsadminorquality_control; any other is 403required_role_missing, a caseworker's included. The caseworker+ arm admits canopy-eligibility's onward delegation alone.
Response (200): the typed DeterminationSnapshot the determination stored in determination_snapshots. Its sealed parts (program_input, the sealed fact leaves) are returned sealed: the route opens nothing and reads no key. 404 when no determination has the id. 500 when the determination exists and its snapshot row does not (corruption, logged as an error: every determination signs a snapshot_hash and writes its snapshot in the same transaction), or when the stored snapshot's schema_version is one this build does not read (DeterminationSnapshot::verify_schema_version).
GET /v1/determinations/{id}/authorizations
List provider authorizations attached to a determination.
- Access
-
system; caseworker+; case reader via canopy-web (
delegated::CAPS_GET_DETERMINATIONS_ID_AUTHORIZATIONS)
GET /v1/held-determinations
The determinations whose completion events canopy-caps still holds past its held-row warning age, oldest first (#3065): the read an operator lists before adopting or dropping one through canopy-eligibility. A determination’s events stay held until canopy-eligibility records or disowns it (ADR-002 Amendment 7), so a listed determination is one the held-row watch warns about. The read releases and drops nothing.
- Access
-
a determination operator through canopy-eligibility alone (
delegated::CAPS_GET_HELD_DETERMINATIONS,src/api/held.rs; determination operator =DETERMINATION_OPERATOR_ROLES): a system caller is 403service_class_on_user_only, a user’s direct delegation 403actor_not_allowed, and a delegation without the roles 403required_role_missing.
Query (HeldDeterminationsQuery): after, the previous page’s next; limit, 1 to 200, default 50; determination_id, to look up one determination.
Response (200): HeldDeterminationPage (crates/canopy-contracts-eligibility/src/held.rs): items, in (held_since, determination_id) order, and next, an opaque cursor absent on the last page. Each item is { determination_id, program, operation_id, held_since, held_rows }:
-
held_sinceis when the oldest still-held event was staged, andheld_rowshow many are held. A determination is listed once itsheld_sinceis older than the decision clock’s instant lessCANOPY_MQ_HELD_AGE_WARN_SECS(MqTuning::held_age_warn; Configuration Reference). -
programiscaps. -
operation_idis the canopy-eligibility operation the determination was dispatched under, read from itscaps_determinationsrow (#3185), and absent for a direct caller’s determination or one written before #3185. -
A hold whose determination row is missing is still listed, with no operation, and logged at WARN.
Returns 422 invalid_limit for a limit outside 1 to 200 and invalid_cursor for an after no page issued.
POST /v1/determinations/{id}/redact
Crypto-shred a determination’s frozen input snapshot (#687, ADR-036). The per-determination DEK in redaction_keys is tombstoned (its wrapped_dek overwritten with a zero sentinel + shredded_at stamped), so every sealed leaf becomes permanently unrecoverable, while the snapshot ciphertext and the signed snapshot_hash are left untouched — the snapshot still re-hashes to the signed value and the determination’s JWS stays verifiable (hash-over-ciphertext, ADR-036 Decision B). Only the plaintext PII is destroyed.
- Access
-
data_steward(inlineAdmission::user_roles(&["data_steward"])); a system caller is 403service_class_on_user_only. A dedicated, privileged, irreversible role for redaction/expungement: admins do NOT hold it by default (separation of duties, mirroringfti_auditor). canopy-identity grants it from the upstream’s groups through its projection (ROLE_VOCABULARY,crates/canopy-auth/src/roles.rs); on the devstack the Kanidm cast (devstack/kanidm/migrations/00-canopy.hjson) grants it todata.stewardalone.
Request:
{
"reason": "..."
}
reason is mandatory; a blank reason is rejected with HTTP 400.
The shred and a plaintext-free determination.redacted audit event (carrying the steward’s sub + the reason) commit in one transaction (ADR-018); canopy-security audits it via the existing wildcard subscriber.
Response (200): { "determination_id": "…", "redacted_at": "…" }; redacted_at is also the tombstoned DEK’s shredded_at, and the DEK’s created_at is the determination’s decision instant (#2475). Both instants come from the service’s injected decision clock (#2581, ADR-033 §5): a determination reads it once and stamps its envelope, its rows and its snapshot at that instant, and a redaction reads it once for redacted_at. Returns 400 on a blank reason, 403 if the caller lacks the data_steward role, and 404 for an unknown determination. Idempotent: re-redacting an already-shredded determination tombstones 0 rows and still returns 200.
The path uses the sub-resource form …/{id}/redact (mirroring snap’s reference impl), not the AIP-136 custom-method …/{id}:redact — axum/matchit 0.8 allows only one parameter per path segment.
Provider Authorization
POST /v1/authorizations/active:batchGet
Get the active-childcare flag for a set of households for ONE report month
in one round-trip (#1203) — one household_id = ANY($1)
determinations⋈authorizations set query; the ACF-199 extract reads it in
place of a per-AU walk (caps exposes no by-household authorization
endpoint). Capped at 500 IDs per request (422 on overflow); duplicates
collapse to one entry; the response follows first-occurrence request order.
- Access
-
system (inline
Admission::system()) — the §B4 bulk-read posture; a user is 403system_caller_required, though the interactive determination and authorization reads admit caseworker+
GET-OR-FALSE, exact-set: every requested UNIQUE id gets exactly one
entry — has_active_authorization: false = honestly no qualifying
authorization (no determinations at all, determinations without
authorizations, or none active and window-overlapping the month),
present so consumers can assert exact id-set equality. The response is
the bool only — never the determination or authorization row vectors —
so a 500-household response is bounded by construction.
The frozen predicate: authorization_status = 'active',
effective_date < month + 1 month, end_date IS NULL OR end_date >=
month — with NO determination-status filter (denied determinations'
authorizations count like any other). month normalizes to its month
start server-side (any day selects that whole month), giving the
half-open [month, month+1) window. This batch surface is the only
implementation of the predicate; the reporting-side per-household walk it
replaced was deleted (services/canopy-reporting/src/clients/mod.rs).
Request: BatchActiveAuthorizationsRequest
{ "household_ids": ["uuid", "uuid"], "month": "2026-03-15" }
Response (200): Vec<HouseholdChildcareEntry> —
[{ household_id, has_active_authorization }].
GET /v1/authorizations/{id}
Fetch a provider authorization — provider identity, child, approved rate, copayment, effective + expiration dates, and the type of care the scholarship authorizes (scholarship_type, a ScholarshipType token, #3182). The determination writes the child’s recorded care need’s type and the update below sets or corrects it (#3183); it is null when none is recorded, on every authorization written before #3183 among them.
- Access
-
system; caseworker+ (
READER)
PUT /v1/authorizations/{id} (#448)
Partial update on an existing authorization. COALESCE-pattern: only the fields supplied are changed. Backs the worker-portal #392 BFF action handler actions_caps::update_authorization_caps.
- Access
-
system; writer (
WRITER) — canopy-web’sactions_caps.rssends the worker’s delegation
Request: UpdateAuthorizationRequest. household_id is required (#2545): axum’s Json extractor refuses a body without it with a 422, before admission.
{
"household_id": "0190f5a2-7c1e-7d3a-9b4e-2f6c8a1d5e70",
"authorized_weekly_hours": 30,
"copayment_weekly_cents": 2700,
"status": "active",
"scholarship_type": "part_time",
"notes": "Worker reduced after parent moved to part-time"
}
scholarship_type (#3183) sets or corrects the type of care the scholarship authorizes, a ScholarshipType token; absent or null leaves it as it is, and a token outside the vocabulary is 422. The change rides the same update and its one update note. copayment_weekly_cents is the weekly copayment in whole cents, a JSON integer; a string or a fraction is refused by the body’s shape (422). notes joins the authorization’s note history (caps_authorization_notes, #2428) in the same transaction as the change, stored trimmed with the caller as its actor; absent or blank records no note. The service holds the bounds canopy-web’s form applies, before any write (#2686): authorized_weekly_hours outside 0 to 168 is 422 authorized_weekly_hours_out_of_range, a negative copayment_weekly_cents is 422 copayment_weekly_cents_out_of_range, and notes over 2000 characters or holding a NUL is 422 invalid_note. The body names no actor: the worker’s identity rides their delegation, and an unknown field (the pre-#2411 updated_by included) is 422 (deny_unknown_fields). canopy-web validates every entered figure before it sends (#2411).
-
an unknown id is
404; -
an authorization whose determination’s
household_idis not the body’s is 409authorization_household_mismatch. The detail names the path id and the requested household, never the stored owner. The refusal writes no row and no note, and logs onewarn!carrying the two ids.
The check holds the stored owner to the household the request names. It does not tell whether the caller may act in that household: canopy-caps cannot know which household a worker acts in, so a caller that names the authorization’s own household passes. canopy-web binds the authorization to the worker’s household before it sends that household (canopy-web API).
Response (200): the updated CapsAuthorization row. Returns 404 if the id is unknown, 409 authorization_household_mismatch as above, 422 authorized_weekly_hours_out_of_range, copayment_weekly_cents_out_of_range or invalid_note as above, and 422 check_violation if status is outside active, suspended, terminated, expired.
PUT /v1/authorizations/{id}/provider (#448, FK-validated per #396)
Switch the provider on an active authorization, effective at once. Single-column UPDATE on provider_id. Post #396, new_provider_id is a Uuid and the column FKs caps_providers(id); switching to an unknown UUID surfaces as 422 foreign_key_violation. Switching to an inactive provider is allowed at the DB layer — callers that want to forbid that should check provider status via GET /v1/providers/{id} before invoking.
- Access
-
system; writer (
WRITER)
Request: SwitchProviderRequest. household_id is required, as on the update (#2545).
{
"household_id": "0190f5a2-7c1e-7d3a-9b4e-2f6c8a1d5e70",
"new_provider_id": "0196eb5b-1f60-7e3f-9000-9a0bf1cfc9e7",
"notes": "Family relocated, switching to neighborhood center"
}
The body names no actor (the pre-#2411 switched_by is an unknown field, 422), nor a date: the switch takes effect at once, and the pre-#2428 effective_date is an unknown field (422). notes is recorded as on the update (change = provider_switch), with the same 422 invalid_note bound.
The household check runs as on the update ([authorization-household-check]), after the note check and before the write.
Response (200): the updated CapsAuthorization row. Returns 404 if the authorization id is unknown, 409 authorization_household_mismatch if it is another household’s, 422 foreign_key_violation if the provider id is unknown, 422 invalid_note as above.
GET /v1/authorizations/{id}/notes (#2929)
The authorization’s note history: each note its update and provider-switch writes recorded (#2428), in written order, oldest first. canopy-web’s CAPS authorization tab lists them under each authorization, newest first.
- Access
-
system; caseworker+; case reader via canopy-web (
delegated::CAPS_GET_AUTHORIZATIONS_ID_NOTES) — the admission of the tab’s authorizations read
Response (200): array of AuthorizationNote, ordered by created_at, then id:
[
{
"id": "019a1c2e-7d40-7c4e-8a51-3f0d2b6e9a01",
"change": "update",
"note": "Worker reduced after parent moved to part-time",
"actor": { "actor_type": "human", "subject": "4b3e6a2c-…" },
"created_at": "2026-10-19T14:05:12.345678Z"
}
]
change is update or provider_switch; actor is the caller of that write (human with its OIDC subject, or service with its principal); created_at is the change’s own instant, the authorization’s updated_at as that write left it. An authorization whose writes recorded no note answers []. Returns 404 if the authorization id is unknown.
Worker facts (#3182)
canopy-caps records two findings a worker makes and no other service records: a parent’s activity standing and a child’s care need. Both records are append-only: a change is a new row with a later effective_date. The standing on a date is the row effective latest on or before it, a later created_at first on the same day (standing_on in src/store/parent_activities.rs and src/store/child_care_needs.rs). POST /v1/determine reads each parent’s standing and each child’s need on its legal day (#3183, The per-parent activity test (#3183)).
Both creates take the same admission. They admit a writer’s delegation only:
-
WRITERadmits the writer bar, soquality_controlis 403required_role_missing. -
recorder_subject(src/api/handlers.rs) refuses the system callerWRITERalso admits, with 403service_class_on_user_only. -
recorded_byis the delegation’s OIDC subject, never a body field. -
created_atis the request’s decision instant (the injectedDecisionClock).
Both creates judge effective_date as canopy-wic’s breastfeeding create does (check_effective_date, src/api/handlers/effective_date.rs), in this order:
-
an
effective_dateoutside the years 1900-9999 is 422caps_date_out_of_range, so a date PostgreSQL cannot store is refused rather than failing the insert; -
an
effective_dateafter the service’s legal today is 422caps_effective_date_in_future. The legal today is the request’s decision instant read on the pack’s[jurisdiction].timezonecalendar (CapsParameterTable::legal_timezone), never the UTC day.
Either refusal writes nothing and names the field, never the date sent.
Both lists admit READER and answer a person’s rows newest effective_date first, then the later created_at, then the higher id, at most 100; an empty array when none is recorded. person_id is required; a missing or malformed one is 400. Handlers: src/api/handlers/parent_activity.rs and src/api/handlers/care_need.rs. Shapes: crates/canopy-contracts-caps/src/parent_activity.rs and care_need.rs.
POST /v1/parent-activities
Record a parent’s activity standing from a date.
- Access
-
writer (
WRITER); a system caller is 403service_class_on_user_only
Request: CreateParentActivity (deny_unknown_fields):
{
"person_id": "0196eb5b-1f60-7e3f-9000-9a0bf1cfc9e7",
"weekly_hours": 0,
"verified": false,
"unable_to_provide_care": true,
"care_waiver_verification": "licensed_medical_statement",
"effective_date": "2027-04-01"
}
-
weekly_hoursis the parent’s approved activity hours per week, a non-negative integer up to 65535 (u16);verifiedsays whether the activity is verified. -
unable_to_provide_careclaims the parent cannot provide care because of a disability.care_waiver_verification(CareWaiverVerification:licensed_medical_statementoragency_documentation) says how the claim was verified; absent or null while it is unverified. A claim without a verification is recorded and waives nothing. -
effective_dateis refused 422caps_date_out_of_rangeorcaps_effective_date_in_futureas above, checked before the waiver. -
A body whose
care_waiver_verificationis set whileunable_to_provide_careis false is 422care_waiver_without_claim, before any write. The table’s CHECKcaps_parent_activities_waiver_needs_claimholds the same rule. -
A body naming
id,created_atorrecorded_by, or a token outside the vocabulary, is 422.
Response (201): the stored CapsParentActivity: the body’s fields, id, recorded_by and created_at.
GET /v1/parent-activities?person_id={uuid}
List a person’s recorded activity standings.
- Access
-
system; caseworker+; case reader via canopy-web (
delegated::CAPS_GET_PARENT_ACTIVITIES), so canopy-web’s Authorization tab lists each parent’s standing to every case reader (#3184)
Response (200): array of CapsParentActivity, in the list order above.
POST /v1/child-care-needs
Record a child’s need for care from a date.
- Access
-
writer (
WRITER); a system caller is 403service_class_on_user_only
Request: CreateChildCareNeed (deny_unknown_fields):
{
"person_id": "0196eb5b-1f60-7e3f-9000-9a0bf1cfc9e7",
"scholarship_type": "full_time",
"has_documented_disability": false,
"effective_date": "2027-04-01"
}
scholarship_type (ScholarshipType) is the type of care the child needs: full_time, part_time, before_after_school or variable_schedule. has_documented_disability says whether the child’s disability is documented. effective_date is refused 422 caps_date_out_of_range or caps_effective_date_in_future as above. A body naming id, created_at or recorded_by, or a token outside the vocabulary, is 422.
Response (201): the stored CapsChildCareNeed: the body’s fields, id, recorded_by and created_at.
Family asset certification (#3546)
45 CFR 98.20(a)(2)(ii) makes a child eligible only in a family whose assets do not exceed the federal limit, "as certified by such family member". canopy-caps records what a family member certified, for the household. The record holds no dollar figure: the family certifies to the federal statement. It is append-only: a correction is a new row.
A determination reads the certification standing on its legal day (The family asset test (#3547)).
POST /v1/asset-certifications
Record a household’s certification.
- Access
-
a writer’s delegation only, as the worker-fact creates:
WRITER, thenrecorder_subjectrefuses a system caller with 403service_class_on_user_only.recorded_byis the delegation’s OIDC subject, never a body field.
Request: CreateAssetCertification; an unknown field is 422.
| Field | Type | Meaning |
|---|---|---|
|
UUID |
The household the certification is for. |
|
UUID |
The family member who certified. canopy-caps does not check the person against the household; canopy-web’s action proves them on the roster first. |
|
bool |
What they certified: |
|
date |
The day they certified. |
Refusals, in order:
-
certified_onoutside the years 1900 to 9999 is 422caps_date_out_of_range. -
certified_onafter the service’s legal today is 422caps_certified_on_in_future.
Each names the field and never the date sent.
Response (201): the stored CapsAssetCertification: the body’s fields, id, recorded_by and created_at (the request’s decision instant).
GET /v1/asset-certifications?household_id={uuid}
List a household’s recorded certifications, newest certified_on first, a later created_at first on the same day, at most 100.
- Access
-
system; caseworker+; case reader via canopy-web (
delegated::CAPS_GET_ASSET_CERTIFICATIONS), as the worker-fact lists
Response (200): array of CapsAssetCertification; empty when none is recorded. A missing or malformed household_id is 400.
Provider Registry (#396)
CAPS providers are first-class rows in caps_providers; caps_applications.provider_id and caps_authorizations.provider_id FK here. Soft-delete only (status flips to inactive); historical authorizations preserve their FK after a provider is retired.
- Access
-
system (inline
Admission::system(),src/api/providers.rs) on the list, create, update and delete — a user is 403system_caller_required;GET /v1/providers/{id}is system; case reader via canopy-web (delegated::CAPS_GET_PROVIDERS_ID), so a delegation through canopy-cli or canopy-eligibility is 403actor_not_allowed
POST /v1/providers
Create a provider.
Request:
{
"provider_code": "PRV-042",
"legal_name": "Sunshine Childcare LLC",
"doing_business_as": "Sunshine Daycare",
"ein": "12-3456789",
"license_number": "GA-CC-0042",
"license_type": "center",
"license_expires": "2027-12-31",
"contact_email": "admin@sunshine.example",
"contact_phone": "+14045551234",
"address_line1": "123 Sunny Street",
"city": "Atlanta",
"state": "GA",
"postal_code": "30303"
}
provider_code is unique; a duplicate returns 409 unique_violation (the shared database mapping, Coding Conventions › Database errors).
Response (200): the new CapsProvider row (id assigned server-side).
PUT /v1/providers/{id}
Partial update — only fields present in the body are updated; omitted fields preserve their current value via COALESCE. provider_code and status are not editable here (rotate code via DELETE + POST; status via DELETE for soft-delete).
Error Codes
| Code | Meaning |
|---|---|
400 |
Invalid input (missing required field, negative income, etc.); an |
401 |
No bearer ( |
403 |
The route’s admission refuses the caller: |
404 |
Determination, authorization, or provider not found |
409 |
Unique-key violation (duplicate |
422 |
|
503 |
No trustworthy key set in time ( |
Events Published
caps.determined and caps.authorization_created are held until the determination is recorded (#2322). api/persist.rs stages them in the persist transaction under the child’s determination’s canopy_mq::hold_for(determination_id), and the verdict consumer under Events Consumed releases them on determination.recorded.caps or drops them on determination.disowned.caps (ADR-002 Amendment 7). A determination canopy-eligibility never records, a direct caller’s included, publishes neither.
-
caps.determined— determination completed (IDs and status only per ADR-004) -
caps.authorization_created— provider authorization created (IDs only) -
determination.redacted(#687) — a data steward crypto-shredded a determination’s snapshot; carries the actorsub+ reason, no plaintext
Events Consumed
-
canopy-caps.determination-verdicts←determination.recorded.caps,determination.disowned.caps(src/verdict_subscriber.rs, #2322) — canopy-eligibility’s verdict on a determination this service signed (ADR-002 Amendment 7; payloads in canopy-eligibility’s verdicts). In the inbox transaction,recordedreleases the outbox rows held undercanopy_mq::hold_for(determination_id)anddisowneddeletes them; the verdict is recorded indetermination_verdicts, where arecordedverdict is final. A key that is no verdict parks; a malformed payload, or one naming a program this service does not determine, dead-letters. A replay releases or drops nothing.