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

200 OK
{
  "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
optedOutRequired, and true. false is refused: only the person opts back in.
reasonRequired. 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

StatusCodeCause
400bad_requestThe body is not JSON; or, with a personal access token, no x-mapier-project header
401invalid_credentialsNo key, or one that is unknown, revoked or expired
403forbiddenA personal access token not made for this environment, or whose owner's role no longer allows this
403insufficient_scopeThe key does not carry the messages:send scope
404not_foundA contact this key cannot see, or none
409project_archivedThe project is archived
413payload_too_largeThe body is over 65,536 bytes
422validation_failedA body this call does not take — optedOut: false, a missing reason — or an unknown x-mapier-version
429rate_limitedOver this route's budget; the Retry-After header says how long to wait
500internal_errorMapier failed on its side; give requestId to support
503service_busyMapier is busy and did nothing; wait details.retryAfter seconds and call again
503upstream_unavailableMapier could not answer right now; retry with backoff

Guide