LemuAIDocs

Contacts · 3 min read

Contact Consent

Read and record a contact's opt-in or opt-out for email, SMS, WhatsApp and voice

Open in ChatGPTOpen in ClaudeMarkdown

Each contact has a consent status for every channel. LemuAI checks it before a journey or campaign sends a message or places a call, so recording opt-ins and opt-outs from your own system (a signup form, a preference center, a support ticket) keeps your messages within what each person agreed to.

Every channel has one of three states:

StatusMeaning
subscribedThe person opted in to this channel.
unsubscribedThe person opted out of this channel. On WhatsApp this stops marketing: replies in a chat they start, utility templates and authentication codes still go.
null (unknown)Nothing has been recorded for this channel yet.

What happens when the status is unknown depends on the channel:

ChannelUnknown means
voiceAllowed
whatsappAllowed
emailNot allowed for marketing email
smsNot allowed

The contact's opted_out flag is a separate "do not contact" switch. When it is true, no channel is allowed, whatever the per-channel status says. Recording a channel status with this API doesn't change opted_out.

Each response includes can_contact for every channel, which applies all of these rules for you.

For marketing email, your workspace's email settings can also allow sending when consent is unknown. Transactional email (order and account updates sent with Send a transactional email) doesn't need consent, but is never sent to an address on your suppression list, for example after a hard bounce, a spam complaint or an unsubscribe.

Returns the consent state for all four channels, including channels with nothing recorded.

GET/api/v1/contacts/{contact_id}/consents

Headers#

NameRequiredDescription
X-API-KeyYesAn API key from your organization. See Authentication.

Path parameters#

NameTypeRequiredDescription
contact_idintegerYesThe contact's id, from List contacts or an upsert response.

Example request:

cURL
curl https://app.lemuai.com/api/v1/contacts/901/consents \
  -H "X-API-Key: lemu_your_api_key"

Response#

200

JSON
{
  "contact_id": 901,
  "opted_out": false,
  "consents": [
    {
      "channel": "email",
      "status": "subscribed",
      "source": "signup_form",
      "source_detail": { "form": "footer-newsletter" },
      "updated_at": "2026-10-20T08:12:44Z",
      "can_contact": true
    },
    {
      "channel": "sms",
      "status": null,
      "source": null,
      "source_detail": {},
      "updated_at": null,
      "can_contact": false
    },
    {
      "channel": "whatsapp",
      "status": "unsubscribed",
      "source": "manual",
      "source_detail": {},
      "updated_at": "2026-10-22T11:03:10Z",
      "can_contact": false
    },
    {
      "channel": "voice",
      "status": null,
      "source": null,
      "source_detail": {},
      "updated_at": null,
      "can_contact": true
    }
  ]
}
FieldTypeDescription
contact_idintegerThe contact.
opted_outbooleanThe contact's "do not contact" switch. When true, can_contact is false for every channel.
consentsarrayOne entry per channel: email, sms, whatsapp and voice.
consents[].channelstringThe channel.
consents[].statusstring or nullsubscribed, unsubscribed, or null when nothing has been recorded.
consents[].sourcestring or nullWhere the latest status came from, as sent when it was recorded (for example manual, signup_form or checkout).
consents[].source_detailobjectAny extra details sent with the latest status.
consents[].updated_atstring or nullWhen the status was last recorded, in ISO 8601 (UTC).
consents[].can_contactbooleanWhether a message or call on this channel may go to this contact right now.

Sets the status for one channel. Every change is also kept in the contact's consent history.

PUT/api/v1/contacts/{contact_id}/consents/{channel}

Headers (record)#

NameRequiredDescription
X-API-KeyYesAn API key from your organization. See Authentication.
Content-TypeYesapplication/json

Path parameters (record)#

NameTypeRequiredDescription
contact_idintegerYesThe contact's id.
channelstringYesemail, sms, whatsapp or voice.

Request body#

FieldTypeRequiredDescription
statusstringYessubscribed or unsubscribed.
sourcestringNoWhere the decision came from, 1 to 64 characters, for example signup_form, checkout or support. Default manual.
source_detailobjectNoAny extra details you want kept with the decision, such as a form name or the text the person agreed to.

Example request:

cURL
curl -X PUT https://app.lemuai.com/api/v1/contacts/901/consents/whatsapp \
  -H "X-API-Key: lemu_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "subscribed",
    "source": "checkout",
    "source_detail": { "order_id": "SO-10422", "checkbox": "Send me order updates on WhatsApp" }
  }'

Response (record)#

200: the full consent state for the contact, in the same shape as Get a contact's consent.

Errors#

StatusWhen
401The API key is missing or not valid.
404No contact with this id in your organization.
422channel isn't one of the four channels, status isn't subscribed or unsubscribed, or source is empty or too long.

See Errors for the error format.