Manage consent purposes and grants through the API
Create consent purposes, record grants and withdrawals, and gate a collection rule on consent.
Developers and org staff who record what a person agreed to, on which wording, and who gave it.
Consent records are the proof of consent and of its withdrawal. A guardian must consent for a minor. Marketing consent can never be granted for a minor.
What you will do, in one sentence
Define a purpose, let people grant or withdraw through the routes, record paper consent as staff, and read the history.
Screens are captured from a seeded test system. Every name, address and number on the screens is invented. Prepared 15 November 2026.
1. The three collections
All three are hidden system collections. The records API cannot write to them. The routes below write them.
| Collection | What it holds |
|---|---|
_consentPurposes | What a person can consent to: key, name, text, version, lawfulBasis, minAge, requiresGuardian, marketing, org, status. |
_consents | The state: one row per person and purpose. |
_consentEvents | The evidence: one append-only row per grant or withdrawal, with the full text that was shown. |
A purpose is stored by its key, for example newsletter. Keys are lowercase, unique across all organizations and cannot change.
Which purposes need consent, and how long evidence must be kept, depends on your country and congregation. Have a lawyer review the purposes and the texts. This guide is not legal advice.
2. Create a purpose
Superusers write global purposes. Owners, admins and registrars of an organization write that organization's purposes.
curl -X POST https://auth.example.org/api/orgs/$ORG_ID/consent-purposes \
-H "Authorization: $TOKEN" -H "Content-Type: application/json" \
-d '{"key": "riverside-newsletter", "name": "Newsletter", "text": "We email you the monthly newsletter.", "lawfulBasis": "consent"}'
In the admin UI, open Consents and select New purpose. The form has the fields Key, Name, Lawful basis, Minimum age, a marketing flag and Text shown to the person.


Rules to know:
- Changing the text raises the version. Existing consents show as outdated until the person consents again.
- Only the basis
consentneeds a grant. - A marketing purpose gets a minimum age of 18 when none is set. It can never be granted for a minor.
- A purpose with consent records cannot be deleted (
409). Setstatustoarchivedinstead.
3. Grant and withdraw
API keys are refused on every consent route.
| Route | Who |
|---|---|
GET /api/me/consents | A signed-in user. Shows each purpose and status: granted, withdrawn or none. |
POST /api/me/consents/{purpose}/grant | A signed-in user. Add {"member": "<id>"} for a minor of the household. |
POST /api/me/consents/{purpose}/withdraw | The same. |
POST /api/orgs/{id}/consents | Org staff: {purpose, member or user, action, method, evidenceRef, givenBy}. |
GET /api/orgs/{id}/consents?member=ID | Org staff. A person's consents and history. |
GET /api/consents/history?subject=ID | A superuser. |
| Subject | Who may grant or withdraw |
|---|---|
| An adult user | The user, signed in |
A minor (a household member flagged isMinor) | An active adult guardian of the same household |
| An adult, on paper or in person | Org staff, with an evidenceRef |
Staff means owners, admins and registrars of the org. For a minor, staff must name the guardian in givenBy. Withdrawal is never harder than granting. Granting what is already granted writes no event.
4. Gate a rule on consent
Add the sign-in check you want, then the consent test:
@request.auth.id != "" &&
@collection._consents:c.subject ?= member &&
@collection._consents:c.purpose ?= "newsletter" &&
@collection._consents:c.withdrawnAt ?= ""
member is a relation to _householdMembers on your collection. For a user, compare with @request.auth.id. A consent that was never given has no row, so the rule denies. A withdrawn one has a date, so it denies.
5. History and erasure
_consentEvents accepts new rows only. A model hook refuses every update and delete. Raw SQL is outside that guarantee. Each event keeps the action, purpose, version, text shown, time, who gave it, who did it, the method and the evidence reference.
The data map treats consent rows as retain. When a person is erased, the rows stay with the person replaced by a pseudonym. See the erasure guide.
A person's own consents are in their data export. Consents given for a child are not.
6. Quick reference card
Record paper consent
POST /api/orgs/{id}/consents.- Set
actiontograntandmethodtopaper. - Give an
evidenceRef. For a minor, addgivenBy.
Retire a purpose
PATCHthe purpose withstatus: archived.- Do not delete it. The evidence stays.
Hosted pages for people to manage their own consents are not built yet. The routes exist.