canopy-persons API Reference

For a service integrator: canopy-persons is the central person and household store; every program service references persons by id rather than duplicating demographics, and every fact (income, asset, expense, address, membership, parent–child, pregnancy) is a valid-time-versioned, attributed claim (ADR-027). Data stewards use the redaction, export and orphan-compensation routes. Tables and the version corpus: the data-models page; design history: persons-household-model, batch expansion, the finalize saga.

Base URL

container port 8002 (host: CANOPY_PORT_CANOPY_PERSONS_8002 in .ports.env)

Authentication

Bearer token: a canopy-identity token for this receiver (its aud is urn:canopy:service:canopy-persons), 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-applications, canopy-eligibility, canopy-medicaid, canopy-notices, canopy-renewals, canopy-reporting, canopy-snap, canopy-tanf and canopy-verification hold system edges to canopy-persons, and the portal one for GET /v1/persons/{id}. Every data-plane route admits a system caller, and its listed delegations: writes the writer bar through canopy-web and canopy-cli (a household create and the person delete through canopy-cli only), reads canopy-web’s and canopy-cli’s readers and the onward delegations of canopy-eligibility, canopy-verification, canopy-snap and canopy-applications where listed; the redact, export and orphan-compensation routes are user-only; the finalize surface admits canopy-applications' system token alone. A refusal is 403 with its ReceiverDenial code (ADR-049 Amendment 14); each route’s constant is in the authorization inventory.

Database

canopy_persons

Valid-time reads: the as_of default

Every route that takes an as_of query parameter, and every read that resolves one internally (person get / list / update, household get, the fact lists, persons:batchGet without as_of, the export, the finalize replay re-reads), resolves an omitted, empty or now value to the jurisdiction’s legal day: the current date in [jurisdiction].timezone from the deployment’s jurisdiction.toml, loaded at boot through its configuration layers (CANOPY_CONFIG_SOURCE, Configuration Reference › Configuration source) and carried as the LegalTimezone router extension (services/canopy-persons/src/params.rs). A missing or non-IANA value fails startup; there is no UTC fallback. The reason: a UTC date is already tomorrow from about 7 pm Eastern, so a UTC default read a claim opened today as not-yet-valid for the last hours of every legal day.

