Docs

Consents

An append-only evidence ledger for marketing consent: record what a contact agreed to, when, and under what legal basis, so you can prove it later on.

POST/consentsRecord consent

basis is explicit_opt_in or soft_opt_in. consent_text is required in practice — the exact copy the contact agreed to is the whole point of this endpoint — even though it's typed optional. occurred_at defaults to now and can't be in the future.

curl -X POST https://api.irisend.com/consents \
  -H "Authorization: Bearer $IRISEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "basis": "explicit_opt_in",
    "source": "signup-form",
    "consent_text": "I agree to receive product emails from Acme."
  }'
ResponseJSON
{ "object": "consent", "id": "9c1e6b2a-4f3d-4a9e-8b7c-1d2e3f4a5b6c", "email": "[email protected]", "status": "explicit_opt_in" }

soft_opt_in additionally requires metadata.order_id (or another sale reference key matching /order|sale|purchase|invoice|transaction/i) — soft opt-in is only valid when the address came from an actual transaction:

curl -X POST https://api.irisend.com/consents \
  -H "Authorization: Bearer $IRISEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "basis": "soft_opt_in",
    "source": "checkout",
    "consent_text": "Existing-customer soft opt-in per order #8841.",
    "metadata": { "order_id": "8841" }
  }'
POST/consents/:email/withdrawWithdraw consent

Body is optional — a bodyless call withdraws with source: "api".

curl -X POST https://api.irisend.com/consents/[email protected]/withdraw \
  -H "Authorization: Bearer $IRISEND_API_KEY"
ResponseJSON
{ "object": "consent", "email": "[email protected]", "status": "withdrawn" }
GET/consents/:emailRead consent status and history

status is one of explicit_opt_in, soft_opt_in, soft_opt_in_stale, withdrawn, or no_basis. A live soft_opt_in also carries valid_until. Events are returned oldest-first — the one ascending-order list in this API.

curl https://api.irisend.com/consents/[email protected] \
  -H "Authorization: Bearer $IRISEND_API_KEY"
ResponseJSON
{
  "object": "consent",
  "email": "[email protected]",
  "status": "explicit_opt_in",
  "events": [
    {
      "object": "consent_event",
      "id": "9c1e6b2a-4f3d-4a9e-8b7c-1d2e3f4a5b6c",
      "action": "granted",
      "basis": "explicit_opt_in",
      "source": "signup-form",
      "consent_text": "I agree to receive product emails from Acme.",
      "ip_address": null,
      "user_agent": null,
      "metadata": {},
      "occurred_at": "2026-09-25T09:00:12.481Z",
      "recorded_by": "api",
      "created_at": "2026-09-25T09:00:12.481Z"
    }
  ]
}