Skip to main content
← All documentationContents ↓

API Reference: Consent Fields

Record, withdraw, and read consent captured on a CONSENT data field: grantor and method validation, staff attestation with optional evidence, and the daily expiry sweep.

Overview

A CONSENT field records a Team's consent to a stated purpose for one record — for example, "may we use this student's photo for face-matching features?" — as a filterable yes/no plus a fully audited history. The field's physical value is a nullable boolean (never asked / in effect / declined-withdrawn-expired); every detail of who granted it, how, and with what evidence lives in the record's history, not in the field value itself.

Generic record writes cannot set a CONSENT field — not a record PATCH, not a bulk update, not an Automation. It is written only through the two actions below.

Authentication and Tier

The consent endpoints are standard tier. Staff record and withdrawal actions require an authenticated Team User through a user access token or authorized user OAuth grant, because every staff consent event records the person who entered it; a session token a signed-in Team User created acts as that user. A Team API key can only import consent given elsewhere, and only when the key holds the Consent Import feature permission (see Import with an API key). A session token created from an API key cannot write consent. Permission-bound reads remain available to authorized API keys. This example records a staff attestation as an authorized user, with an optional evidence File (for example a scanned signed form; omit evidence when there is none):

curl -s -X POST "https://api.simply360.app/v1/data-records/WXYZ-5678-IJKL/consent/FLD1-1111-AAAA" \
  -H "Authorization: Bearer <user-access-token>" \
  -H "Content-Type: application/json" \
  -d '{"action":"RECORD","status":"GRANTED","grantor":{"role":"GUARDIAN","name":"Jane Doe"},"method":"STAFF_ATTESTED","evidence":{"fileSimplyId":"FILE-0000-0001"}}'

Access is governed by data permissions on the record's Collection and by field-level read/write permission on the CONSENT field itself, for an API key through its data role. OAuth-authenticated callers additionally need the records:write scope to record or withdraw consent, and records:read to read it. Supplying a File as evidence also requires files:read and current access to that same-Team File. Staff authority and current field policy are rechecked inside the save transaction. recordedBy and every timestamp are set from the authenticated caller; they are never accepted from the request body.

Endpoints

MethodPathTierPurpose
POST/v1/data-records/{dataRecordSimplyId}/consent/{dataFieldSimplyId}standardRecord a grant or decline, or withdraw a prior grant.
GET/v1/data-records/{dataRecordSimplyId}/consent/{dataFieldSimplyId}standardRead the latest consent detail for this record and field.

action: "RECORD" requires status and grantor. To bring in decisions captured in another system, use method: "IMPORT" (when the field allows it) with a sourceReference that identifies the original record; an import without one is refused with 400 VALIDATION_ERROR. A Team User's import is recorded as that person; an API key's import is recorded as the key. The field's settings determine which method values are accepted (its allowed methods) and which grantor roles (its who-may-grant setting). On a field for adults (SELF_IF_ADULT) the grantor is SELF, and the subject's date of birth must show an adult. On a field for minors (GUARDIAN_FOR_MINOR) the grantor is GUARDIAN or AUTHORIZED_REPRESENTATIVE. On either, a STAFF_ATTESTED entry may name any grantor role, but naming the subject (SELF) on a field for adults still needs their date of birth to show an adult; record a minor's consent with GUARDIAN. A field set to staff-attested only (STAFF_ATTESTED) accepts only the STAFF_ATTESTED method, so a grant or decline with IMPORT on it is always refused, even if Import is among its allowed methods; a withdrawal is not checked against these settings. A STAFF_ATTESTED entry records that a staff member attests the consent was given; Simply360 does not dictate how the Team keeps its own proof. evidence.fileSimplyId is optional and never required, whatever the field's settings, including the retired staffEvidenceRequired setting, which is ignored. When a method or grantor role is refused, the error message ends with the combinations the field does accept, for example This field accepts method STAFF_ATTESTED with any grantor role (a staff member attests the consent; evidence.fileSimplyId is optional). Every supplied File must have a trusted current source and be readable by the actor. The server adds immutable fileVersionNumber and fileSourceSha256 pins to the grant evidence; these are response/history fields and are never accepted as input authority.

TypeScript SDK

const result = await s360.dataRecordConsent.recordConsent('WXYZ-5678-IJKL', 'FLD1-1111-AAAA', {
  status: 'GRANTED',
  grantor: { role: 'GUARDIAN', name: 'Jane Doe' },
  method: 'STAFF_ATTESTED',
  evidence: { fileSimplyId: 'FILE-0000-0001' },
});
// { eventSimplyId: 'LOGE-VENT-0001', status: 'GRANTED' }