Admission specifics

  • Ownership. GET /v1/persons/{id}/core requires the portal’s X-Canopy-Applicant claim to bind the session’s own submitting person (require_owned_person): 403 ownership_claim_missing / ownership_mismatch.

  • Authors (ADR-049 Amendment 15). A user’s claim or close is authored by the user — {"author_type":"worker","sub":<its subject>} — whatever the body’s author or the close’s author_sub names; a system caller’s claim keeps its body author (never System, 422) and its close the author_sub (422 when not a subject or naming the calling client) (claim_author / close_author, services/canopy-persons/src/api/authors.rs).

  • SSN projection. POST /v1/persons:batchGet with person_ssn projected is a system caller’s alone; a delegation asking for it is 403 (require_ssn_projection).

  • Finalize tag. A finalize-tagged write takes canopy-applications' system token alone; another client’s, or a delegation through canopy-applications, is 403 (require_finalize_caller, src/finalize.rs).

  • Idempotency-Key (#2707). A create a retry would duplicate needs a key: POST /v1/persons, and a member, homelessness, income, asset, expense, address or pregnancy claim or an income proposal that names no fact (a new fact), sent with neither an Idempotency-Key nor the finalize tag, is 400 idempotency_key_required before any write (refuse_unguarded_create, src/finalize.rs). canopy-api’s idempotency layer replays a keyed retry, and the finalize receipt replays a tagged one. A correction names its fact, so it stays keyless. POST /v1/households does not require a key.

  • Attribution. The redact events' author is the steward’s subject; ssn.accessed's actor_sub and the export audit’s actor are principal.attribution_sub() — the user’s canopy subject, or a system caller’s client id. The canopy-cli crypto-shred commands send as the operator’s canopy-cli session, so the steward is the logged-in user.

Finalize header tag (ADR-038)

The person / household / member / income / asset / expense / address create and claim routes accept an optional tag in request headers — X-Canopy-Finalize-Operation (the operation id, a UUID), X-Canopy-Finalize-Generation (integer ≥ 1) and X-Canopy-Finalize-Step (the caller’s opaque receipt key, e.g. person:0) — all three present or all absent. The canopy-applications finalize saga uses it to make each write idempotent and recoverable (ADR-038). In the write’s own transaction the handler gates the (operation_id, generation) FOR SHARE (absent or cancelled → 409), claims a receipt on (operation_id, generation, step_key), and either proceeds — staging its outbox events held until the operation releases them — or, on a replay, returns the stored entity writing nothing. A tagged write from any caller but canopy-applications' system token is 403; a partial or malformed tag is 400. The tag is deliberately absent from the OpenAPI schema (an internal applications↔persons contract, gated by that caller check — auditable here, not a hidden control).

Routes

Mounted by routes() in services/canopy-persons/src/api/mod.rs; spelling from crates/canopy-contracts-persons/src/paths.rs (its legacy ADD_/UPDATE_/DELETE_{INCOME,ASSET,EXPENSE} constants are not mounted — writes go through /claims).

Route Access Success Refusals

POST /v1/persons

system; writer via canopy-web, canopy-cli

201 Person

400 validation, idempotency_key_required

GET /v1/persons?search=&projection=

system; worker reader via canopy-web, canopy-cli

200 page: each SSN opened and audited only for a projection of person_ssn; none with no projection or an empty one (#2705, #2986)

400 search under 2 chars, or a projection naming a fact group

GET /v1/persons/{id}

system; case reader via canopy-web, canopy-cli

200 Person

404

GET /v1/persons/{id}/core

portal (portal:persons:read) + ownership

200 Person, the SSN never opened and no ssn.accessed staged (#2706)

403 another person, or any caller but the portal; 404

PUT /v1/persons/{id}

system; writer via canopy-web, canopy-cli

200 Person, the core with the SSN never opened and no ssn.accessed (#2705)

404

DELETE /v1/persons/{id}

system; supervisor or admin via canopy-cli

204 (soft delete; no event)

404

POST /v1/households

system; writer via canopy-cli

201 Household

400

GET /v1/households/{id}?as_of=

system; worker reader via canopy-web, canopy-cli, canopy-eligibility, canopy-verification

200 HouseholdWithMembers

400 malformed as_of; 404

GET /v1/households/{id}/full?as_of=&projection=

system; case reader via canopy-web, canopy-cli, canopy-eligibility, canopy-snap

200 HouseholdFull: every fact group with no projection; exactly the listed groups with one; the SSN opened and audited only for person_ssn (#2705, #2986)

400 bad as_of or an unknown group; 404

POST /v1/persons:batchGet

system; worker reader via canopy-web, canopy-applications (person_ssn: system only)

200 [MemberFull]; inactive persons skipped unless include_inactive (#2705)

422 over 500 ids, or the household homelessness group (#3144)

POST /v1/households:batchGet

system; worker reader via canopy-web, canopy-applications, canopy-verification

200 [HouseholdMembershipSlim]

422 over 500 ids

POST /v1/households/{id}/members/claims

system; writer via canopy-web, canopy-cli

201 ClaimResponse

400 idempotency_key_required (no fact_id, no key); 404 foreign fact_id; 409 exclusion_violation overlap; 422 System author / person reassignment; 422 foreign_key_violation unknown person or household

DELETE /v1/households/{id}/members/claims/{fact_id}?author_sub=&as_of=

system; writer via canopy-web, canopy-cli

204

400 missing author_sub; 404; 422 an author_sub that is not a valid OIDC subject, or one naming the calling service

POST /v1/households/{id}/homelessness (#3144)

system; writer via canopy-web, canopy-cli

201 ClaimResponse

400 idempotency_key_required (no fact_id, no key); 404 a fact_id of another household; 409 exclusion_violation overlap for the household; 422 System author; 422 check_violation a window that ends on or before it starts; 422 foreign_key_violation unknown household

DELETE /v1/households/{id}/homelessness/{fact_id}?end_date=&author_sub= (#3144)

system; writer via canopy-web, canopy-cli

200 HomelessnessCloseResponse

400 missing or malformed end_date, missing author_sub; 404 a period of another household; 422 an author_sub that is not a valid OIDC subject, or one naming the calling service

POST /v1/persons/{id}/parents/claims ({id} the child)

system; writer via canopy-web

201 ClaimResponse

400 idempotency_key_required (no fact_id, no key); 404 a fact_id of another child; 409 exclusion_violation overlap for the pair; 422 System author, a parent who is the child, or a correction naming another parent; 422 foreign_key_violation unknown person

DELETE /v1/persons/{id}/parents/claims/{fact_id}?author_sub=&as_of=

system; writer via canopy-web

204

400 missing author_sub; 404 a fact of another child; 422 an author_sub that is not a valid OIDC subject, or one naming the calling service

POST /v1/persons/{id}/pregnancies

system; writer via canopy-web, canopy-cli

201 Pregnancy

400 validation (a fetus count outside 1 to 8), idempotency_key_required (no fact_id, no key); 404 foreign fact_id; 409 exclusion_violation, another pregnancy of the person overlapping; 422 System author; 422 foreign_key_violation unknown person; 422 check_violation a window ending on or before it starts

DELETE /v1/pregnancies/{fact_id}?end_date=&author_sub=

system; writer via canopy-web, canopy-cli

200 PregnancyCloseResponse

400 missing or malformed end_date, missing author_sub; 404 unknown fact; 422 an author_sub that is not a valid OIDC subject, or one naming the calling service

GET /v1/persons/{id}/income

system; worker reader via canopy-web, canopy-cli

200 [Fact]

404

GET /v1/persons/{id}/assets, …/expenses

system; caseworker+ via canopy-cli

200 [Fact]

404

GET /v1/persons/{id}/addresses

system; case reader via canopy-web

200 [Fact]

404

POST /v1/persons/{id}/income/claims, …/assets/claims, …/expenses/claims, …/addresses/claims

system; writer via canopy-web, canopy-cli

201 ClaimResponse

400 idempotency_key_required (no fact_id, no key); 404 foreign fact_id; 409 exclusion_violation overlap; 422 System author / negative amount / an income amount, asset value or expense amount past 99,999,999.99 (fact_amount_out_of_range) / an IEVS income claim, which is proposed instead (verified_income_is_proposed, #2546)

POST /v1/persons/{id}/income/proposals

system; writer via canopy-web, canopy-cli

201 IncomeProposalResponse

400, idempotency_key_required (no fact_id, no key); 404 foreign fact_id; 422 a system caller (no worker to hold the proposal) / negative amount / past 99,999,999.99 (fact_amount_out_of_range)

GET /v1/persons/{id}/income/proposals?discrepancy_id=

system; worker reader via canopy-web, canopy-cli

200 [IncomeProposal]

400 missing or malformed discrepancy_id

DELETE /v1/persons/{id}/income/claims/{fact_id}?author_sub=&as_of=, …/addresses/claims/{fact_id}

system; writer via canopy-web, canopy-cli

204

400 missing author_sub; 404; 422 an author_sub that is not a valid OIDC subject, or one naming the calling service

GET /v1/export/persons

admin or quality_control

200 CSV / JSON

400 window / mode; 422 unknown slug

POST /v1/persons/{id}/facts/{kind}/{fact_id}/redact

data_steward

200 { fact_id, kind, redacted_at }

400 blank reason; 404 unknown kind / foreign fact

POST /v1/persons/{id}/redact-ssn

data_steward

200 { person_id, redacted_at }

400 blank reason; 404

POST /v1/internal/finalize-operations/{op}/{gen}/register

system: canopy-applications

200 RegisterResponse

400 non-positive generation; 403 other service

POST /v1/internal/finalize-operations/{op}/{gen}/release

system: canopy-applications

200 ReleaseResponse

400; 403

POST /v1/internal/finalize-operations/{op}/{gen}/cancel

system: canopy-applications

200 CancelResponse

400; 403

GET /v1/internal/finalize-operations/{op}

system: canopy-applications

200 FinalizeOperationView

403

Access legend: system = any system caller but the portal; system: canopy-applications = only that client’s system token; portal (<scope>) = the portal’s system token holding that scope; + ownership = the claim check above; writer = a user’s delegation holding a CASEWORKER_WRITER_ROLES role; caseworker+ = CASEWORKER_OR_ABOVE_ROLES; case reader = CASE_READER_ROLES; worker reader = WORKER_READER_ROLES (all crates/canopy-auth/src/roles.rs); a bar with no client admits a delegation through any client, via X, Y only a delegation those clients present.

Persons and households

  • POST /v1/persons — CreatePerson (first_name, last_name, date_of_birth, ssn, gender, disability_status). The SSN is sealed at rest; the wire exposes ssn_last_four only. GET /v1/persons is keyset-paginated newest first (limit, after_created_at + after_id, search — a pg_trgm infix on first/last name, minimum 2 characters); limit absent → 50, any value clamped to 1..=200 (canopy_api::pagination::clamp_limit, the shared ADR-001 Amendment 1 §B2 bound, applied by list_page_limit in api/mod.rs) — zero and negative values serve one row, never a LIMIT -5 500 or an empty page mistakable for no persons (#2175). DELETE soft-deletes and stages no event.

  • POST /v1/households — CreateHousehold (effective_date, name). GET /v1/households/{id} returns the current-accepted membership versions valid on as_of (HouseholdMember carries relationship, provenance, and provenance_redacted / provenance_redacted_at); a malformed as_of is 400.

  • Membership writes go through POST /v1/households/{id}/members/claims (MemberClaimRequest: person_id in the body, value: {relationship}, the provenance inputs, valid_from / valid_to? / fact_id?) and DELETE …/members/claims/{fact_id}?author_sub= (close as of a date, attributed to author_sub; idempotent 204). A double-add trips the per-(household_id, person_id) non-overlap EXCLUDE → 409; a correction may not reassign a membership to another person (422).

  • Homelessness (#3144) is a dated fact of the household: a version carries no value, it is a period [valid_from, valid_to) over which the household is homeless, and no accepted period covering a day means the household is not homeless on it. A write is POST /v1/households/{id}/homelessness (HomelessnessClaimRequest in crates/canopy-contracts-persons/src/homelessness.rs: the provenance inputs, valid_from / valid_to? / fact_id?, where fact_id corrects that period). The end is DELETE …/homelessness/{fact_id}?end_date=&author_sub=, end_date required: it supersedes every window of the period reaching past end_date and keeps the part before it, and an end on or before the period’s start withdraws it. It answers 200 HomelessnessCloseResponse { fact_id, household_id, end_date, superseded }; a repeat end supersedes nothing and stages no event. A household holds one accepted period on any day: an overlapping second period, sequential or concurrent, is 409 exclusion_violation.

  • Parent–child facts (#3047) record who is the natural, adoptive or step-parent of which child, dated. A write is POST /v1/persons/{id}/parents/claims, where {id} is the child (ParentChildClaimRequest in crates/canopy-contracts-persons/src/parent_child.rs: parent_person_id in the body, value: {kind} with kind ∈ natural | adoptive | step, the provenance inputs, valid_from / valid_to? / fact_id?), and the close is DELETE …/parents/claims/{fact_id}?author_sub=, idempotent 204. One pair holds one kind at a time: an overlapping second fact for the pair, sequential or concurrent, is 409 exclusion_violation, so a step-parent who adopts gets a second window after the first closes. A correction may not name another parent (422), and nobody is their own parent (422). Nothing limits the parents per child or the children per parent; that is each program’s rule.

  • Pregnancy facts (#3143) record one person’s pregnancy, dated: valid_from is the first day it is in effect and valid_to the day it ended (a birth or a loss), open while it continues. A write is POST /v1/persons/{id}/pregnancies (PregnancyClaimRequest in crates/canopy-contracts-persons/src/pregnancy.rs: value: {expected_delivery_date, fetus_count, family_size_increase_waived}, the provenance inputs, valid_from / valid_to? / fact_id?). The fetus count is 1 to 8 (MIN_FETUS_COUNT / MAX_FETUS_COUNT), and the waiver is the applicant’s election of 7 CFR 246.7(d)(2)(vii). The answer is the Pregnancy it recorded. The end is DELETE /v1/pregnancies/{fact_id}?end_date=&author_sub=: the fact names its person, so the path carries none. It supersedes every window from end_date on and re-tiles the left remnant [valid_from, end_date), answering 200 PregnancyCloseResponse { fact_id, person_id, end_date, closed }. closed is false, and nothing is written, when the pregnancy had already ended by then; an end_date on or before the first day removes the pregnancy, as an address close does. A person has one pregnancy at a time: an overlapping second fact, sequential or concurrent, is 409 exclusion_violation. The whole value is sealed (below), and the events carry none of it.

Head-of-household resolution (the fleet rule)

relationship carries two frames on one column: the household-role frame a worker or seed writes (head_of_household, head, spouse, child, …) and the relationship-to-applicant frame the portal’s finalize saga writes (self, spouse, child, …). Every service that must name one addressable member — a letter recipient, a checklist recipient, an identity-gate subject — resolves it the same way, in this order:

  1. an explicit role claim, head_of_household or head (case-insensitive);

  2. else the applicant frame’s self;

  3. else the first member of the roster as canopy-persons returns it.

Step 3 is deliberate and household-favorable: a populated household that claims no head is a data gap, not an unaddressable household; only a member-less roster is unaddressable, and that alone is what a no_head_of_household-class refusal means. A roster that could not be read never yields a guessed head; the posture on a failed read is the caller’s own (a retryable 502 persons_unavailable, or a fail-closed coded 422 for a mandatory letter). The one implementation is canopy_types::household::select_head_by (crates/canopy-types/src/household.rs), generic over the caller’s member shape; head_of_household_person_id layers a parseable-id fallback for rosters whose ids cross the wire as strings.

Batch expansion

expand_persons issues a fixed five queries regardless of member count; SSNs are decrypted Rust-side, so MemberFull.person carries ssn_last_four only.

  • GET /v1/households/{id}/full?as_of= → HouseholdFull { household, members: [MemberFull] } — the membership roster and each member’s income / assets / expenses / addresses as the current-accepted versions valid on as_of (the orchestrator forwards a determination’s as_of). A member is included regardless of person.active, so a soft-deleted person still counts toward household size.

  • POST /v1/persons:batchGet { person_ids, projection: ["income"], as_of? } — the person core always; each projected group (person_ssn, income, assets, expenses, addresses, parent_child, pregnancies) additionally; an unprojected person_ssn is never decrypted and stages no ssn.accessed. Missing or soft-deleted ids are omitted; relationship is null.

  • pregnancies (#3143) fills MemberFull.pregnancies with each Pregnancy { fact_id, person_id, valid_from, valid_to, value, redacted, redacted_at, provenance } of the member that covers as_of or ended on or before it (a version beginning after as_of is left out), its value opened under the fact DEK. A pregnancy corrected over part of its window holds one version per window, so its end is the valid_to of its last window. It costs one query for the id set (pregnancy_versions::list_by_persons_as_of), and none when unprojected; /full serves it with no projection, and the person search refuses it (400).

  • homelessness (#3144) fills HouseholdFull.homelessness with the household’s accepted HomelessnessPeriod { fact_id, household_id, valid_from, valid_to } that start on or before as_of, oldest first: the one covering as_of, if any, and every one that ended by then. It costs one query (homelessness_versions::list_by_household_as_of), and none when the group is not served; the field is always present and empty unless served. /full serves it with no projection, or a projection names it as homelessness. It is a household group: persons:batchGet refuses it (422), and the person search refuses it with the fact groups (400).

  • POST /v1/persons:batchGet { person_ids, projection: ["income"], as_of? } — the person core always; each projected group (person_ssn, income, assets, expenses, addresses, parent_child) additionally; an unprojected person_ssn is never decrypted and stages no ssn.accessed. Missing or soft-deleted ids are omitted; relationship is null.

  • parent_child (#3047) fills MemberFull.parent_child with every ParentChildRelation { fact_id, parent_person_id, child_person_id, kind, valid_from, valid_to } in force on as_of in which the member is the parent or the child, so a fact between two listed persons appears on both. It costs one query for the whole id set (parent_child_versions::list_by_persons_as_of), and none when unprojected; the field is always present and empty unless projected. GET /v1/households/{id}/full serves it with every other group when it has no projection, and a projection names it as parent_child. The person search refuses it with the other fact groups (400).

  • POST /v1/households:batchGet { household_ids, as_of } (as_of required) → [{ household_id, members: [{ person_id, relationship }] }] — no person core, no sealed envelope opened. A missing or inactive household is absent from the result; an active household with no membership on as_of is present with an empty roster.

Both batch routes cap at 500 ids (422), collapse duplicates and keep first-occurrence order.

Facts: the version corpus and claims

The {income,asset,expense,address}_versions corpus is the sole fact store. GET /v1/persons/{id}/{income,assets,expenses,addresses} lists the current-accepted version per fact as of the legal day, claim_status-filtered to determination-feeding rows (Proposed / Rejected never appear), each with provenance and id = the stable fact_id; a historical read is GET /v1/households/{id}/full?as_of=.

A claim (POST …/claims) carries value, the provenance inputs — source (a VerificationSource), author ({"author_type":"worker","sub":…} or {"author_type":"applicant","household_id":…}; System is 422), optional origin — and valid_from / valid_to? / fact_id?. The server derives claim_status (worker → accepted_verified, applicant → accepted_unverified) and owns recorded_at. fact_id absent = a new fact; present = a valid-time correction (supersede overlapping, re-tile remnants, insert; serialized per fact_id), and it must belong to the path person (404 otherwise). Response 201 ClaimResponse (version_id, fact_id, claim_status); 409 on a post-lock overlap. Value shapes: income {income_type, amount, frequency, employer_name?}, asset {asset_type, value, description?}, expense {expense_type, amount, frequency}, address {address_type, line_1, line_2?, city, state, zip, county_fips?}. A residential address must name its county (#3376): county_fips is the five-digit code of a county of the address's own state, and, when that state is the deployment's, one the pack serves (Rulesets › Served counties). A claim that does not is 422 county_required, county_state_unknown, county_not_in_state or county_not_served, naming the field and never the value; a correction and a finalize-tagged claim are held to the same rule, and a mailing or substitute address is not checked. canopy-persons loads the served counties at boot and refuses to start when an entry of fips_county_codes is no county of its State or appears twice (an empty list serves the whole State). The DELETE …/claims/{fact_id}?author_sub=&as_of= close supersedes the current version and re-tiles only the left remnant [valid_from, close_date), attributing the close to author_sub (required — #874; a system caller supplies the closing worker’s subject exactly as author on a claim, and a value naming the caller itself is 422 like a System author; a user’s close is attributed to the user whatever it names); idempotent 204. author_sub, like a worker author's sub, is an OidcSubject (#1008): 1–255 bytes of ASCII with no control character, compared byte for byte and never trimmed, so any other value is 422. An asset claim's value.asset_type is a canopy-reference AssetType token (bank_account, cash_on_hand, stocks_bonds, vehicle, real_property, retirement_account, ida_account, able_account, plan529, indian_trust_land, business_equity, other); any other value is refused and nothing is stored (#3335).

PII value columns are crypto-shred-sealed at rest under a per-fact DEK (ADR-036): income amount / employer_name, asset value / description, expense amount, address line_1 / line_2, the whole pregnancy value (one value envelope over its three fields), and the ADR-027 proposed_value provenance blob. A redacted pregnancy reads value: null. A redacted fact still appears in a read with redacted: true, redacted_at, and null value leaves; consumers computing eligibility must skip it.

IMPORTANT

Household membership is the exception, spelled differently on purpose. relationship is a non-PII structural discriminator, so a membership’s DEK covers only its provenance blob. Redacting a membership expunges that blob and nothing else: the member stays in the roster, keeps its relationship, and must still be counted. The membership read therefore carries provenance_redacted / provenance_redacted_at — per version row — not redacted / redacted_at.

Redaction (crypto-shred)

Privileged, irreversible: each route tombstones the relevant DEK in redaction_keys so the sealed plaintext becomes unrecoverable while the append-only version rows stay intact. data_steward only (admins do not inherit it). A blank reason is 400; the shred and a plaintext-free *.redacted audit event commit in one transaction; re-redacting is idempotent 200. The tombstoned DEK’s shredded_at is the response’s redacted_at (#2475); a finalize cancellation or orphan sweep stamps every shred it makes at its request’s one instant, and at the same instant every version it supersedes (superseded_at) and every person or household it deactivates (updated_at, #2587).

  • POST /v1/persons/{id}/facts/{kind}/{fact_id}/redact — kind ∈ income | asset | expense | address | household_member | parent_child | pregnancy; RedactRequest { reason }. The sub-resource …/redact form is required (matchit rejects the …:redact colon). A parent_child fact is redacted under its child’s {id} (404 under any other person) and, like a membership, loses only its provenance blob (DEK subject parent_child_version); the fact survives.

  • POST /v1/persons/{id}/redact-ssn — shreds only the per-person SSN DEK; date_of_birth and the facts are untouched; ssn_last_four then reads null.

Finalize control surface (ADR-038)

Internal, applications-only routes the finalize saga drives around its tagged writes (FINALIZE_OPERATOR, Admission::system_from(&[canopy-applications]): another system caller is 403 service_not_allowlisted; a non-positive generation is 400; every request and response is PII-free):

  • …/{op}/{gen}/register opens the generation gate (idempotent upsert; an already-cancelled generation reports cancelled — bump the generation).

  • …/{op}/{gen}/release un-holds every event the operation staged once the application has committed (released = rows un-held).

  • …/{op}/{gen}/cancel compensates an aborted operation in one transaction: mark cancelled (serializing with in-flight tagged writers), re-inventory the receipts, drop the still-held events, then per receipted entity crypto-shred + deactivate an exclusively finalize-owned entity or quarantine one a later non-finalize write shares (events_dropped, compensated[], quarantined[]). A shared membership is one in force on the compensation’s legal day: its instant as a date in the pack’s [jurisdiction].timezone, never the database’s UTC date (#2526). Idempotent and resumable.

  • GET …/{op} — the operation’s generations and receipts for the reconciler (runbook).

A read that races a compensation answers as if it came a moment later (#3252). A read takes the person rows and their DEK states in two statements, so a person compensated between them arrives with an active row and a shredded DOB DEK. Only compensation shreds a DOB DEK, and it always deactivates the person, so once a fresh read finds the person inactive the row is dropped: a list, the export and the batch read omit the person, and a single-person read answers 404. A DOB DEK shredded under a person who is still active breaks that invariant, and the read still fails.

Export

GET /v1/export/persons — user-only (admin or quality_control, any client) bulk export. Query: from / to (RFC 3339 window; defaults 24 h before to / now), format (json default, csv), limit (default 10 000, clamped to 1..=50 000), mode (foia default — FoiaPerson, year-only birth date, street redacted; portability — the full PersonWithAddresses for the named person_id, required). 400 for an invalid window or mode. Parameters, redaction shapes and the export audit event: the data-export runbook.

Error codes

Code Meaning

400

Validation failure, a NUL in any plain-text field a write stores included: a person’s names and optional attributes (race entries too), a household’s name, an address’s city, state, zip and county, a membership’s relationship, a fact’s category or frequency, and a claim’s origin (stored as TEXT, which refuses NUL, #2960, #2961); a blank redaction reason, or one with a NUL (it rides a JSONB event payload); malformed as_of; a close without author_sub; search under 2 characters or holding a NUL (#2962); invalid export window / mode or missing person_id in portability mode; a malformed finalize tag or non-positive generation; an X-Canopy-Actor header (actor_header_retired)

401

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

403

Admission: portal_on_non_portal_route, portal_scope_missing, service_class_on_user_only (a system caller on a redact, export or compensate route), service_not_allowlisted (another system caller on the finalize surface), system_caller_required (a user on the finalize surface), actor_not_allowed, required_role_missing; ownership_claim_missing / ownership_mismatch on the portal’s person read. The service’s own: a finalize tag from any caller but canopy-applications' system token; a delegation asking persons:batchGet for person_ssn

404

Person, household, fact (or a fact_id not owned by the path entity), unknown redact kind

409

A claim overlapping an existing accepted window (EXCLUDE, code exclusion_violation); a finalize write against an absent or cancelled generation; an ambiguous or saga-era orphan graph

422

A System author; an author_sub on a close that is not a valid OIDC subject, or one naming the calling service; a negative amount or value, or an income amount, asset value or expense amount past 99,999,999.99, the NUMERIC(10,2) range those columns had before they were sealed (code fact_amount_out_of_range, #2957); a body id violating an FK (code foreign_key_violation); a membership correction reassigning the person; a batch over 500 ids

503

No trustworthy key set in time (keys_unavailable)

Held IEVS accepts (#2546)

An IEVS accept never writes an accepted fact: …/income/claims refuses source: ievs. canopy-web’s and canopy-cli’s accept post the worker-verified income to …/income/proposals, and canopy-persons stores it as one proposed income version (ADR-027 Amendment 6).

  • Provenance is the server’s. The source is ievs, the origin is ievs:{discrepancy_id} in the parsed id’s canonical form, and the author is the bearer’s worker.

  • A proposal is inert. It supersedes nothing, feeds no read (every determination read filters to the accepted statuses), and stages no event, so nothing downstream reacts to income no resolution has linked.

  • A correction carries its fact. A supplied fact_id must be the person’s own fact, as on a claim.

  • The read serves pending proposals. It lists the person’s pending proposals of the discrepancy, newest first, in any validity window, for a retried accept to reuse.

Only canopy-snap’s resolution makes a proposal count (see Events consumed).

Events consumed

  • ievs.discrepancy_resolved (canopy-snap; queue canopy-persons.ievs-resolutions; payload canopy_contracts_snap::events::IevsDiscrepancyResolvedV1). An accepted_verified resolution by a worker naming fact F promotes the newest pending proposal of F that this worker held, with the event’s person and the discrepancy’s origin. Another worker’s proposal of the same fact is never applied under the resolver’s name:

    • It appends the accepted_verified version, authored by the resolving worker, superseding as a correction does.

    • It stages income.claimed and persons.income_changed in the inbox transaction.

      Every resolution then consumes the origin’s pending proposals (superseded_at), except an accept resolved by a service, so a reject, a manual resolve or a withdrawal (which canopy-snap announces as its own resolution, status withdrawn, #2966) promotes nothing and leaves nothing pending. Each of these promotes nothing and acks:

    • a link to no pending proposal (a legacy fact, another person’s or another discrepancy’s fact);

    • a fact whose key was shredded;

    • an accept resolved by a service, not a human (ADR-027 §1). In this case nothing is consumed either: the proposals stay pending and inert.

      A failing promotion retries, then dead-letters; the fact stays proposed until an operator replays it (Event delivery protocol).

Events published

String set from services/canopy-persons/src/events.rs and crates/canopy-contracts-persons/src. Person and household events carry ids only (ADR-004); soft-delete stages nothing.

  • person.created, person.updated; household.created.

  • household.member_claimed, household.member_closed — attributed membership writes (the full MemberFactValue rides the payload; relationship is not PII; member_closed carries the closing worker as author, #874).

  • household.homelessness_claimed, household.homelessness_closed (#3144) — attributed homelessness writes, asserted program-neutral like the rest of the household family: {household_id, fact_id, version_id, author, claim_source, claim_status, valid_from, valid_to?, before} for a claim, and {household_id, fact_id, author (the closing worker), close_date, before} for an end, only when it superseded a window. A version carries no value, so before holds windows alone (HomelessnessClaimedEvent / HomelessnessClosedEvent in crates/canopy-contracts-persons/src/events.rs).

  • person.parent_child_claimed, person.parent_child_closed (#3047) — attributed parent–child writes, asserted program-neutral like the household family: {parent_person_id, child_person_id, fact_id, version_id, author, claim_source, claim_status, valid_from, valid_to?, before, after} for a claim, and {parent_person_id, child_person_id, fact_id, author (the closing worker), close_date, before} for a close, only when the close superseded a window. The kind is not PII and rides whole (ParentChildClaimedEvent / ParentChildClosedEvent in crates/canopy-contracts-persons/src/events.rs).

  • income.claimed, asset.claimed, expense.claimed, address.claimed — {person_id, fact_id, version_id, author, claim_source, claim_status, valid_from, valid_to?, before, after}, before being the complete superseded window set. Income / asset / expense value leaves ride sealed (SealedDecimal / SealedValue under the fact DEK, the envelope persisted at rest), so the audit copy is expunged by the same shred; the address payload is coarse (address_type, city, state, zip, county_fips — never the street).

  • income.closed, address.closed — {person_id, fact_id, author (the closing worker, from the primitive’s author_sub), close_date, before}, only when the close superseded a window.

  • pregnancy.claimed, pregnancy.closed (#3143) — value-free: {person_id, fact_id, version_id, author, claim_source, claim_status, valid_from, valid_to?, before} for a claim and {person_id, fact_id, author, end_date, before} for an end, only when the end superseded a window; each before window is {valid_from, valid_to?} alone (PregnancyClaimedEvent / PregnancyClosedEvent in crates/canopy-contracts-persons/src/events.rs). Like the address pair, and for consistency with it, the envelope asserts no program set, so canopy-security records them with none and a program-scoped audit read leaves them out (derive_programs, services/canopy-security/src/event_parsing.rs); canopy-security parses them as claim / close on resource pregnancy.

  • persons.income_changed — a figure-free {person_id, household_id} signal staged on every income claim, close and held-accept promotion (a proposal itself stages nothing, #2546) (publish_income_changed, events.rs; household_id is the person’s household on the request’s legal day, #2526), so canopy-medicaid can re-evaluate an Express Lane income lapse without income data crossing the bus.

  • fact.redacted, ssn.redacted — {person_id, [kind, fact_id,] author, reason, redacted_at}; canopy-security records them as ordinary audit rows.

  • ssn.accessed — staged on every genuine plaintext SSN open (create / get / list with person_ssn, :batchGet with person_ssn projected, household-full with person_ssn, export; never update, #2705; never list or household-full with no projection, #2986), one per decrypted person, fail-closed through the outbox: {person_id, actor_sub, purpose ∈ case_view | search | batch_lookup | foia | portability, source_service}; a redacted SSN fires nothing.

  • persons.export.requested — the export audit event (api/export.rs).

Edit this page · default