canopy-tanf API Reference

Overview

Cross-link: canopy-tanf Data Model (#419)

TANF program service. Computes eligibility determinations (income/asset tests, AU composition; alien-sponsor deeming is not computed until #810), tracks federal 60-month time limits and 45 CFR Part 261 work requirements, manages PAMMS 1345-1370 personal responsibility agreements, the supplemental payments a pack declares, and an IRC §6103(l)(7)-scoped FTI audit log (ADR-004 + ADR-014). Cross-program overpayment recovery (PAMMS 9000 / 42 USC 609(a)(1); 45 CFR 263.11) shares the surface with canopy-snap and canopy-medicaid.

All eligibility logic runs through the rules engine (ADR-003) — federal regulation values live in the federal layer, jurisdiction values in the pack’s jurisdiction.toml traced via citations.toml.

Base URL

container port 8014 (host: CANOPY_PORT_CANOPY_TANF_8014 in .ports.env); every route below is mounted under /v1

Authentication

Bearer token: a canopy-identity token for this receiver (its aud is urn:canopy:service:canopy-tanf), authenticated by the service’s identity receiver (ADR-049 Amendment 14): no bearer is 401 token_missing, a token it refuses 401 token_rejected, an X-Canopy-Actor header 400 actor_header_retired, and no trustworthy key set in time 503 keys_unavailable.

Access

canopy-reporting holds a system edge to canopy-tanf (and also delegates onward), and every system arm below admits its system token; canopy-eligibility holds the other (#3322), admitted on the family-composition batch alone. canopy-web, canopy-cli and canopy-eligibility (onward from a worker’s determine) reach the rest by delegation. The writes admit a system caller or the writer bar, the reads a system caller or caseworker+ (canopy-web’s case readers on the listed reads, its supervisor view on the sanctions rollup, canopy-reporting’s case readers on the overpayment list), the federal month scope, the work-standard classification batch (#2315), the family-composition batch (#3048) and the full-week hours batch (#3193) system callers alone, and the other §B4 batches a system caller or canopy-web’s case readers (#2312, #2939); the redaction admits data_steward alone, the FTI audit reads fti_auditor, the admin replay admin, and the held-determination list a determination operator’s delegation through canopy-eligibility alone (GET /v1/held-determinations). A refusal is 403 with its ReceiverDenial code (ADR-049 Amendment 14); each route’s constant is in the authorization inventory.

Swagger UI

/swagger-ui on the same host port

Database

canopy_tanf (isolated per ADR-001; FTI scope under IRC §6103(l)(7), SSA SOLQ/BINDEX under TANF CMA per ADR-004)

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; supervisor view = SUPERVISOR_VIEW_ROLES (all crates/canopy-auth/src/roles.rs); via canopy-web / via canopy-reporting = only a delegation that client presents; with no client named, the bar admits a delegation through any client.

  • The admissions are READER, WRITER, SYSTEM and FAMILY_COMPOSITION_READERS (src/api/mod.rs; each system arm lists its clients, SYSTEM_CALLERS: canopy-reporting), FTI_AUDITOR (src/api/fti_audit_handlers.rs), the overpayment routes under canopy-tanf’s own READER / WRITER (ClaimAdmissions, crates/canopy-overpayments/src/api.rs), inline Admission::user_roles(&["data_steward"]), canopy-api’s ADMIN_HUMAN, and the nine delegated::TANF_* rows. No handler checks anything beyond its admission, except the discrepancy resolve’s household consistency check, which authorizes nothing (#2545; the resolve route below).

  • GET /v1/determinations admits conditionally: with month, SYSTEM; without, delegated::TANF_GET_DETERMINATIONS.

  • The writer bar leaves out quality_control: QC reviews a determination or a discrepancy and never decides one, so it is 403 required_role_missing on every writer-bar write.

  • Attribution: the determine’s FTI chain accessed_by, the redaction event’s actor sub and the work-standard basis’s recorded_by are principal.attribution_sub() (the user’s canopy subject, or a system caller’s client id; the redaction admits users alone). The overpayment claim’s discovered_by and the tanf.work_standard_basis_recorded event's recorded_by (#3024) are principal.actor(): a user as Human (the canopy subject), a system caller as Service named by its client id. The discrepancy’s resolved_by is the user’s canopy subject, and the literal system for a system caller (the historical value, deliberately not the client id).

  • Outbound calls: the determine’s and POST /v1/work-requirements/evaluate's canopy-rules calls ride the request’s outbound (RequestOutbound), which on canopy-tanf’s system-only edge to canopy-rules is its own system token whoever the caller. The canopy-persons reads (PersonsClient) of the work-activity summaries, the work-activity log and the work-standard basis write, and the boot signing-key registration with canopy-security send through canopy-tanf’s IdentitySender (system origin).

Determination

POST /v1/determine

Run a TANF eligibility determination. Called by canopy-eligibility orchestrator.

Access

system; writer (WRITER, src/api/mod.rs) — quality_control is 403 required_role_missing. A body naming an operation_id is 403 from any caller but canopy-eligibility, on its system token or its onward delegation (enforce_operation_gate, src/api/handlers.rs; #3116). The FTI chain’s accessed_by is the caller’s attribution_sub(): the worker’s canopy subject (canopy-eligibility’s onward delegation included), or a system caller’s client id.

Request: ApplicationContext — application context, household composition (AU), per-member income/assets/expenses, SSA data when in scope. members (required, at least one) is the household: canopy-tanf composes the assistance unit from it, and every income line names one of its members. household_size is recorded and stated on the notice and prices nothing. parent_child (required, #3048) lists the household’s parent–child relations, each {parent_person_id, child_person_id, kind} with kind one of natural, adoptive or step; canopy-eligibility forwards it from canopy-persons. operation_id (optional, #3116) is the determination operation canopy-eligibility claimed for the dispatch; a direct caller sends none.

A replay is answered first (#3116): when the body’s operation_id already has a determination, the handler answers that determination’s stored envelope, parsed from the row’s signed_payload with its stored signature, and writes no row and stages no event (determine::replayed_envelope). A dispatch retried after its first execution committed therefore binds the same determination at canopy-eligibility.

Otherwise, the handler:

  1. Reads the members' ids and the relations among them before any write (au_composition::inputs::ids_and_edges, #3048), refusing a request its members do not account for (see the 422 answers below). A relation naming a person who is not a member is ignored.

  2. Composes the assistance unit by asking the pack (ADR-054, #3507): tanf-dependent-child once per member, then tanf-unit-member once per member with the two relation facts canopy-tanf derives from parent_child (parent_of_dependent_child, only_step_relations_to_dependent_children). Each member is included, excluded, penalized or deemed, with the pack's reason or deemer type, and the decision says whether the member counts toward the unit's size and whether their income counts.

  3. Runs work-requirement screening (45 CFR Part 261)

  4. Loads active sanction tier + lifecycle (tanf_work_requirements.sanction_level / sanction_expires_at; PAMMS 1351) and non_compliant personal-responsibility rows (PAMMS 1345-1370). These flow into the tanf-eligibility JDM ruleset as input.active_sanction_level / input.sanction_expired / input.personal_responsibility_failures / input.personal_responsibility_pending (#416). Since #3506 the decision is also handed, at context.sanction_step, the row of the pack's [[tanf.sanction_steps]] for the stored level (null at level 0), and a stored level with no such row is an uncoded 502 raised before the decision is asked; nothing is stored.

  5. Assembles each person's income facts (wages, self_employment_net after business costs, unearned by type; no disregard) and asks tanf-eligibility, handing it the unit's size, its members with those facts, and every standard the pack names resolved for that size (context.standards) with the pack's values (context.values). Each member also carries their counted months as of the evaluation day: federal_months, and counters.<code> for each counter the pack declares (Rulesets › TANF counters, #3519), and supplemental_payments.<code>, the count and age of the payments of each declared type recorded with the member as payee (TANF standards and supplemental payments, #3522). The decision counts income, applies the pack's disregards and tests, and returns gross_income and net_income. On an eligible verdict tanf-benefit-calculation computes the grant on that net_income. A grant the decision does not issue leaves the case approved with a benefit_amount of 0, and the decision names its minimum_benefit (#2917). The decision says how long the approval lasts and when the case is due for review (certification_months, review_months; #3521): canopy-tanf computes the last day and the review day from the evaluation day, signs the review day as renewal_date, and stores no expiration_date for an approval with no end. The decision also says whether federal funds pay the grant (federally_funded), which is kept on the determination for the job that counts months (#3518). The decision also returns the deprivation basis it judged on and whether its own rule supplied it; both are signed into program_extension as deprivation_basis and deprivation_provisional (#3509; deprivation_basis_source is no longer written).

  6. Checks the federal 60-month time limit on the applicant's clock and on each spouse member's (45 CFR 264.1(a)(1); #3518): the family is denied time_limit when any that is not exempt has reached it

  7. Assembles + persists the determination input snapshot (ADR-028, #685): the eligibility rules_input (incl. the time-limit/sanction/PR inputs) + its output, the benefit calc, the income/asset/expense facts + household composition, the resolved policy params, and the ruleset corpus-hash. Its SHA-256 (RFC 8785 canonical) becomes the snapshot_hash signed into the determination; the snapshot is stored immutably in determination_snapshots. TANF is FTI-bearing (IRC §6103(l)(7)), so the snapshot’s creation additionally joins the ADR-014 fti_audit_log hash chain (resource_type='determination_snapshot') — the FTI-derived artifact at rest inherits the Pub 1075 §4 tamper-evidence + §9 breach pathway.

  8. Records the composed unit: one row per member with the status and words the pack's decision gave.

  9. Signs the determination with ECDSA P-256 (ADR-002) — the signature now covers snapshot_hash, and the dispatch’s operation_id (#3116). The row stores that operation and signed_payload, the exact bytes the signature covers. The determination, its unit’s rows (tanf_determination_au_members, tanf_determination_au_parents; #3048), its snapshot, the snapshot’s DEK (its redaction_keys row, generated without a write) and the FTI chain entry commit in one transaction (persist_determination), so a determination that does not commit — a fail-closed chain-v2 append included — leaves no key and no unit row (#2382).

Response (200): SignableDetermination — the universal signed-determination envelope (ADR-002) with status, benefit amount, basis, sanction state, time-limit posture, JWS signature, and the snapshot_hash binding the input snapshot (ADR-028). The orchestrator receives only outcome + hash, never the snapshot cleartext (which stays inside canopy-tanf’s Pub 1075 boundary).

Status values emitted: approved, denied, sanctioned (#416 — emitted when the applicant has an active non-expired PAMMS 1351 sanction). The federal 60-month time-limit short-circuit writes denied with denial_reason_code time_limit. The tanf-eligibility ruleset’s o-status is read strictly (#628): it must be present, one of the three tokens, and consistent with eligible — approved exactly when eligible, denied or sanctioned exactly when not. A missing, unknown or contradicting o-status is an uncoded 502 naming the defect, raised before the determination is signed or persisted (no determination row, snapshot or event; the tanf_applications row written earlier in the request stays). denial_reason_code extends with sanction and personal_responsibility per PAMMS 1351 + 1345-1370 respectively. Since #1992 the four non-financial gates each carry their own code — no_qualifying_deprivation, deprivation_not_verified, citizenship_not_verified, no_dependent_child — and unspecified is no longer emitted. Since #3505 the codes and their sentences are the pack's [[tanf.denial_reasons]] rows (Rulesets › TANF denial reasons), not an enum of canopy's: a code the decision answers that the pack gives no row is the same uncoded 502, and nothing is stored.

Response (502, uncoded; #3507): a decision's answer canopy-tanf cannot use: a tanf-unit-member status outside the four, an excluded or penalized member with no reason, a deemed member with no deemer_type, a counted_toward code the pack's [[tanf.counters]] does not declare, an eligible verdict with no net_income, a grant not issued with no minimum_benefit, a grant that does not say whether it is federally_funded, or one with no review_months or a month count that is not a whole number from 1. The pack's decision broke its contract; no determination, unit row or snapshot is stored.

Response (409, coded operation_already_determined; #3116): a concurrent execution of the same operation_id committed its determination after this one’s replay check found none. The insert trips tanf_determinations_operation_uq and this determination rolls back. The detail names no database object. Rows the request wrote before the determination’s transaction, such as its tanf_applications row, stay.

Response (422, coded; #3048): member_person_id_invalid when a member’s person_id is not a UUID or repeats another member’s, and parent_child_kind_invalid when a relation’s kind is not natural, adoptive or step. Since #3507 also members_required when members is empty and income_person_not_a_member when an income line names a person who is not a member. All four refuse before any row is written. A body without parent_child or without members is refused at extraction, naming the field.

Response (422): the body names no applicant_person_id. A determination needs a subject — the tanf_applications, tanf_time_limits (federal 60-month clock) and tanf_work_requirements rows are keyed on it — and canopy-tanf never mints one (#1932): request extraction refuses the body before any row is written, and the detail names the field.

Response (503; the chain-v2 FTI append arm is withdrawn, ADR-041, and #1304 retires it): when that arm is enabled (CANOPY_TANF__CHAIN_V2_APPEND_ENABLED, #1207 / ADR-014 Amendment 7) and the append hits an Environment-class refusal — topology missing, epoch not active/current, routing-version skew, or a malformed source registry — the determination aborts fail-closed (a Pub 1075 determination cannot proceed without its chain row) with the fixed detail audit chain unavailable; the environment specifics go to logs only. With the flag off (the default), this arm is unreachable.

GET /v1/determinations

List determinations newest-first, keyset-paginated (#1195).

Access

conditional — system with month (SYSTEM, #1249); otherwise system; caseworker+; case reader via canopy-web (delegated::TANF_GET_DETERMINATIONS). A user asking for month is 403 system_caller_required and uses the unscoped list.

Query parameters (TanfDeterminationListParams, crates/canopy-contracts-tanf/src/models.rs):

  • limit — default 50, max 200.

  • after_determined_at + after_id — the keyset cursor; pass the previous page’s next_cursor fields together, omit both for the first page.

  • month — optional, any day in the month; scopes the universe to determinations whose coverage window [effective_date, expiration_date] overlaps that calendar month (the ACF-199 monthly-caseload universe). The first page then carries total_in_scope, the authoritative scoped COUNT(*), so a page-looping extractor can assert completeness.

  • household_id — optional; scopes the list to one household (rides 20261130000000_tanf_determinations_household_idx.sql).

The list is ordered (determined_at DESC, id DESC) — newest first, with the UUID-v7 id as a stable tiebreak — and keyset-paginated over that compound cursor (there is no offset). The default page rides idx_tanf_determinations_determined_at_id, an index scan with no top-N sort.

Response (200): TanfDeterminationPage — items (array of TanfDeterminationRead, each the TanfDetermination fields flattened including the required snapshot_hash) + next_cursor ({after_determined_at, after_id} while a full page may have more; null at the end) + total_in_scope (first page of a month-scoped query only; null otherwise).

GET /v1/determinations/{id}

Fetch a determination by ID.

Access

system; caseworker+ (READER)

Response (200): TanfDeterminationRead — the TanfDetermination 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}/explanation

Human-readable explanation of the determination — rule trace, threshold values referenced, and basis. Useful for caseworker review and hearing documentation.

Access

system; caseworker+ (READER, work_requirement_handlers::get_determination_explanation)

GET /v1/held-determinations

The determinations whose completion events canopy-tanf 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::TANF_GET_HELD_DETERMINATIONS, src/api/held.rs; determination operator = DETERMINATION_OPERATOR_ROLES): a system caller is 403 service_class_on_user_only, a user’s direct delegation 403 actor_not_allowed, and a delegation without the roles 403 required_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_since is when the oldest still-held event was staged, and held_rows how many are held. A determination is listed once its held_since is older than the decision clock’s instant less CANOPY_MQ_HELD_AGE_WARN_SECS (MqTuning::held_age_warn; Configuration Reference).

  • program is tanf.

  • operation_id is the canopy-eligibility operation the determination was dispatched under, read from its tanf_determinations row (#3116), and absent for a direct caller’s determination or one written before #3116.

  • 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. TANF is FTI-bearing, so the determination.redacted event is plaintext-free (IDs + actor + reason only, ADR-004).

Access

data_steward (inline Admission::user_roles(&["data_steward"])); a system caller is 403 service_class_on_user_only. A dedicated, privileged, irreversible role for redaction/expungement: admins do NOT hold it by default (separation of duties, mirroring fti_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 to data.steward alone.

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.

POST /v1/determinations/family-composition:batchGet

Each listed determination’s persisted assistance unit as it stands in a month (#3048, ADR-001 Amendment 1 §B4), so canopy-reporting’s ACF-199 extract types a family from the unit rather than the household roster, and canopy-eligibility reads which members a SNAP household’s TANF grant includes (7 CFR 273.2(j)(2)(i) standard categorical eligibility, #3322). One determination_id = ANY($1) query per unit table (store::list_determination_au) and persons:batchGet calls of at most 500 distinct members (no projection, as_of the month’s last day, canopy-tanf’s own system token) serve the whole batch. The read stamps nothing and reads no clock.

Access

system (FAMILY_COMPOSITION_READERS): canopy-reporting’s or canopy-eligibility’s system token; any other system token is 403 service_not_allowlisted. There is no delegated arm, so canopy-web’s delegation is 403 system_caller_required.

Request: FamilyCompositionBatchRequest. determination_ids holds at most 500 ids (BATCH_GET_MAX_IDS; uncoded 422 over). month is the month’s first day; any other day is an uncoded 422.

{ "determination_ids": ["uuid"], "month": "2026-03-01" }

Response (200): Vec<FamilyComposition>, one per requested unique determination canopy-tanf holds a unit for, in first-occurrence request order. An id with no unit is omitted: an unknown id, or a determination recorded before #3048, when no unit was stored. Each entry lists every unit member in person-id order (FamilyMember), so it always names at least one:

  • minor: under the pack’s [tanf.wpr].work_requirement_age_min on the month’s last day, counted as canopy_types::date::age_years counts it. A member canopy-persons returns no date of birth for is false, and the read logs the missing person ids at WARN.

  • receives_assistance: the composer included the member.

  • head_of_household: the member was the determination’s applicant.

  • parent_of: the member’s relations (child_id, kind) to unit members who are minors in the month.

  • work_eligible (45 CFR 261.2(n), family_composition::work_eligible): a recipient, or a parent of an included minor, unless a minor who is not the head of household. The (n)(2)(i) caregiver exclusion and the case-by-case SSI and SSDI exclusions are not applied (#2974).

502 persons_unavailable when canopy-persons cannot resolve the members' dates of birth, which fails the whole request.

Work Requirements (45 CFR Part 261)

POST /v1/work-requirements/evaluate

Stateless evaluation against the tanf-work-requirements JDM ruleset (#1513: realigned to PAMMS 1349 MT 81). The request body is the full WorkRequirementsInput fact set (person age + head-of-household, exception facts — ineligible non-citizen, caregiver-of-disabled
medical documentation, disability status — infant-exemption election state, AU composition/child-care flags, reported hours); every threshold (hour bands, month caps) loads server-side from jurisdiction.toml [tanf.wpr]. The response distinguishes work_eligible: false (the five PAMMS 1349 EXCEPTIONS — outside the requirement) from exempt: true (the Form 489 infant election — a WEI whose requirement is paused), and carries good_cause_waived (an active PAMMS 1302 FVO waiver: still required, sanction path stands down) plus compliance_status ∈ {not_work_eligible, exempt, good_cause_waived, compliant, non_compliant}.

Access

system; caseworker+ (READER)

GET /v1/work-requirements/{person_id}

Return the person’s NEWEST work-requirement row (by (created_at, id), the same projection as the batch sibling). A true read: 404 on absence, never creates a row.

Access

system; caseworker+; case reader via canopy-web (delegated::TANF_GET_WORK_REQUIREMENTS_PERSON_ID)

POST /v1/work-requirements:batchGet

Get the work-requirement status projection for a set of persons in one round-trip (#1203) — one person_id = ANY($1) set query replacing the ACF-199 extract’s per-adult GET. Capped at 500 IDs per request (422 on overflow); duplicates collapse to one entry; the response follows first-occurrence request order.

Access

system; case reader via canopy-web (delegated::TANF_POST_WORK_REQUIREMENTS_BATCH_GET): the worker portal’s work-requirement tab reads its household’s members in one call (#2312). No direct user arm: canopy-cli’s delegation is 403 actor_not_allowed, and interactively the per-person GET above is the user surface.

READ-ONLY: both the batch and the single GET are true reads — NEVER creating a row (since #1330; pinned by row-count-unchanged tests).

GET-OR-DEFAULT, exact-set: every requested UNIQUE id gets exactly one entry. on_file: false means no row exists; the entry then carries synthesized column defaults (required: true, exempt: false, status: "pending") — except sanction_level, which ships null rather than the column’s DEFAULT 0, because a no-row entry must not fabricate a sanction datum. on_file is the discriminator the extract maps on.

Multi-row history: tanf_work_requirements has no unique(person_id) — multiple rows per person are expected history. Both read surfaces project the NEWEST row by (created_at, id) (deterministic tie-break, shared store fn since #1330).

Request: BatchGetWorkRequirementsRequest

{ "person_ids": ["uuid", "uuid"] }

Response (200): Vec<WorkRequirementStatusEntry> — [{ person_id, on_file, required, exempt, status, sanction_level }].

POST /v1/work-requirements/{person_id}/activities

Log a single work-activity record (countable hours). Stages tanf.work_requirement_updated in the same transaction.

Access

system; writer (WRITER) — quality_control is read-only and gets 403 required_role_missing

Request:

{
  "activity_type": "employment",
  "hours_per_week": "30",
  "effective_date": "2026-04-15",
  "end_date": null
}

Used to drive ACF-199 WPR (work participation rate) — see canopy-reporting.

Response (201): the stored TanfWorkActivity. 422 when activity_type is outside the [[tanf.work_activities]] vocabulary; hours_out_of_range when hours_per_week, rounded to one decimal place as stored, is not above 0 or exceeds 168; activity_span_inverted when end_date is before effective_date (#2193 — the tanf_work_activities CHECKs refuse the same values for every other writer). An activity that passes those checks is logged and its event staged in one transaction (insert_activity_and_stage). Before the transaction opens, one canopy-persons core read (PersonsCalls::household_for_person, no projection, so no SSN is opened) finds the subject's household on the request's legal day, its decision instant in the pack's [jurisdiction].timezone (subject_household, the read the work-standard basis write makes, #3046). That read fails closed: when canopy-persons cannot answer, the write is 502 persons_unavailable and nothing is stored.

GET /v1/work-requirements/{person_id}/activities

List activity records for a person. Filterable by date range. Newest first: effective_date descending, then id descending, so same-day activities list in one order, the later-logged first (#2969). The summaries' row_breakdown, single and batch, follow the same order.

Access

system; caseworker+; case reader via canopy-web (delegated::TANF_GET_WORK_REQUIREMENTS_PERSON_ID_ACTIVITIES)

POST /v1/work-requirements/{person_id}/work-standard-basis

Record a dated work-standard basis (#2193): the custody facts that decide the person’s 45 CFR 261.34(c) week — 20 hours for a single custodial parent with a child under six, 30 for everyone else — from effective_date on. canopy records custody nowhere else. A basis is never edited: a correction is a new row, and the basis in force on a date is the one with the latest effective_date on or before it, a tie going to the latest recorded.

Access

system; writer (WRITER); recorded_by is the caller’s attribution_sub() (the worker’s canopy subject, or a system caller’s client id)

Request: RecordWorkStandardBasisRequest

{
  "effective_date": "2026-01-01",
  "single_custodial_parent": true,
  "custodial_child_ids": ["0192a8c4-0000-7000-8000-000000000001"]
}

Response (201): the stored WorkStandardBasis (id, person_id, effective_date, single_custodial_parent, custodial_child_ids, recorded_by, created_at). 422 effective_date_out_of_range when effective_date is outside four-digit years (1000-9999), and 422 custodial_children_required when single_custodial_parent lists no child (#3020; check_basis_year, check_custodial_children). The child list is checked next (#3023): 422 custodial_child_is_subject when custodial_child_ids lists the person the basis describes (check_subject_not_a_child, before any read), and 422 custodial_child_unknown when canopy-persons does not return a listed child (check_children_known). That check is the read the summary makes when it resolves the children (week_standard::fetch_dates_of_birth): persons:batchGet with include_inactive: false and no projection, in calls of at most 500 ids, on canopy-tanf's own system token, with as_of the basis's effective_date. It applies to every listed child, whatever single_custodial_parent says, and a basis that lists no child makes no call. It fails closed: when canopy-persons cannot answer, the write is 502 persons_unavailable and nothing is stored. A basis that passes every check is stored and audited in one transaction (#3024). Before the transaction opens, one more canopy-persons core read (PersonsCalls::household_for_person, no projection, so no SSN is opened) finds the subject's household on the recording's legal day, its decision instant in the pack's [jurisdiction].timezone (subject_household). That read fails closed as well: 502 persons_unavailable, and nothing is stored. The transaction inserts the row and stages tanf.work_standard_basis_recorded (insert_basis_and_audit).

GET /v1/work-requirements/{person_id}/work-standard-basis

The person’s work-standard timeline: every recorded basis, effective_date descending, then latest recorded first; empty when none is recorded.

Access

system; caseworker+ (READER)

Response (200): Vec<WorkStandardBasis>.

POST /v1/work-requirements/work-standard-basis:batchGet

Every listed person’s work-standard timeline in ONE round-trip (#3020, ADR-001 Amendment 1 §B4), backed by ONE person_id = ANY($1) query (store::list_work_standard_bases_for_persons), so the worker portal’s work-requirement tab reads its on-file members without a call per person. The read stamps nothing and reads no clock.

Access

system; case reader via canopy-web (delegated::TANF_POST_WORK_REQUIREMENTS_WORK_STANDARD_BASIS_BATCH_GET): the worker portal’s work-requirement tab reads its on-file members' timelines in one call. No direct user arm: canopy-cli’s delegation is 403 actor_not_allowed, and interactively the per-person GET above is the user surface.

Request: BatchGetWorkStandardBasesRequest. person_ids holds at most 500 ids (BATCH_GET_MAX_IDS; 422 over). as_of is the caller’s legal day.

{ "person_ids": ["uuid", "uuid"], "as_of": "2026-11-15" }

Response (200): Vec<WorkStandardTimeline> (person_id, bases, in_force_basis_id).

  • Order. One timeline per requested unique id, in first-occurrence request order; a repeated id collapses to its first position. Each bases lists as the single GET does: effective_date descending, then latest recorded first, then greatest id.

  • In force. in_force_basis_id is the id of the basis in force on as_of (store::basis_in_force): the latest effective_date on or before it, a tie going to the latest recorded. It is null when every basis starts after as_of, so a future-dated basis can lead the list without being in force.

  • Exact-set. A person with no basis recorded, an unknown id included, gets empty bases and a null in_force_basis_id.

POST /v1/work-requirements/work-standard:batchGet

Each listed person’s 45 CFR 261.34(c) work standard for a month (#2315, ADR-001 Amendment 1 §B4), classified from the work-standard basis in force on the month’s last day exactly as the work-activity summary decides its job-search week (classify_week_standard in src/participation/week_standard.rs). canopy-reporting’s ACF-199 extract reads it to type a young-child family. One person_id = ANY($1) basis query (store::list_work_standard_bases_for_persons) and one persons:batchGet pass over the in-force single-custodial-parent bases' custodial children (calls of at most 500 ids, as_of the month’s last day, canopy-tanf’s own system token) serve the whole batch. The read stamps nothing and reads no clock.

Access

system (SYSTEM): canopy-reporting’s system token. There is no delegated arm, so canopy-web’s delegation is 403 system_caller_required.

Request: BatchGetWorkStandardsRequest. person_ids holds at most 500 ids (BATCH_GET_MAX_IDS; uncoded 422 over). month is YYYY-MM with a four-digit year (1000-9999); anything else is 400.

{ "person_ids": ["uuid", "uuid"], "month": "2026-11" }

Response (200): Vec<WorkStandardEntry>, one entry per requested unique id in first-occurrence request order, a repeated id collapsing to its first position. Each entry carries person_id and its outcome beside it, tagged on outcome (WorkStandardOutcome):

  • decided, with class (WorkStandardClass): single_custodial_parent_child_under_six when the basis records a single custodial parent and a listed child canopy-persons knows is under six on the month’s last day (the 72-month cutoff of the federal layer’s tanf-work-activity-limits.json), other otherwise. A sixth birthday on the month’s last day ends under-six.

  • work_standard_unrecorded: no basis is in force on the month’s last day, an unknown id included.

  • work_standard_child_unknown, with child_id: the first listed child canopy-persons does not return, when no known listed child is under six.

The outcome is per entry rather than a whole-batch 422, so one refusal neither fails nor hides another and every refusal names its person; the two refusal tags are the summary’s 422 codes. 502 persons_unavailable when canopy-persons cannot resolve the children’s dates of birth, which fails the whole request.

A sole caretaker relative of a child under six is recorded as single_custodial_parent = true: 42 USC 607(c)(2)(B) reaches "the only parent or caretaker relative in the family", and 45 CFR 261.35, its restatement, is removed.

GET /v1/work-requirements/{person_id}/activities/summary?month=YYYY-MM

Aggregated hours for the target month (required ?month=YYYY-MM), broken down by activity type and classified core / non-core per 45 CFR 261.31. Pass ?detail=row to attach a per-work_activity_id drill-down under row_breakdown (#406).

Access

system; caseworker+ (READER)

Weekly averages (#2316). average_weekly_total_hours and average_weekly_core_hours are the ACF-199 WPR inputs: the month’s countable hours as an average week, the unit of the 45 CFR 261.31 and 261.32 standards. total_hours, core_hours and non_core_hours stay monthly, for the worker portal. canopy-tanf converts each row from its rate and its days, with days_per_week from the federal layer’s tanf-work-participation.json (seven, 261.34(d); FederalParticipation), and never rounds:

  • A row’s average is hours_per_week × its days in the month ÷ the month’s days, multiplied first, so a row held all month averages exactly to its rate in a month of any length.

  • A row with a partial excess loses excess × days_per_week ÷ the month’s days, never going below zero; a row wholly past its limit averages zero.

  • A partial-week credit adds credit × days_per_week ÷ the month’s days to its type.

  • The core average sums the core types alone. The monthly logged_hours is hours_per_week × (days ÷ days_per_week).

total_hours, core_hours and non_core_hours are COUNTABLE hours (#2193). Hours past a work-activity limit count toward none of them — ACF rejects counting limited hours as non-core (73 FR 6789) — while logged_hours keeps every logged hour and excess_hours sums the excluded ones; each type and drill-down row itemizes hours (logged), cap_excess_hours and countable_hours. The limits are the pack’s limit_role codes (Rulesets):

  • Job search / job readiness (45 CFR 261.34). Replayed in hours, chronologically, from the first job-search week preceded by 12 months without job search, each month under its own rules: a limit of six weeks — twelve in a month the pack designates needy — of the month’s week (20 or 30 hours, from the work-standard basis in force on the month’s last day), counted over the 12 months ending with that month; a week that follows four consecutive reported weeks is barred, all its hours excess. Weeks are seven days from the pack’s week_starts_on: a weekday, or the first day with job-search hours, weeks then running back-to-back while each has hours (Rulesets). Where the pack elects the 261.34(e) partial-week credit, a qualifying week’s prorated hours count toward the type as partial_week_credit_hours and against the limit; canopy records no attended days yet, so an elected credit reports unavailable. A person is assessed when a job-search row overlaps the week holding the month’s first day through its last day.

  • Vocational educational training (42 USC 607(d)(8)). From the month after the lifetime months are used, every hour is excess.

cap_usage reports each limit, tagged on cap_basis: job_search_hours_per_lookback (activity_type, lookback_start, week_hours, needy_state, limit_weeks, limit_hours, countable_hours over the lookback, weeks_barred, partial_week_credit — tagged on status: not_elected, unavailable, unused or used with its week_start — and partial_week_credit_hours), or vocational_months_lifetime (activity_type, limit_months, used_months).

Response (200): WorkActivitiesSummary (total_hours, core_hours, non_core_hours, logged_hours, excess_hours, average_weekly_total_hours, average_weekly_core_hours, activity_breakdown, optional row_breakdown, cap_usage). 400 when month is not YYYY-MM with a four-digit year (1000-9999) and a month in 1-12 (parse_year_month, #2254). A policy input the job-search limit reads is never assumed: 422 work_standard_unrecorded (a month it reads has no basis in force on its last day), 422 work_standard_child_unknown (a listed custodial child canopy-persons does not return, and no known child under six), 422 needy_state_undesignated (a month it reads lies outside every [[tanf.participation.needy_state_periods]] period), and 502 persons_unavailable (canopy-persons could not resolve the children’s dates of birth). The dates of birth come from ONE batched persons:batchGet read per request — calls of at most 500 ids, as_of the summary month’s last day, canopy-tanf’s own system token — however many months the replay reads; a month without a needy designation or a basis is refused before canopy-persons is called.

POST /v1/work-requirements/activities/summary:batchGet

AIP-231 batch variant of the summary (#1252, ADR-001 Amendment 1 §B4): per-person monthly summaries for a bounded id set in ONE round-trip, backed server-side by ONE person_id = ANY($1) query — the set-based bulk read #320’s closing comment deferred, eliminating the ACF-199 extract’s per-adult GET N+1. Body: BatchActivitiesSummaryRequest (person_ids ≤ 500, month YYYY-MM). One WorkActivitiesSummaryEntry per id in first-occurrence request order, duplicates collapsed, zero-hours when a person has no overlapping activities (the single GET’s get-or-zero semantics); ?detail=row attaches each person’s drill-down, as on the single GET (#2312). The #2193 limits apply per person exactly as on the single GET, from one limited-activity history read, one work-standard basis read and one batched persons:batchGet read of the custodial children’s dates of birth (calls of at most 500 ids) for the whole batch — never a canopy-persons call per person or per month.

Per-person refusals (#3050). Each entry is tagged on outcome, as the work-standard:batchGet entries are (#2315), so one person’s refusal neither fails nor hides another’s, and every refusal names its person:

  • summarized: the person’s WorkActivitiesSummary, its members beside the tag;

  • work_standard_unrecorded: person_id, and the month_end of the first month the person’s job-search limit reads with no basis in force on that day;

  • work_standard_child_unknown: person_id, the first listed child_id canopy-persons does not return, and the month_end that basis cannot decide.

A refused person’s children are not read. needy_state_undesignated (a pack gap, not a person’s) and persons_unavailable still fail the whole request. The single GET answers the same two refusals as its coded 422s.

Access

system; case reader via canopy-web (delegated::TANF_POST_WORK_REQUIREMENTS_ACTIVITIES_SUMMARY_BATCH_GET): the worker portal’s work-requirement tab reads its on-file members' month in one call (#2312). No direct user arm: canopy-cli’s delegation is 403 actor_not_allowed.

Query parameters: detail (optional): row attaches each person’s per-row drill-down under row_breakdown, as on the single-person summary (#406, #2312).

Response (200): Vec<WorkActivitiesSummaryEntry>. 400 on a month outside the same YYYY-MM rule; 422 over the 500-id cap, or 422 needy_state_undesignated for any person; 502 persons_unavailable.

POST /v1/work-requirements/activities/full-weeks:batchGet

Each entry’s countable hours in every full week of its assisted period within a month (#3193, ADR-001 Amendment 1 §B4). 45 CFR 261.22(d)(1) and 261.24(d)(1) count a family assisted for only part of a month when a work-eligible individual meets the standard "in each full week that the family receives assistance in that month"; canopy-reporting’s ACF-199 extract reads these weeks for that test. The arithmetic is src/participation/full_weeks.rs; the handler is batch_full_weeks in src/api/work_requirement_handlers/full_weeks.rs.

Access

system (SYSTEM): canopy-reporting’s system token. There is no delegated arm, so canopy-web’s delegation is 403 system_caller_required.

Request: FullWeeksRequest. month is YYYY-MM with a four-digit year (1000-9999); anything else is 400. entries holds at most 500 entries (BATCH_SUMMARY_MAX_IDS; uncoded 422 over). Each is a FullWeeksEntry: person_id, assisted_from, and assisted_through (null for an open period).

{ "month": "2026-03", "entries": [ { "person_id": "uuid", "assisted_from": "2026-03-10", "assisted_through": null } ] }

The weeks. A full week is seven consecutive days (the 261.34(d) week), wholly inside the month and wholly inside the period, counted from the period’s first day in the month (full_week_starts):

  • Assisted from the 10th to the 31st, the weeks start on the 10th, 17th and 24th, and the 31st is in none.

  • Assisted from the 1st to a closure on the 12th, the one week is the 1st to the 7th.

  • Six assisted days or fewer hold no full week.

The family’s period sets the weeks, never the pack’s week_starts_on.

The hours. The month’s activity rows come from one person_id = ANY($1) query. The work-activity limits come from the summary batch’s one assessment of the month (build_limit_contexts), so they stay assessed once, by month. On each of its days in a week, a row counts its daily rate less its daily excess, never below zero (week_hours):

  • The daily rate is hours_per_week ÷ days_per_week (the federal layer’s tanf-work-participation.json, seven).

  • With no limit on the row, the daily excess is zero. A partial excess is first held to the row’s month hours, as the summary holds it, then spread evenly over the row’s days in the month. For a row wholly past its limit, the excess is the whole daily rate, so the row counts zero.

  • total_hours sums every row, and core_hours the core types of the pack’s vocabulary.

  • The job-search partial-week credit is month-level and lands in no week.

So a row held all week with no excess counts exactly its hours_per_week. In a month its weeks tile, the weeks sum to the summary’s countable hours less the credit. The figures are exact, never rounded.

Response (200): Vec<FullWeeksOutcome>, one outcome per entry in request order; a repeated person answers once per entry. Each is tagged on outcome:

  • weeks: person_id and weeks, earliest first. Each week is a FullWeekHours (week_start, total_hours, core_hours). The list is empty when the period holds no full week.

  • work_standard_unrecorded and work_standard_child_unknown: the summary batch’s refusals for the person, with the same fields.

An empty entries answers an empty list. Three refusals fail the whole request:

  • 422 assisted_period_outside_month, when an entry’s period holds no day of the month: assisted_from after it, assisted_through before it, or assisted_through before assisted_from. Every entry is checked before any read.

  • 422 needy_state_undesignated for any person, as on the summary batch.

  • 502 persons_unavailable, as on the summary batch.

Time Limits

GET /v1/time-limits/{person_id}

Federal 60-month time-limit posture (months used, remaining, hardship-extension state). months_used is the clock's opening figure plus the person's months in the ledger of counted months, and last_counted_month the newest of those months (null with none); both are computed on read (ADR-055). A determination denies once months_used reaches federal_limit_months on a clock that is not exempt. A true read: 404 on absence, never creates a row; the clock is unique per person (tanf_time_limits_person_uq) and creation lives on the determine path (which snapshots federal_limit_months from the parameter table, #441).

The clock carries federal_limit_months, kept from its creation. It carries no State limit (#3520): a State's own limit is a value its pack's tanf-eligibility decision reads (Rulesets › TANF decisions), so neither time-limit read returns one.

Access

system; caseworker+; case reader via canopy-web (delegated::TANF_GET_TIME_LIMITS_PERSON_ID)

POST /v1/time-limits:batchGet

Get federal time-limit usage for a set of persons in one round-trip (#1203) — one person_id = ANY($1) set query replacing the ACF-199 extract’s per-adult GET. Capped at 500 IDs per request (422 on overflow); duplicates collapse to one entry; the response follows first-occurrence request order.

Access

system; case reader via canopy-web (delegated::TANF_POST_TIME_LIMITS_BATCH_GET): the worker portal’s Time Limits tab reads its household’s members in one call (#2939). No direct user arm: canopy-cli’s delegation is 403 actor_not_allowed, and interactively the per-person GET above is the user surface.

READ-ONLY: both reads are true reads (since #1330). The batch ships months_used, which the extract reads, and, for a person with a clock on file, the row’s federal_limit_months, exempt, exemption_reason and last_counted_month, which the worker portal’s Time Limits tab shows (#2939). A synthesized entry carries none of them (absent on the wire): it needs no parameter-table value, and no regulatory snapshot is fabricated for a person who has no row.

GET-OR-DEFAULT, exact-set: every requested UNIQUE id gets exactly one entry. on_file: false ⇒ months_used: 0 (the column default a created row would carry) — distinguishable from a real stored zero via on_file, never a fabricated tracking claim. Since #1330 the clock is UNIQUE per person (tanf_time_limits_person_uq), so the batch’s newest-first projection is vacuously deterministic.

Request: BatchGetTimeLimitsRequest

{ "person_ids": ["uuid", "uuid"] }

Response (200): Vec<TimeLimitStatusEntry> — [{ person_id, on_file, months_used, federal_limit_months?, exempt?, exemption_reason?, last_counted_month? }]; the optional fields are present only for an on-file clock (#2939).

Sanctions

GET /v1/tanf/sanctions/rollup

Active-sanction counts across the jurisdiction, one per step of the pack's sanction ladder (Rulesets › TANF sanction steps). Feeds the supervisor dashboard (#496).

Access

system; caseworker+; supervisor view via canopy-web (delegated::TANF_GET_TANF_SANCTIONS_ROLLUP, work_requirement_handlers::sanctions::get_sanctions_rollup) — the supervisor view arm admits canopy-web’s supervisor dashboard (studio_admin beside supervisor)

Response (200): SanctionsRollup — total_sanctioned; by_level, one { level, label, count } per declared step in level order, a step nobody is on included (#3506; before it, three fixed level_N_count fields); undeclared_level_count, the people stored at a level the pack declares no step for; expiring_soon_count (sanctions expiring within [shared.timing].sanction_expiry_lookahead_days of the request’s legal day — the injected decision clock as a date in the pack’s [jurisdiction].timezone, never the database session’s CURRENT_DATE, #2526).

Personal Responsibility

POST /v1/personal-responsibilities/{application_id}

Record a personal-responsibility requirement on an application. requirement_type is a code of the pack's [[tanf.personal_responsibilities]] (Rulesets › TANF personal-responsibility types); any other answers 422 unknown_requirement_type and writes nothing (#3505; before it, a fixed list of five types and a 400). An unknown application is a 404 and writes nothing; the insert requires the application, so it never reaches the foreign key’s 500 (#2250).

Access

system; writer (WRITER) — quality_control is read-only and gets 403 required_role_missing

GET /v1/personal-responsibilities/{application_id}

List the responsibility records on an application.

Access

system; caseworker+ (READER)

PUT /v1/personal-responsibilities/status/{id}

Update a responsibility’s compliance status (pending / compliant / non_compliant / good_cause / exempt). Non-compliant + gating responsibilities drive denial / sanction in determine.

Access

system; writer (WRITER) — quality_control is read-only and gets 403 required_role_missing

POST /v1/time-limits/{person_id}/exclusions

Record months that do not count toward a counter for one person. The job that counts months reads exclusions when it counts, so one is recorded before the month it covers ends; it does not remove a month already counted.

Access

system; writer (WRITER) — quality_control is read-only and gets 403 required_role_missing

Request:

{
  "counter": "federal",
  "first_month": "2026-06-01",
  "last_month": "2026-08-01",
  "reason": "a code the pack declares"
}

Both months are written as their first day and are inclusive. 422 unknown_counter for a counter that is neither federal nor a code of the pack's [[tanf.counters]]; 422 unknown_exclusion_reason for a reason that is not a code of the pack's [[tanf.count_exclusions]] (Rulesets › TANF count exclusions), which is every reason on a pack that declares no table; 422 invalid_month_range when a month is not a first day or last_month is before first_month.

Response (201): the recorded CountExclusion, with recorded_by (the caller's subject) and recorded_at.

GET /v1/time-limits/{person_id}/exclusions

List the exclusions recorded for a person, oldest first.

Access

system; caseworker+ (READER)

POST /v1/tanf/scheduler/run

Count every ended month not yet counted, now, instead of waiting for the daily pass (ADR-055). It runs on the service's clock and takes no body and no date.

Access

system (SYSTEM: canopy-reporting's token, the service's one listed system caller)

Response: 200 { "skipped": false, "months": [{ "month": "2026-06-01", "rows_written": 12 }] }, each month this pass counted, oldest first (empty when every ended month was already counted); 202 { "skipped": true, "months": [] } when another replica is running the job.

Supplemental Payments

Payments a State makes beside the TANF grant. Their types and amounts are the pack's [[tanf.supplemental_payments]] rows (Rulesets › TANF standards and supplemental payments); before #3508 the routes were /v1/grg/payments, with two types and their amounts in code.

POST /v1/supplemental-payments

Record a payment of a type the pack declares.

Access

system; writer (WRITER) — quality_control is read-only and gets 403 required_role_missing

Request:

{
  "payee_person_id": "uuid",
  "on_behalf_of_person_id": "uuid",
  "payment_type": "a code the pack declares",
  "unit_size": 1
}

payment_type is a code of the pack's table; any other answers 422 unknown_payment_type and writes nothing, which is every code on a pack that declares no table. The amount is computed from the row: its flat cents, or its multiple of a named standard read at unit_size (at 1 when the request gives none).

Response (201): the persisted SupplementalPayment row. Its effective_date is the request’s legal day: the service’s injected decision clock (ADR-033 §5) read as a date in the pack’s [jurisdiction].timezone, never the UTC date (#2241).

GET /v1/supplemental-payments/{person_id}

List the supplemental payments issued to a person, latest effective day first.

Access

system; caseworker+ (READER)

FTI Audit Log (IRC §6103(l)(7) / Pub 1075)

ADR-014 hash-chain integrity applies — previous_hash / event_hash columns serialised by pg_advisory_xact_lock(2) with canonical timestamp ordering. Chain breaks emit fti.audit_chain.breach_detected and force 503 from GET /v1/security/chain/status?family=fti&service=canopy-tanf on canopy-security (#1206; a latched legacy v1 breach surfaces there as breached / legacy_breach_latched).

GET /v1/fti-audit-log

List FTI audit entries. IRS auditor access only.

Access

fti_auditor (FTI_AUDITOR, src/api/fti_audit_handlers.rs; a dedicated role admins do NOT hold by default); a system caller is 403 service_class_on_user_only

Query parameters: from, to, accessed_by, purpose_code, action, resource_type, page, page_size (AuditListQuery in fti_audit_handlers.rs).

Paging: page is zero-based and defaults to 0; page_size defaults to 50 and a larger size than 200 reads as 200. Entries come newest first, and entries of one access time by id, highest first, so a walk through the pages meets each entry once. A negative page or page_size, or a page whose first row is past what an offset can express, is 400 invalid_page (FtiAuditPaging in canopy-db). total and the page are read in one snapshot of the log, so an entry written while the list is read is in neither (query_log in canopy-db).

GET /v1/fti-audit-log/{id}

Fetch a single entry (full event payload).

Access

fti_auditor (FTI_AUDITOR), as the list route

GET /v1/fti-audit-log/summary

Aggregated counts by event type + actor over a date range. Used by Pub 1075 §9 quarterly review.

Access

fti_auditor (FTI_AUDITOR), as the list route

Query parameters: from, to (both required; SummaryQuery).

Overpayment Recovery (PAMMS 9000 / 42 USC 609(a)(1); 45 CFR 263.11)

Cross-program shape — the same paths on canopy-snap (/v1/overpayments, whose create screens the claim against SNAP’s claim floors, #2242) and canopy-medicaid (/v1/overpayments), with per-service data isolation per ADR-001. The types, the store and the handlers come from the shared crates/canopy-overpayments crate: services/canopy-tanf/src/api/mod.rs merges canopy_overpayments::api::routes(…) (six operations on five paths) into its routes(), the list admitting by delegated::TANF_GET_OVERPAYMENTS and the other routes by its own READER / WRITER, and the handlers run over canopy-tanf’s own database. Ledger is the system of record; outstanding balance is derived (not stored). Claims auto-open from appeal.overpayment_assessed events (see canopy-appeals).

POST /v1/overpayments

File an overpayment claim. A claim already recorded for the same assessment or source event is the coded 409 unique_violation (#2250).

Access

canopy-reporting’s system token; writer (canopy-tanf’s WRITER, passed as ClaimAdmissions) — quality_control is read-only and gets 403 required_role_missing

Request:

{
  "person_id": "uuid",
  "household_id": "uuid",
  "determination_id": "uuid",
  "claim_amount_cents": 10000,
  "claim_basis": "agency_error",
  "error_type": "income-misreported",
  "discovered_at": "2026-05-01"
}

claim_basis ∈ agency_error / inadvertent_household_error / ipv. claim_amount_cents > 0 (rejected with HTTP 400 otherwise). The body carries no actor: the claim’s discovered_by is principal.actor() — the worker’s canopy subject, or a system caller’s client id — returned as an Actor object, and an unknown field, such as a stale discovered_by, is refused with 422 (#1008).

Response 201: the persisted OverpaymentClaim row (status begins at open).

GET /v1/overpayments[?status=…​&limit=…​&after_created_at=…​&after_id=…​]

One keyset page of claims WITH server-side ledger totals (#1222) — same envelope and semantics as the canopy-snap page (see the SNAP API page); the three services serve the one shared handler.

status ∈ open / in_repayment / closed / written_off.

Access

system; caseworker+; case reader via canopy-reporting (delegated::TANF_GET_OVERPAYMENTS, layered as the crate’s ListAdmission) — canopy-reporting’s onward delegation for its overpayment summary and export

GET /v1/overpayments/{id}

Read a single claim.

Access

canopy-reporting’s system token; caseworker+ (canopy-tanf’s READER, passed as ClaimAdmissions)

POST /v1/overpayments/{id}/repayment-plans

Attach a repayment plan. Rejected with HTTP 409 if the claim is closed or written_off.

Access

system; writer (WRITER) — quality_control is read-only and gets 403 required_role_missing

POST /v1/overpayments/{id}/recoupments

Append a recoupment ledger entry. Same TX semantics as canopy-snap — first non-zero recoupment flips status to in_repayment; reaching outstanding ≤ 0 flips to closed. The same refusals too: an unknown claim is a 404, and a repayment_plan_id that names no plan of this claim the coded 422 repayment_plan_unknown (#2250).

Access

system; writer (WRITER) — quality_control is read-only and gets 403 required_role_missing

GET /v1/overpayments/{id}/ledger

Full ledger view + derived total_recouped_cents + outstanding_cents.

Access

system; caseworker+ (READER)

Verification Discrepancies (#448)

Per-program counterpart to canopy-snap’s ievs_discrepancies. Backs the worker-portal #392 BFF action handler actions_tanf::resolve_discrepancy_tanf. Discrepancies cover income, work-requirement, and asset verification gaps — discriminated by discrepancy_type.

GET /v1/verification/discrepancies

One household’s discrepancies, newest first (discrepancy_handlers::list_discrepancies, #2931): ?household_id= (required) scopes the list, which rides idx_tanf_discrepancies_household. Every resolution state is listed; canopy-web’s resolve form offers the pending ones as its picker, so the worker never types a discrepancy id. A household without discrepancies answers []; a missing or malformed household_id is 400.

Access

system; caseworker+ (READER), the by-id read’s bar: canopy-web reads the list for a writer alone

Response (200): array of TanfDiscrepancy.

GET /v1/verification/discrepancies/{id}

One discrepancy by id (discrepancy_handlers::get_discrepancy, #2543), the TanfDiscrepancy the resolve answers. canopy-web’s resolve action reads it first and refuses a discrepancy whose household_id is not the household the worker acts in, before any write. Unknown id → 404.

Access

system; caseworker+ (READER)

POST /v1/verification/discrepancies/{id}/resolve

Resolve a pending discrepancy. Sets resolution_status + resolution_notes + resolved_by (the worker’s canopy subject from their delegation, or the preserved 'system' sentinel for a system caller) + resolved_at (the request’s instant from the service’s decision clock, #2581). Gated on resolution_status = 'pending' so a second resolve attempt returns 404.

Access

system; writer (WRITER) — canopy-web’s #392 BFF action sends the worker’s delegation; quality_control is 403 required_role_missing

Request: ResolveDiscrepancyRequest. 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",
  "resolution_status": "resolved_corrected",
  "resolution_notes": "Worker verified $1,250/mo with employer call"
}

The household check (discrepancy_handlers::refuse_foreign_discrepancy, #2545) runs after admission and before the write:

  • an unknown id is 404;

  • a discrepancy whose stored household_id is not the body’s is 409 discrepancy_household_mismatch. The detail names the path id and the requested household, never the stored owner. The refusal writes nothing and logs one warn! 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-tanf cannot know which household a worker acts in, so a caller that names the discrepancy’s own household passes. canopy-web binds the discrepancy to the worker’s household before it sends that household (canopy-web API).

Response (200): the updated TanfDiscrepancy row.

Response (409): discrepancy_household_mismatch; or the shared idempotency layer’s conflict (crates/canopy-api/src/idempotency.rs), which the OpenAPI description of this route names too.

Admin replay

The shared canopy-api operator route (crates/canopy-api/src/admin.rs): main.rs merges it from canopy_api::AdminRoutes beside the API routes, behind the same identity receiver, and the handler admits by ADMIN_HUMAN. Replay is per service (ADR-001) — there is no cross-service replay endpoint.

POST /v1/admin/events/replay

Re-offer one or more of this service’s unprocessed event_inbox rows to its own handlers, in process (nothing is published); every requested id is classified in the response.

Access

admin (canopy-api’s ADMIN_HUMAN, crates/canopy-api/src/admin.rs), a delegation through any client; a system caller is 403 service_class_on_user_only

Request: ReplayRequest — { "event_ids": ["uuid", …] }, the envelope ids to look up in this service’s event_inbox.

Response (200): ReplayReport — each requested id in exactly one of replayed, already_processed, missing, failed, unparked (a parked outbox row reset for the drainer), outbox_pending.

Response (403): service_class_on_user_only (a system caller) or required_role_missing (a user without admin).

Error Codes

Code Meaning

400

Invalid input (negative amounts, malformed JSON, etc.); an X-Canopy-Actor header (actor_header_retired)

401

No bearer (token_missing) or a token the receiver refuses (token_rejected)

403

The route’s admission refuses the caller: service_not_allowlisted (a system token the route does not list: any but canopy-reporting’s, and on the family-composition batch also canopy-eligibility’s, #3322), service_class_on_user_only (a system caller on the redaction, the FTI audit reads or the admin replay), system_caller_required (a user asking GET /v1/determinations for month), actor_not_allowed (a user through a client other than canopy-web on work-requirements:batchGet, activities/summary:batchGet, work-standard-basis:batchGet or time-limits:batchGet, #2312, #2939, #3020), required_role_missing (a user without the route’s roles); system_caller_required also answers a user on work-standard:batchGet (#2315), determinations/family-composition:batchGet (#3048) and activities/full-weeks:batchGet (#3193)

404

Person, application, determination, overpayment or discrepancy not found

409

Status transition not allowed (recoupment / repayment-plan against a claim in a terminal closed / written_off state); discrepancy_household_mismatch: a discrepancy resolve whose household_id is not the discrepancy’s (#2545)

422

Semantically-invalid input (e.g., invalid claim_basis enum value); coded (#2193): hours_out_of_range and activity_span_inverted on an activity write, effective_date_out_of_range, custodial_children_required (#3020), custodial_child_is_subject and custodial_child_unknown (#3023) on a work-standard basis write, work_standard_unrecorded, work_standard_child_unknown and needy_state_undesignated on a work-activity summary, and assisted_period_outside_month and needy_state_undesignated on the full-week hours batch (#3193); member_person_id_invalid and parent_child_kind_invalid on a determine (#3048)

502

persons_unavailable: canopy-persons could not resolve the custodial children a work-activity summary, the full-week hours batch (#3193) or the work-standard classification batch (#2193, #2315) or a work-standard basis write (#3023) reads, or the subject's household a work-standard basis write (#3024) or a work-activity log (#3046) reads, or the unit members the family-composition read (#3048) answers for; uncoded on POST /v1/determine when the ruleset’s o-status is missing, unknown or contradicts eligible (#628)

503

FTI hash-chain breach detected — service refuses FTI-bearing writes until reviewed; no trustworthy key set in time (keys_unavailable)

Events Published

tanf.determined, tanf.case_closed and tanf.application_approved are held until the determination is recorded (#2322). api/determination_events.rs stages them after the determination commits, in a transaction of their own, under canopy_mq::hold_for(determination_id); the verdict consumer under Subscribed Events releases them on determination.recorded.tanf or drops them on determination.disowned.tanf (ADR-002 Amendment 7). A verdict can arrive before that transaction commits, so the staging and the consumer serialize on an advisory lock keyed on the determination, and the staging releases or drops its own rows by a verdict already stored in determination_verdicts. A determination canopy-eligibility never records, a direct caller’s included, publishes none of them.

  • tanf.determined (IDs + status + head-of-household recipient person_id + program + the determination output the approval NOA renders — benefit_amount, household_size, effective_date and, since #1996, expiration_date (the certification period’s inclusive last day per #1488, ISO date, null on a denial) — and, since #1955, denial_reason_codes: the signed row’s o-denial-code as a one-element array, null on an approval, a code of the pack's [[tanf.denial_reasons]]; since #3505, denial_reason_texts: the pack's sentence for that code as worded when the determination was made, a one-element array, null on an approval, which the denial NOA prints as carried; and, since #2927, benefit_issued (on an approval, whether a payment is issued; null on a denial) with computed_benefit and minimum_benefit (decimal strings, set only on an approval whose computed benefit is under the minimum issuance, PAMMS 1605, 1390, 1105: the benefit ruleset’s computed benefit, never recomputed, and the pack’s [tanf].minimum_benefit_cents it was evaluated against); the rationale prose denial_reason never rides the bus; no PII or FTI per ADR-004; consumed by canopy-notices to generate the NOA) Since #3521 it also carries certification_open_ended, true only on an approval with no end, whose expiration_date is null; the approval letter then states the start and that there is no end date.

  • determination.redacted (#687) — a data steward crypto-shredded a determination’s snapshot; carries the actor sub + reason, no plaintext

  • tanf.case_closed (consumed by canopy-medicaid for TMA Phase 1, and canopy-snap for TSNAP) — household_id, person_ids, reason, closure_date: the closing determination’s decision instant as a date in the pack’s [jurisdiction].timezone, never the UTC date (#2526)

  • tanf.application_approved (consumed by canopy-medicaid for Express Lane eligibility)

  • tanf.work_requirement_updated — staged by POST /v1/work-requirements/{person_id}/activities in the transaction that logs the activity (events::stage_work_requirement_updated, the typed events::WorkRequirementUpdated). It carries person_id, household_id, status and updated_at only. household_id is the subject's household on the request's legal day, or null when canopy-persons places them in none (3046). No service consumes it; canopy-security's audit subscriber records it, and its household-keyed row is what the case Activity panel lists.

  • tanf.work_standard_basis_recorded (3024) — staged by POST /v1/work-requirements/{person_id}/work-standard-basis in the transaction that inserts the basis (events::stage_work_standard_basis_recorded, the typed events::WorkStandardBasisRecorded), with programs = ["tanf"]. It carries basis_id, person_id, household_id, effective_date, recorded_by and recorded_at. household_id is the subject's household on the recording's legal day, or null when canopy-persons places them in none; recorded_by is the typed principal.actor(). It never carries the custody facts: neither single_custodial_parent nor a child id. Its only consumer is canopy-security's audit subscriber, which records it as (record, work_standard_basis) indexed by basis_id; that household-keyed row is what the case Activity panel lists.

  • fti.audit_chain.breach_detected (Pub 1075 §9 reportable)

  • tanf.overpayment_claimed (#1035) — staged in the same tx as an appeal-opened overpayment claim; routes to the 45 CFR 263.11 demand notice in canopy-notices AND acknowledges the assessment back to canopy-appeals (#1105)

NOTE
The application_id on tanf.determined and tanf.application_approved is the canopy-applications applications.id (the orchestrator-supplied id, same as the signed determination envelope), not the TANF-local tanf_applications.id — the local PK is unresolvable outside canopy-tanf under program isolation (ADR-001). This keeps notices / ELE / cargo xtask seed-verify referential integrity (e.g. canopy-medicaid’s ele_grant_events.source_application_id resolves against canopy_applications.applications.id).

Subscribed Events

  • appeal.overpayment_assessed (filters program == "tanf") — auto-opens an OverpaymentClaim row in this service’s DB. Replaces the prior log-only handler in canopy-enrollment.

  • appeal.overpayment_assessment_voided (#1105, same queue) — voids the claim stamped with the event’s assessment_id via the shared store’s void_for_assessment (canopy_overpayments::store) (idempotent; no-claim is a no-op)

  • canopy-tanf.determination-verdicts ← determination.recorded.tanf, determination.disowned.tanf (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, recorded releases the outbox rows held under canopy_mq::hold_for(determination_id) and disowned deletes them; the verdict is recorded in determination_verdicts, where a recorded verdict 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.

Edit this page · default