Request Body

FieldTypeRequiredNotes
actionstringYes"RECORD"
statusstringYes"GRANTED" or "DECLINED"
grantorobjectYes{ role: "SELF" | "GUARDIAN" | "AUTHORIZED_REPRESENTATIVE", name?, recordSimplyId?, userSimplyId? }
methodstringYes"WIZARD" | "SIGNED_DOCUMENT" | "STAFF_ATTESTED" | "IMPORT", must be one of the field's allowed methods
evidenceobjectNo{ fileSimplyId? }; optional evidence such as a scanned signed form. Never required.
effectiveAtstringNoISO-8601; defaults to now. Required from an API key, and not in the future.
expiresAtstring \| nullNoExplicit expiry for a grant; defaults to the field's configured duration when omitted. From an API key it must be a date-time later than effectiveAt, and null is accepted only when the field's default duration is none.
statementVersionnumberNoThe statement version shown to the grantor; must match the field's current version when supplied
sourceReferencestring \| nullConditionalWhere an imported decision came from, such as the source system's consent or submission ID. Required when method is "IMPORT"; stored in the consent event's detail and returned when you read consent. At most 255 characters from an API key.
sourceLabelstring \| nullNoAPI key imports only: a short label for where the answer came from, such as a checkout form's name. At most 120 characters; stored in detail.

Import with an API key

