Contacts · 3 min read
Contact Consent
Read and record a contact's opt-in or opt-out for email, SMS, WhatsApp and voice
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.
How consent works#
Every channel has one of three states:
| Status | Meaning |
|---|---|
subscribed | The person opted in to this channel. |
unsubscribed | The 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:
| Channel | Unknown means |
|---|---|
voice | Allowed |
whatsapp | Allowed |
email | Not allowed for marketing email |
sms | Not 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.
Get a contact's consent#
Returns the consent state for all four channels, including channels with nothing recorded.
/api/v1/contacts/{contact_id}/consentsHeaders#
| Name | Required | Description |
|---|---|---|
X-API-Key | Yes | An API key from your organization. See Authentication. |
Path parameters#
| Name | Type | Required | Description |
|---|---|---|---|
contact_id | integer | Yes | The contact's id, from List contacts or an upsert response. |
Example request:
curl https://app.lemuai.com/api/v1/contacts/901/consents \
-H "X-API-Key: lemu_your_api_key"Response#
200
{
"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
}
]
}| Field | Type | Description |
|---|---|---|
contact_id | integer | The contact. |
opted_out | boolean | The contact's "do not contact" switch. When true, can_contact is false for every channel. |
consents | array | One entry per channel: email, sms, whatsapp and voice. |
consents[].channel | string | The channel. |
consents[].status | string or null | subscribed, unsubscribed, or null when nothing has been recorded. |
consents[].source | string or null | Where the latest status came from, as sent when it was recorded (for example manual, signup_form or checkout). |
consents[].source_detail | object | Any extra details sent with the latest status. |
consents[].updated_at | string or null | When the status was last recorded, in ISO 8601 (UTC). |
consents[].can_contact | boolean | Whether a message or call on this channel may go to this contact right now. |
Record consent for one channel#
Sets the status for one channel. Every change is also kept in the contact's consent history.
/api/v1/contacts/{contact_id}/consents/{channel}Headers (record)#
| Name | Required | Description |
|---|---|---|
X-API-Key | Yes | An API key from your organization. See Authentication. |
Content-Type | Yes | application/json |
Path parameters (record)#
| Name | Type | Required | Description |
|---|---|---|---|
contact_id | integer | Yes | The contact's id. |
channel | string | Yes | email, sms, whatsapp or voice. |
Request body#
| Field | Type | Required | Description |
|---|---|---|---|
status | string | Yes | subscribed or unsubscribed. |
source | string | No | Where the decision came from, 1 to 64 characters, for example signup_form, checkout or support. Default manual. |
source_detail | object | No | Any extra details you want kept with the decision, such as a form name or the text the person agreed to. |
Example request:
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#
| Status | When |
|---|---|
401 | The API key is missing or not valid. |
404 | No contact with this id in your organization. |
422 | channel 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.
Was this page helpful?
Docs