canopy-reporting API Reference
Overview
Cross-link: canopy-reporting Data Model (#419)
Assembles federal SNAP/TANF/Medicaid reports from upstream service data. Does not access program databases directly (ADR-001 compliant) — instead queries canopy-persons, canopy-applications, canopy-snap, canopy-enrollment, canopy-renewals, canopy-tanf, canopy-medicaid, and canopy-caps via HTTP. The FOIA / audit bulk exports (/v1/export/* on canopy-security, canopy-persons and canopy-snap) are a separate surface: the data-export runbook.
- Base URL
-
container port 8011 (host:
CANOPY_PORT_CANOPY_REPORTING_8011in.ports.env); every route below is mounted under/v1 - Authentication
-
Bearer token: a canopy-identity token for this receiver (its
audisurn:canopy:service:canopy-reporting), 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
-
no client holds a system edge to canopy-reporting; canopy-web and canopy-cli hold delegation edges. Every route admits a
supervisororadmindelegation through any client (SUPERVISORS,src/api/mod.rs) except the overpayment summary, which admits caseworker+ through any client and supervisor view via canopy-web. canopy-web calls only the summary; canopy-cli reaches the other routes bycanopy report(canopy CLI Reference). 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_reporting
Admission specifics
-
No route has a system arm, so a system caller is 403
service_class_on_user_onlyeverywhere; no handler checks anything beyond its admission. -
Attribution: the audit stream below records
principal.attribution_sub(), the caller’s canopy subject, and the five run-enqueue POSTs record the same subject as the run’srequested_by(src/api/runs_enqueue.rs). -
Onward calls: the overpayment roll-up and summary drain each program’s
GET /v1/overpaymentswith the worker’s onward delegation, which canopy-snap, canopy-tanf and canopy-medicaid admit from canopy-reporting at the case reader bar (delegated::SNAP_GET_OVERPAYMENTSand its TANF and Medicaid twins). The run worker’s calls carry canopy-reporting’s system token (see Upstream Service Clients).
Reporting-Access Audit Stream (#1404, Pub 1075 §9)
Every successful report generation, report/summary read, and CSV
extract on this surface stages one audit envelope through the ADR-018
outbox (ingested by canopy-security’s wildcard subscriber) via a
route-table middleware (src/audit.rs) — a new route cannot land
unclassified: an exhaustiveness test forces every OpenAPI (method, path)
into the audited table or the explicit exclusion list. Vocabulary:
reporting.report.generated (POST generate), reporting.report.accessed
(report/summary reads), reporting.extract.exported (CSV extracts — the
parsed export action also counts toward the seeded Bulk Data Access
rule). Payload carries report_family, accessed_by (the caller’s
canopy subject) and user_role (the first role of the delegation’s sorted
role set); the envelope asserts the family’s #1519 program stamp
(FNS-388/QC → snap, ACF-/WPR → tanf, T-MSIS/CMS- → medicaid; the
cross-program overpayment surfaces assert neutral). Fail-closed: if
staging fails the response is withheld (500) — the disclosure has not
crossed the wire, and a monitoring stream that drops silently is not a
control. Deliberately NOT audited (recorded in UNAUDITED_ROUTES with
the ruling): the run-status poll targets (GET /v1/reporting/runs,
GET /v1/reporting/runs/{id}) — run METADATA, not report content, and
auditing a dashboard poller would trip the 50/10min volume rule on
routine traffic. This is the emitter half of the #1302-seeded "Reporting
Extract Volume" detection rule.
Provisioning the stream is operator work in two places: the outbox INSERT
grant in the 20261129000000 migration, and the broker user’s topic-write
pattern in devstack/rabbitmq/definitions.json. Without the broker grant,
staging still succeeds and events silt in the outbox with ACCESS_REFUSED
retries; the mq-topology lint cannot see these publish sites (#1530).
FNS-388 Monthly Participation Report
POST /v1/reporting/snap/fns-388
Enqueue a durable report run that generates the FNS-388 monthly report for a given month (#1202/#1203 — the run assembles active certifications, issuance totals, household counts, person demographics, and certification types from upstream services off the request path).
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
Request:
{
"report_month": "2026-03-01"
}
Any day of the month is accepted; the period is canonicalized to the month start.
Response (202): ReportRunAccepted — run_id, generation_id, poll_url — plus a Location header pointing at the poll URL. Poll GET /v1/reporting/runs/{id} until done, then read the published report from the GET endpoints below.
Response (409): the target month already has a queued/running run — the body carries THAT run’s ReportRunAccepted handle to poll.
Response (503): report runs disabled (runs_enabled=false, see Report Runs) or the run queue at capacity — retry later.
The old synchronous 201 SnapMonthlyReport body is gone (pre-1.0, no shim); the type remains the GET response below.
Regulatory basis: 7 CFR 272.11 — monthly FNS-388 reporting.
GET /v1/reporting/snap/fns-388
List FNS-388 reports — published generations only; each item carries its generation’s provenance (see "Report provenance" below).
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
GET /v1/reporting/snap/fns-388/{month}
Get the report for a specific month (format: YYYY-MM), from the month’s published generation.
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
Response (200): SnapMonthlyReport, carrying its generation’s provenance. Its generated_by is an Actor (#1008): {"actor_type":"service","service":"canopy-reporting"} for every row the run pipeline writes. No writer records a human author today; the human arm ({"actor_type":"human","subject":…}) appears only on a pre-#1008 row whose UUID author the migration converted to its subject text.
Response (404): no published generation for the month (or no row under it).
FNS-7176 Quality Control Universe
POST /v1/reporting/snap/fns-388/{month}/submission
Advance the month’s FNS-388 submission lifecycle (#1335):
draft → final → submitted → accepted | rejected, with rejected → final
reopening resubmission. Acts on the month’s PUBLISHED generation’s row.
Audited as reporting.report.submission_transitioned.
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
Request: SubmissionTransitionRequest — target_status
(final | submitted | accepted | rejected) and fns_confirmation_number
(required on accepted, rejected with 400 on any other target).
Semantics: submitted stamps submitted_at (each submitted edge —
a resubmission is a new filing, so the stamp reflects the CURRENT
submission) and makes the filing
IMMUTABLE to the #1202 promotion guard — a rerun for the month executes
but its promotion refuses (immutable_target), so a shipped federal
filing is never silently replaced; accepted stores the FNS
confirmation and keeps the block. Transitions are compare-and-set on the
row’s current status: an illegal edge is 409
(invalid_submission_transition), and a concurrent transition racing
this one is 409 (submission_transition_raced — re-read and re-decide).
Response (200): the transitioned SnapMonthlyReport with provenance.
POST /v1/reporting/snap/qc-universe
Enqueue a durable report run that generates the QC universe snapshot for a given date (#1202/#1203).
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
Request:
{
"snapshot_date": "2026-03-31"
}
The QC universe includes all active SNAP cases as of the snapshot date with 24 columns per the FNS-7176 specification.
Response (202): ReportRunAccepted — run_id, generation_id, poll_url — plus a Location header pointing at the poll URL. Poll GET /v1/reporting/runs/{id} until done, then read the published snapshot from the page/CSV endpoints below.
Response (409): the target date already has a queued/running run — the body carries THAT run’s ReportRunAccepted handle to poll.
Response (503): report runs disabled (runs_enabled=false, see Report Runs) or the run queue at capacity — retry later.
The old synchronous 201 QcSnapshotGenerated body is DELETED (pre-1.0, no shim).
Regulatory basis: 7 CFR Part 275 — QC sampling and review.
GET /v1/reporting/snap/qc-universe/{date}
One keyset page of the QC universe for a specific date (format: YYYY-MM-DD), ordered by household_id ascending (#1221; ADR-001 Amendment 1 §B2).
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
Query parameters:
-
limit— page size; defaults to 50, clamped to 200. -
after_household_id— the prior page’snext_cursor.after_household_id; omit for the first page.
Since #1202/#1203 the page reads exclusively from the date’s PUBLISHED generation (staged/superseded/abandoned generations are invisible).
Response (200): SnapQcUniversePage — items (array of SnapQcUniverseEntry), next_cursor ({after_household_id} while a full page may have more, null at the end), total_in_scope (the authoritative generation-scope COUNT(*), populated only on the first page — the §B3 completeness tripwire: a page-looping extractor asserts drained rows equal it), and provenance (see "Report provenance" below).
Response (404): no published QC universe snapshot for the date. (Before #1202/#1203 an unknown date returned a 200 empty page.)
GET /v1/reporting/snap/qc-universe/{date}/csv
Export the QC universe as a CSV file (FNS-7176 column format) — rows of the date’s PUBLISHED generation; row data only, provenance rides the JSON page endpoint. A NULL abawd_household ("unverified legacy") renders as an empty cell.
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
Response (200): CSV file (Content-Type: text/csv), streamed — the header first, then one chunk per keyset page, so peak service memory is O(page) regardless of snapshot size (#1221). Inherent streaming caveat: a database error after the 200 header has gone out truncates the download mid-body rather than producing a 5xx.
Response (404): no published QC universe snapshot for the date. (Before #1202/#1203 an unknown date returned a 200 header-only CSV.)
ACF-199 Monthly TANF Case Snapshots
POST /v1/reporting/tanf/acf-199
Enqueue a durable report run that extracts one ACF-199 case snapshot per assistance unit for the month (#1202/#1203 — the run enriches each case with work-requirement, time-limit, work-activity, and CAPS childcare-funding data off the request path). A household with several approved determinations in the month’s universe, such as a closure and a reopening, gets one row (#3052): from the determination in force on the month’s last day, else the latest-starting one, a tie going to the later effective date and then the later-drained determination. The others are counted in detail_counters as superseded_in_month, beside filtered_not_in_scope (non-approved determinations). The ACF-199 instructions are not in the repository, so the choice is a best-effort reading: the TANF Data Report’s section one is disaggregated data on the families receiving assistance (45 CFR 265.3(b)(1)), one record per family. Each family is typed from W, its work-eligible members (45 CFR 261.2(n)), as canopy-tanf’s family-composition:batchGet answers them for the determination and month (#2975): W empty is child_only; two members of W who are each a parent, of a kind in [tanf.wpr].two_parent_parent_kinds, of the same minor child are two_parent, unless both are minors and neither is the head of household (45 CFR 261.24(c)); anything else is single_parent. The work-requirement, time-limit and work-activity reads ask about W alone, never the roster’s other adults. A determination canopy-tanf holds no assistance unit for (one persisted before #3048) ends the run error with error_code contract_violation, and the worker logs the determination’s id: re-determine it and rerun the month. The work standard of each member of W of a single-parent family is canopy-tanf’s classification from the recorded work-standard basis (#2315); a member it cannot classify ends the run error with error_code policy_input_missing, naming the refusal and the person on the run status. So does a member of W whose work-activity summary canopy-tanf refuses for the work-standard basis the job-search limit reads (#3050). When several refuse in one chunk, the classification’s first refused member is recorded, else the summaries' first refused member, each in universe order.
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
Request:
{
"report_month": "2026-03-01"
}
Any day of the month is accepted; the period is canonicalized to the month start.
Response (202): ReportRunAccepted — run_id, generation_id, poll_url — plus a Location header pointing at the poll URL. Poll GET /v1/reporting/runs/{id} until done, then read the published snapshots from the list/CSV endpoints below.
Response (409): the target month already has a queued/running run — the body carries THAT run’s ReportRunAccepted handle to poll.
Response (503): report runs disabled (runs_enabled=false, see Report Runs) or the run queue at capacity — retry later.
The old synchronous 201 Acf199Generated body is DELETED (pre-1.0, no shim).
Regulatory basis: 45 CFR Part 265 — TANF data collection and reporting.
GET /v1/reporting/tanf/acf-199
List ACF-199 case snapshots from a PUBLISHED generation (#1202/#1203 — staged/superseded/abandoned generations are invisible).
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
Query parameters:
-
month(optional,YYYY-MM) — the report month. Omitted = the latest published generation. Bad format → 400. -
limit(optional) — page size; default 50, clamped to 200. -
after_report_month+after_case_id(optional, together) — the keyset cursor fromnext_cursor(#1334). Half-supplied cursor pair → 400 (a silently-restarted walk would look complete to a page-looping extractor).
Each snapshot carries the family’s hours as an average week (average_weekly_total_hours, average_weekly_core_hours, summed over W and truncated to 0.01) and assisted_whole_month, whether the determination’s coverage window spans the month (#2316). A row extracted before #2316 holds null in all three. Since #2975 it also carries work_eligible_count, the size of W, and adults, one TanfAcf199SnapshotAdult per member of W in person-id order: person_id, the member’s own average_weekly_total_hours and average_weekly_core_hours, and young_child_standard, whether the member is held to the 42 USC 607(c)(2)(B) young-child standard. The family-level young_child field is gone. A row extracted before #2975 holds null in work_eligible_count and an empty adults.
Response (200): TanfAcf199SnapshotPage (#1334 — replaces the bare 100-row list) — items ordered by (report_month, case_id), next_cursor (null at the end), total_in_scope (first page only — the ADR-001 Amendment 1 §B3 completeness tripwire), and provenance (see "Report provenance" below).
Response (404): no published ACF-199 generation for the requested month — or, with month omitted, none published at all.
GET /v1/reporting/tanf/acf-199/csv
Export the resolved published generation’s ACF-199 snapshots as CSV. Same month query parameter and latest-published fallback as the list; row data only — provenance rides the JSON list endpoint. The columns follow TanfAcf199Snapshot, with average_weekly_total_hours, average_weekly_core_hours and assisted_whole_month in place of the monthly hour columns (#2316), and work_eligible_count in place of young_child (#2975); a NULL renders as an empty cell. The CSV keeps one row per family: the per-adult rows ride the JSON list only. Page-walks the FULL generation (#1334 — the previous 100-row bound silently truncated larger months).
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
Response (200): CSV file (Content-Type: text/csv).
Response (404): no published ACF-199 generation for the month (or at all).
ACF-196 Quarterly TANF Financial Report
POST /v1/reporting/tanf/acf-196
Generate the ACF-196 quarterly stub — synchronous (local-DB aggregation over published ACF-199 generations, sub-second). Expenditure columns are zero pending real state-accounting wiring (partner-blocked).
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
Request: GenerateTanfQuarterlyRequest — fiscal_year, fiscal_quarter (federal fiscal year; Q1 = Oct–Dec of the prior calendar year).
Response (201): Acf196Generated — fiscal_year, fiscal_quarter, categories_generated, status. Since #1202/#1203 categories_generated is rows_affected()-honest: a rerun whose rows already exist reports 0, never a fabricated total.
Response (422): the fiscal quarter’s three months lack PUBLISHED ACF-199 generations (the plan-D2 published-input guard; the refusal names the missing months) — or an invalid fiscal_quarter (expected 1-4; previously a 500).
Regulatory basis: 45 CFR Part 265 — ACF-196 TANF financial report.
TANF Work Participation Rate (WPR)
POST /v1/reporting/tanf/wpr
Calculate the monthly all-family + two-parent Work Participation Rates from the month’s published ACF-199 generation — synchronous.
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
Request: GenerateTanfReportRequest — report_month. Any day of the month is accepted; the period is canonicalized to the month start.
Response (201): WprCalculated — report_month (normalized), all_family_rate, two_parent_rate, all_family_meets_target, two_parent_meets_target.
Denominators: the all-family rate counts every family except child-only families, and the two-parent rate counts the two-parent families, each family typed from its work-eligible members (see POST /v1/reporting/tanf/acf-199, #2975). No family is disregarded for an exemption: an exempt family stays in every denominator its family type belongs to, and in the numerator when it meets the hours (#2246). The jurisdiction’s work-requirements ruleset evaluates the optional 42 USC 607(b)(5) / 45 CFR 261.22(c)(2) infant disregard and the 45 CFR 261.24(a)(2) disabled-parent exclusion from the two-parent rate. The report does not apply either until the ruleset’s outputs reach the ACF-199 snapshot (#2974).
Numerators (#2316, #3195): each compares hours with a weekly standard bound from [tanf] / [tanf.wpr]. A family assisted the whole month (assisted_whole_month) is judged on its average weekly hours (average_weekly_total_hours, average_weekly_core_hours). A family assisted for part of the month is judged week by week (45 CFR 261.22(d)(1), 261.24(d)(1)): it meets the standard in each of its full_week_count full weeks, from the tanf_acf199_snapshot_adult_weeks rows. A week missing a member's row fails. A partial month with no full week counts in no numerator, since no week was observed to stand for the month; it stays in both denominators.
-
All-family, single-parent family: the family counts when one member of W meets their own standard on their own
tanf_acf199_snapshot_adultsrow (maintainer ruling, 2026-10-27; 42 USC 607(b)(1)(B)(i), 45 CFR 261.31(a); #2975): 30 total with 20 core (261.31), or 20 with 20 for a member held to the young-child standard (42 USC 607(c)(2)(B), #1771) — one canopy-tanf classifies, from the work-standard basis in force on the month’s last day, as a single custodial parent or sole caretaker relative of a child under six (#2315). The members' hours are never summed for this test. A row extracted before #2975 has no member rows and counts in no numerator until its month is rerun. -
Two-parent, in both rates: 35 combined with 30 core (261.32(a)), or 55 with 50 core when
childcare_funded(261.32(e), #1169), on the family’s summed figures. The core floors bind fromtwo_parent_core_hoursandtwo_parent_childcare_core_hours. -
A family assisted for part of the month, single-parent: one member of W meets their own standard in every full week. Two-parent: in every full week, every member of W has a row and their combined hours meet the family's standard. The assisted period starts on the determination's
effective_datewhen[tanf.wpr].count_retroactive_assistance_periodelects the 45 CFR 261.22(d)(2) retroactive period, and otherwise on the legal day it was decided, if later (#3194).
Response (422): the report month has no PUBLISHED ACF-199 generation (the plan-D2 published-input guard; names the missing month).
Regulatory basis: 42 USC 607(a)-(b), (c)(2)(B); 45 CFR 261.2(n) / 261.21 / 261.22(d) / 261.24(c) / 261.31 / 261.32(a), (e) / 261.35 (261.21 and 261.35 removed and reserved by 91 FR 48268 eff. 2026-09-29).
T-MSIS Eligibility Extract
POST /v1/reporting/medicaid/tmsis
Enqueue a durable report run that extracts one T-MSIS eligibility row per approved Medicaid determination for the month, with each class's T-MSIS eligibility group, FPL computation, and citizenship enrichment off the request path (#1202/#1203).
The eligibility group is the tmsis_group of the determination's class in the pack's [[medicaid.classes]] (Rulesets › Medicaid and CHIP classes, #3421). canopy-reporting loads the class catalogue at boot and refuses to start when it does not load. An approved determination whose class states outside_tmsis_reason, whose class the pack does not declare, or that records no class, files no row: it is counted processed and filtered_not_in_scope, as a non-approved determination is.
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
Request:
{
"report_month": "2026-03-01"
}
Any day of the month is accepted; the period is canonicalized to the month start.
Response (202): ReportRunAccepted — run_id, generation_id, poll_url — plus a Location header pointing at the poll URL.
Response (409): the target month already has a queued/running run — the body carries THAT run’s handle.
Response (503): report runs disabled or the run queue at capacity.
The old synchronous 201 TmsisGenerated body is DELETED (pre-1.0, no shim). Dropped/degraded rows are counted, never silent: orphan households are excluded and counted skipped_orphan; missing person facts ship citizenship_status = "unknown" (counted citizenship_degraded) and an honest NULL FPL (counted fpl_not_computable) — all visible in provenance and the run’s detail_counters.
Regulatory basis: 42 CFR Part 431 — T-MSIS state data submission.
GET /v1/reporting/medicaid/tmsis
List T-MSIS eligibility extracts from a PUBLISHED generation.
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
Query parameters:
-
month(optional,YYYY-MM) — the report month. Omitted = the latest published generation. Bad format → 400. -
limit(optional) — page size; default 50, clamped to 200. -
after_report_month+after_enrollment_id(optional, together) — the keyset cursor fromnext_cursor(#1334). Half-supplied cursor pair → 400 (a silently-restarted walk would look complete to a page-looping extractor).
Response (200): MedicaidTmsisExtractPage (#1334 — replaces the bare 100-row list; the wire sort changed from person_id to (report_month, enrollment_id), the generation’s total order) — items, next_cursor, total_in_scope (first page only), provenance.
Response (404): no published T-MSIS generation for the requested month (or at all).
GET /v1/reporting/medicaid/tmsis/csv
Export the resolved published generation’s T-MSIS extract as CSV. Same month parameter and latest-published fallback; row data only — provenance rides the JSON list endpoint. Streams the FULL generation as one RFC 4180 chunk per keyset page (#1454 removed the silent 100-row truncation; #1455 added real CSV quoting — embedded commas/quotes/newlines no longer corrupt rows). The JSON list endpoint pages on the same keyset since #1334.
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
Response (200): CSV file (Content-Type: text/csv), streamed. A database error after the 200 header truncates the download mid-stream (inherent streaming caveat, same as the FNS-7176 export) — it cannot become a 5xx.
Response (404): no published T-MSIS generation for the month (or at all).
CMS-64 Quarterly Expenditure Report
POST /v1/reporting/medicaid/cms-64
Aggregate CMS-64 enrollment counts + member-months from the quarter’s published T-MSIS generations — synchronous. Expenditure columns are NULL pending MMIS wiring (partner-blocked).
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
Request: GenerateMedicaidQuarterlyRequest — fiscal_year, fiscal_quarter.
Response (201): Cms64Generated — fiscal_year, fiscal_quarter, coverage_groups, status. Since #1202/#1203 coverage_groups is rows_affected()-honest: a rerun reports 0, never a fabricated total.
Response (422): the fiscal quarter’s three months lack PUBLISHED T-MSIS generations (names the missing months) — or an invalid fiscal_quarter (expected 1-4; previously a 500).
Regulatory basis: 42 CFR Part 430 — CMS-64 quarterly expense report.
CMS-416 Annual EPSDT Report
POST /v1/reporting/medicaid/cms-416
Enqueue a durable report run that builds the annual EPSDT age-band report for a report year (#1202/#1203).
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
Request:
{
"report_year": 2026
}
Response (202): ReportRunAccepted + Location header. Input pinning: at enqueue the twelve months' published T-MSIS generation_ids are recorded in the new generation’s input_generation_ids; the universe drain filters generation_id = ANY(pinned), and the worker re-verifies the pins at every claim — a pin superseded/abandoned since enqueue finalizes the run error/stale_pins. CMS-416 is fully pinned and reproducible against published T-MSIS generations.
Response (409): the target year already has a queued/running run — the body carries THAT run’s handle.
Response (422): one or more months of the report year lack a PUBLISHED T-MSIS generation — the refusal names the missing months; generate + publish them first. (Also: a report year out of range.)
Response (503): report runs disabled or the run queue at capacity.
The old synchronous 201 Cms416Generated body is DELETED (pre-1.0, no shim).
Regulatory basis: 42 CFR 441.62 / SSA §1902(a)(43) — annual EPSDT participation report.
GET /v1/reporting/medicaid/cms-416
List CMS-416 age-band rows from a PUBLISHED generation.
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
Query parameters:
-
year(optional, integer) — the report year. Omitted = the latest published generation. Out-of-range year → 400. -
limit(optional) — page size; default 50, clamped to 200. -
after_report_year+after_age_group(optional, together) — the keyset cursor fromnext_cursor(#1334). Half-supplied cursor pair → 400 (a silently-restarted walk would look complete to a page-looping extractor).
Response (200): MedicaidCms416ReportPage (#1334) — items ordered by (report_year, age_group), next_cursor, total_in_scope (first page only), provenance. One generation holds at most the configured band set, so a single page is typical.
Response (404): no published CMS-416 generation for the requested year (or at all).
Cross-Program Overpayment Recovery Roll-Up
GET /v1/reporting/overpayments
Generate a CSV roll-up of overpayment claims + recoupment totals for one program (PAMMS 9000 / 7 CFR 273.18).
- Access
-
supervisororadmin(SUPERVISORS,src/api/mod.rs)
Query parameters:
-
program(required) —snap/tanf/medicaid. -
status(optional) —open/in_repayment/closed/written_off. Omitted = no filter.
Behaviour: per ADR-001, canopy-reporting cannot read program-service DBs directly. Since #1222 the roll-up drains the target program service’s keyset GET /v1/overpayments page-by-page, with the supervisor’s onward delegation, to exhaustion — each row already carries its server-side total_recouped_cents + outstanding_cents, so there are NO per-claim ledger calls (the old serial N+1 crossed gateway timeouts at ~3K claims) — and asserts the pulled count against total_in_scope (the §B3 completeness tripwire; a truncated universe fails the run). The supervisor-dashboard summary rides the same drain. Caseworker-supplied error_type is properly CSV-quoted (commas, embedded quotes, newlines all handled).
Response (200): CSV file (Content-Type: text/csv), 12 columns:
claim_id,person_id,household_id,determination_id,claim_amount_cents,
recouped_cents,outstanding_cents,status,claim_basis,error_type,
discovered_at,closed_at
Response (400): Unknown program.
GET /v1/reporting/overpayments/summary
Aggregated overpayment summary across all programs for the supervisor-dashboard overpayment-rollup panel (#496).
- Access
-
caseworker+; supervisor view via canopy-web (
delegated::REPORTING_GET_REPORTING_OVERPAYMENTS_SUMMARY) — canopy-web’s supervisor dashboard panel calls it; nocanopy reportcommand does
Behaviour: per ADR-001, canopy-reporting cannot read program-service DBs directly. It runs the roll-up’s keyset drain of GET /v1/overpayments on canopy-snap, canopy-tanf and canopy-medicaid with the worker’s onward delegation, then aggregates the rows' server-side totals in memory (no per-claim row data).
Response (200): OverpaymentsSummary — total_open_claims, total_closed_claims, total_outstanding_cents, total_recouped_cents, plus by_program array of ProgramOverpaymentTotals (per-program open_claims, closed_claims, outstanding_cents, recouped_cents).
Report Runs (#1202/#1203)
Durable report-run status surface (the archived
report-run-generations plan).
Five generate POSTs enqueue and answer 202
ReportRunAccepted{run_id, generation_id, poll_url} — FNS-388, the QC
universe, ACF-199, T-MSIS and CMS-416; ACF-196, WPR and CMS-64 stay
synchronous local aggregations and answer 201. Runs are switched by
runs_enabled on ReportingConfig (env CANOPY_REPORTINGRUNS_ENABLED,
default true; false parks the worker AND makes every enqueue answer
503), and terminal run rows reap after run_reap_days
(CANOPY_REPORTINGRUN_REAP_DAYS, default 7, bounded 7..=90).
Operational guide: the report-runs runbook.
- Access (both endpoints)
-
supervisororadmin(SUPERVISORS,src/api/runs.rs). Runs are org-visible (a deliberate deviation from the #1205 chain-job requester-scoping: a hidden colleague run would make the 409 handles un-pollable).
GET /v1/reporting/runs/{id}
Poll one run by the id from the 202/409 enqueue handle.
Response (200): ReportRunStatus — run_id, generation_id,
report_kind (fns_388 | qc_7176 | acf_199 | tmsis | cms_416),
period_date, state (queued | running | done | error), attempts,
universe_total, processed_count, skipped_orphan_count,
degraded_count, detail_counters (named counts from the GENERATION row
— never decoded from run progress, so a malformed progress blob can never
500 a poll), error_code
(upstream_unavailable | universe_drift | contract_violation | stale_pins
| crashed | immutable_target | crypto_failure | admin_reset
| policy_input_missing), error_reason and error_person_id,
abandon_reason, requested_at,
finished_at, and result_url (set once done, pointing at the kind’s
read endpoint above). universe_drift means the materialized universe is
inconsistent: a checkpoint restated a different universe_total, or a QC
universe repeats a household. The drain pages the live due list, so a
supersession between pages can do that. A repeated household ends the run
when its chunk is staged, without retrying (#2683).
policy_input_missing (#2315) means a policy input the run needs is not
recorded: error_reason names the refusal (work_standard_unrecorded or
work_standard_child_unknown) and error_person_id the person. Both are
set exactly then. The refusal comes from canopy-tanf’s work-standard
classification for the report month (#2315), or from its work-activity
summary, for any month the person’s job-search limit reads (#3050). Record the person’s work-standard basis on canopy-tanf
and enqueue the month again.
Queued/running responses carry a Retry-After header (one worker tick,
whole seconds).
Response (404): unknown id — or an already-reaped terminal run
(indistinguishable by design; terminal run rows reap after
run_reap_days, provenance survives on the permanent generation row).
Report provenance
Since #1202/#1203 every
generation-scoped read body — FNS-388 get/list, the QC universe page, the
ACF-199 / T-MSIS / CMS-416 lists — carries a typed provenance object
from the resolved published report_generations row:
RunProvenance{generation_id, run_id, state, universe_total,
processed_count, skipped_orphan_count, degraded_count, extracted_at,
as_of}. run_id is null for the pre-pipeline legacy backfill
generations; state is always published on a read (readers never serve
any other state); extracted_at is the honesty stamp for the
as-of-extraction enrichment legs (see Known limitations); as_of is the
persons valid-time pin the run read under. Provenance survives run
reaping — it lives on the permanent generation row. The CSVs (QC,
ACF-199, T-MSIS) are row-data-only; provenance rides each kind’s JSON
page/list endpoint.
Known limitations
As-of-extraction enrichment. Run universes are reproducible (phase 1
materializes the universe into report_run_universe; the persons
enrichment is pinned at provenance.as_of), but these enrichment legs have
no valid-time corpus and are read as-of-extraction — re-running the
same period after upstream edits can legitimately change them, and
provenance.extracted_at records the read time:
-
applications (application dates and status)
-
enrollment issuance
-
SNAP ABAWD tracking (#1331 tracks its valid-time corpus)
-
TANF work-requirement / time-limit / work-activity
-
CAPS childcare authorization
CMS-416 has no as-of-extraction leg: its inputs are the T-MSIS generation ids pinned at enqueue.
Federal-field dispositions (#1333). Every formerly-silent approximation
carries an explicit disposition — sourced (T-MSIS coverage dates and
restricted_benefits_indicator from the determination; CMS-416
total_member_months and CMS-64 member_months from the pinned T-MSIS
generations as DISTINCT (person, report_month), #1585), NULL-as-unknown
(ACF-199 months_other_states, closure_reason; a CMS-416 member-month
figure that is honestly unavailable) or documented (CMS-416
eligible_for_screening = total_enrolled_children under 42 CFR 441.56;
T-MSIS managed_care_enrolled stays false — no MCO/MMIS source). The
reasoning per field is in the archived
report-run-generations plan.
Error Codes
| Code | Meaning |
|---|---|
400 |
An |
401 |
No bearer ( |
403 |
The route’s admission refuses the caller: |
404 |
Report, snapshot, or run not found — for the generation-scoped reads: no PUBLISHED generation for the period, or none at all under the latest-published fallback (a reaped run is an indistinguishable 404) |
409 |
The target period already has a queued/running run — the body carries that run’s |
422 |
Unknown |
500 |
Upstream service failure during the synchronous overpayments roll-up / summary assembly — the only handlers that still call upstream services on the request path; the body is redacted ( |
503 |
The receiver holds no trustworthy key set in time ( |
Upstream Service Clients
canopy-reporting queries these services over HTTP, each at the base URL its environment variable names. The run worker’s calls are system-origin: they carry canopy-reporting’s system token from its IdentitySender, along its system edges to all eight. The overpayment roll-up and summary, the only request-path calls, carry the request’s outbound (RequestOutbound): the worker’s onward delegation to canopy-snap, canopy-tanf and canopy-medicaid. A 401 drops the target’s cached token and sends once more, around the transient retry (canopy_api::retry); a second 401, or a 403, is an Auth failure, which abandons a run. Identity settings are the baseline IDENTITY_ISSUER / IDENTITY_INTERNAL_URL (configuration reference) and the client key CANOPY_REPORTING__IDENTITY_CLIENT_PRIVATE_KEY.
| Service | Env Var | Data Retrieved |
|---|---|---|
canopy-persons |
|
Household demographics |
canopy-applications |
|
Application dates and status |
canopy-snap |
|
ABAWD tracking data |
canopy-enrollment |
|
Benefit issuance records |
canopy-renewals |
|
Certification periods |
canopy-tanf |
|
TANF determinations, family compositions (#2975), work requirements, time limits, work-activity summaries, work-standard classifications (ACF-199) |
canopy-medicaid |
|
Medicaid determinations, each reported under its class's T-MSIS eligibility group (T-MSIS) |
canopy-caps |
|
Active childcare authorizations — the WPR two-parent 55-hour standard discriminator (#1169) |