An integration can bring in a consent answer a person gave somewhere else, such as a marketing checkbox at an outside checkout, with a Team API key and no signed-in person. A Team Admin grants the key the Consent Import feature permission (CONSENT_IMPORT) under Admin permissions on the API Keys screen. Nothing else implies it: not the key's scopes, its data role, or a role or person that holds it. It adds no data access, so the key's data role still needs update access to the record's Collection and the CONSENT field, and the record must be inside the key's Security Scope; the key also needs records:write.

  • Record: method must be "IMPORT", and the field must allow it. Send sourceReference (the external payment or submission ID) and effectiveAt (when the person gave the answer; not in the future), and optionally sourceLabel. Leave out expiresAt to use the field's default duration, or send a date-time later than effectiveAt; null is accepted only when the field's default duration is none. evidence is refused; the grantor still has to fit the field's policy.
  • Withdraw: method must be "IMPORT" and sourceReference (for example the unsubscribe's ID) is required. Send effectiveAt, when the person opted out (not in the future), so a late-synced unsubscribe keeps its real time. Leave it out to mean now: a withdrawal without effectiveAt is the newest answer, so it is never refused. sourceLabel is optional. isPortalWithdrawal cannot be true.
  • Imports only move forward in time. Simply360 keeps a high-water mark for each person and consent field: the newest time found anywhere in their consent history for that field, whoever recorded it and in whatever order. Each event counts at the time it took effect: a grant's or decline's effectiveAt, a withdrawal's own time, or for an expiry the later of the expired grant's effectiveAt and its expiry. A grant counts no later than about when it was saved; a decline, withdrawal, or expiry always counts at its real time. An API key's grant or decline must be dated after the mark; on a tie the history wins. A withdrawal by key without effectiveAt means now, so it is never refused. One with effectiveAt is held only to grants: it is refused only when the history holds a grant strictly newer than that time, so only a newer opt-in can beat an opt-out, and an opt-out wins a tie. Otherwise nothing is recorded and the response is 409 CONSENT_SUPERSEDED_BY_NEWER_EVENT; treat it as done. So an old answer synced late can never revive a consent the person withdrew or let expire, even if a backdated entry was added since, wipe a newer opt-in, or replace a newer grant's details.
  • No grants that have already expired. A grant whose expiresAt, or the expiry the field's default duration gives its effectiveAt, has already passed is refused with 400 CONSENT_IMPORT_ALREADY_EXPIRED.
  • Attribution. The event is recorded as the key, never as a person: detail.recordedBy is { userSimplyId: "API_KEY", apiKey: { simplyId, name } }, and the record's history shows the API client as the source.
curl -s -X POST "https://api.simply360.app/v1/data-records/WXYZ-5678-IJKL/consent/FLD1-1111-AAAA" \
  -H "Authorization: Bearer s360_live_..." \
  -H "Content-Type: application/json" \
  -d '{"action":"RECORD","status":"GRANTED","grantor":{"role":"SELF","name":"Jane Doe"},"method":"IMPORT","effectiveAt":"2026-11-09T18:42:00Z","sourceReference":"pay_8Kq2","sourceLabel":"Spring gala checkout"}'

curl -s -X POST "https://api.simply360.app/v1/data-records/WXYZ-5678-IJKL/consent/FLD1-1111-AAAA" \
  -H "Authorization: Bearer s360_live_..." \
  -H "Content-Type: application/json" \
  -d '{"action":"WITHDRAW","method":"IMPORT","effectiveAt":"2026-11-10T07:15:00Z","sourceReference":"unsub_31Tb"}'

action: "WITHDRAW" needs only method. Staff and MCP callers can always withdraw; an API key withdraws with method: "IMPORT" as above. A self-service portal withdrawal additionally requires the field's portalWithdrawalAllowed setting.

TypeScript SDK

await s360.dataRecordConsent.withdrawConsent('WXYZ-5678-IJKL', 'FLD1-1111-AAAA', {
  method: 'STAFF_ATTESTED',
});

Returns the record and field Simply IDs, whether the caller may read the field, the current status, and the latest consent event's detail. When nobody has been asked yet, status and detail are null. A caller who can read the record but not the field receives readable: false with status and detail set to null, rather than a permission error, matching how consent detail is redacted in record history.

TypeScript SDK

const { data } = await s360.dataRecordConsent.getConsent('WXYZ-5678-IJKL', 'FLD1-1111-AAAA');
// {
//   dataRecordSimplyId: 'WXYZ-5678-IJKL',
//   dataFieldSimplyId: 'FLD1-1111-AAAA',
//   readable: true,
//   status: 'GRANTED',
//   detail: {
//     status: 'GRANTED',
//     purposeKey: 'PHOTO_RECOGNITION',
//     grantor: { role: 'GUARDIAN', name: 'Jane Doe' },
//     method: 'STAFF_ATTESTED',
//     evidence: { fileSimplyId: 'FILE-0000-0001', fileVersionNumber: 1, fileSourceSha256: '64-character-source-sha256' },
//     effectiveAt: '2026-10-01T00:00:00.000Z',
//     expiresAt: null,
//     recordedBy: { userSimplyId: 'USER-0000-0001', at: '2026-10-01T00:00:00.000Z' },
//   },
// }

Errors

StatusCodeCause
400VALIDATION_ERRORMethod not allowed or grantor role not permitted for the field's policy (the message names the accepted method and grantor combinations), statement version mismatch, or a self-grant on a field that requires an adult and the subject is a minor or their valid current DOB cannot be established. From an API key, also evidence supplied, an effectiveAt in the future, an expiresAt that is not a date-time later than effectiveAt (or null on a field with a default duration), or a reference or label that is too long.
400SOURCE_REFERENCE_REQUIRED, EFFECTIVE_AT_REQUIREDAn API key's record or withdrawal is missing its sourceReference, or its record is missing effectiveAt.
404NOT_FOUNDThe record or field does not exist or cannot be seen, the field is deleted, or it is not a CONSENT field.
403PERMISSION_DENIEDThe caller lacks write access to the record's Collection or the field (for an API key, through its data role), or a write was made with a session token created from an API key.
403CONSENT_IMPORT_PERMISSION_REQUIREDAn API key that does not hold Consent Import, or no longer does.
403CONSENT_IMPORT_METHOD_REQUIREDAn API key used a method other than IMPORT.
409CONSENT_SUPERSEDED_BY_NEWER_EVENTAn API key's grant or decline is dated on or before the newest time in the person's consent history for the field, or its withdrawal is dated (with effectiveAt) before a newer grant. Nothing was recorded.
400CONSENT_IMPORT_ALREADY_EXPIREDAn API key's grant would already have expired, by its expiresAt or the field's default duration.

Hosted MCP and TeamAgent

The record_consent, withdraw_consent, and get_consent tools apply identical validation. They act for a signed-in Team User; consent import by API key is available only through the REST action above. A generic MCP record write that includes a CONSENT field is refused with a "computed or internal" error before it ever reaches this validation — always use the dedicated tools.

Expiry

A granted consent with an expiresAt in the past is expired by a daily platform sweep, which sets the field back to not-in-effect and appends a CONSENT_EXPIRED history event. Anything that checks consent before acting (for example, a recognition profile) re-checks expiresAt itself rather than trusting the field value alone between sweeps.

↑