Opt out a contact
Record that a person asked you to stop, so every later message to them is refused
POST/v1/contacts/{contactId}/consent
Records that a person asked you to stop, when they said so in words a keyword
cannot catch — and on a channel with no keyword opt-out, this is the only way.
It covers the person on every channel: every later message to any of their
contacts is refused 403 recipient_not_allowed (opted_out), and
contact.opt_out_changed fires with source: api. The guide is
Opt-out and consent.
Example request
curl -X POST https://api.mapier.ai/v1/contacts/0192a7c0-2222-7333-8444-555566667777/consent \
-H "Authorization: Bearer $MAPIER_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: optout-0192a7c0-2222-7333-8444-555566667777" \
-H "x-mapier-version: 2026-12-01" \
-d '{"optedOut": true, "reason": "Asked in chat to stop messaging"}'Response
{
"contactId": "0192a7c0-2222-7333-8444-555566667777",
"personId": "0192a7c0-1111-7222-8333-444455556666",
"optedOut": true,
"scope": "person",
"optedOutAt": "2026-10-18T18:04:00.000Z",
"source": "api"
}Body
| Field | |
|---|---|
optedOut | Required, and true. false is refused: only the person opts back in. |
reason | Required. Why, in your words, at most 500 characters. Kept with the record. |
Calling it again for someone already opted out changes nothing and answers with
the first opt-out's optedOutAt. Idempotency-Key is optional; a request
without one is answered x-mapier-idempotency: none.
Errors
| Status | Code | Cause |
|---|---|---|
400 | bad_request | The body is not JSON; or, with a personal access token, no x-mapier-project header |
401 | invalid_credentials | No key, or one that is unknown, revoked or expired |
403 | forbidden | A personal access token not made for this environment, or whose owner's role no longer allows this |
403 | insufficient_scope | The key does not carry the messages:send scope |
404 | not_found | A contact this key cannot see, or none |
409 | project_archived | The project is archived |
413 | payload_too_large | The body is over 65,536 bytes |
422 | validation_failed | A body this call does not take — optedOut: false, a missing reason — or an unknown x-mapier-version |
429 | rate_limited | Over this route's budget; the Retry-After header says how long to wait |
500 | internal_error | Mapier failed on its side; give requestId to support |
503 | service_busy | Mapier is busy and did nothing; wait details.retryAfter seconds and call again |
503 | upstream_unavailable | Mapier could not answer right now; retry with backoff |