Write a consent record
Keep the evidence of one person's consent beside the calls it covers.
Keep the evidence of one person's consent beside the calls it covers. A record that says consent was already withdrawn puts its phone number on your do-not-call list.
Rate limit: 2000 requests per minute per organization, counted together with every endpoint that has no stricter limit of its own. Exceeding it returns 429 with Retry-After; the X-RateLimit-* response headers report your remaining allowance on every call.
v2/consent-recordsAuthorization
AuthorizationRequiredBearer <token>
Your Graine API key. Create one in the dashboard under Developers, or via POST /v2/api-keys. Send it as Authorization: Bearer <key>.
In: header
Request Body
application/jsonRequiredsubjectRequiredSubject
Who gave it: at least one of phone, email or user_key.
purposeRequiredPurpose
What they agreed to.
200notice_versionRequiredNotice Version
Which version of your notice they saw.
64mechanismRequiredMechanism
How they agreed.
64given_atRequiredGiven At
When, with a timezone offset.
withdrawn_atWithdrawn At | null
When they withdrew it, if they have.
Response Body
201
The record, masked.
idRequiredId
The record's id.
subjectRequiredSubject
Who it is about, masked.
purposePurpose | null
What they agreed to.
notice_versionNotice Version | null
Which notice.
mechanismMechanism | null
How they agreed.
given_atGiven At | null
When.
withdrawn_atWithdrawn At | null
When it ended; null while it stands.
activeRequiredActive
True until it is withdrawn.
created_byCreated By | null
Who wrote the record.
created_atCreated At | null
When it was written.
400
1000 — malformed or contradictory input. 1002 — a required parameter is missing.
errorRequiredError
Stable integer code from the /v2 error table. Branch on this.
messageRequiredMessage
One human-readable sentence. Wording may change; the code will not.
401
1100 — missing, unknown or inactive API key. 1101 — a browser session token was presented instead of an API key.
errorRequiredError
Stable integer code from the /v2 error table. Branch on this.
messageRequiredMessage
One human-readable sentence. Wording may change; the code will not.
403
1102 — the key is valid but lacks the scope this endpoint requires, or names another organization. GET /v2/scopes reports what a key holds.
errorRequiredError
Stable integer code from the /v2 error table. Branch on this.
messageRequiredMessage
One human-readable sentence. Wording may change; the code will not.
422
1001 — the body or query failed validation; the message names the first offending field.
errorRequiredinteger
Stable integer code from the error table. Branch on this, not on the message.
messageRequiredstring
One human-readable sentence. Wording may change; the code will not.
429
1300 — the per-organization request rate or concurrent-call limit was reached. Carries Retry-After.
errorRequiredError
Stable integer code from the /v2 error table. Branch on this.
messageRequiredMessage
One human-readable sentence. Wording may change; the code will not.
503
1501 — a service this endpoint depends on is unreachable or returned a 5xx.
errorRequiredError
Stable integer code from the /v2 error table. Branch on this.
messageRequiredMessage
One human-readable sentence. Wording may change; the code will not.
The record, masked.

