> ## Documentation Index
> Fetch the complete documentation index at: https://docs.voyantcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Marketing Consent

> Update marketing consent status for a person (email or SMS).

## Method

`PATCH` `/v1/people/:id/consent`

## Path Parameters

<ParamField path="id" type="string" required>The person ID.</ParamField>

## Headers

<ParamField header="Authorization" type="string" required>Bearer token (requires `customers:write`).</ParamField>
<ParamField header="Content-Type" type="string" required>`application/json`</ParamField>

## Body Parameters

<ParamField body="channel" type="string" required>The consent channel: `email` or `sms`.</ParamField>
<ParamField body="granted" type="boolean" required>Whether consent is granted (`true`) or revoked (`false`).</ParamField>

## Request Example

<RequestExample>
  ```bash cURL (Grant Email Consent) theme={null}
  curl -X PATCH "https://api.voyantcloud.com/v1/people/people_01HZYPM2QF2R8X9SZQ0J9SYBCN/consent" \
    -H "Authorization: Bearer $VOYANT_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "channel": "email",
      "granted": true
    }'
  ```

  ```bash cURL (Revoke SMS Consent) theme={null}
  curl -X PATCH "https://api.voyantcloud.com/v1/people/people_01HZYPM2QF2R8X9SZQ0J9SYBCN/consent" \
    -H "Authorization: Bearer $VOYANT_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "channel": "sms",
      "granted": false
    }'
  ```

  ```javascript Node.js theme={null}
  const personId = "people_01HZYPM2QF2R8X9SZQ0J9SYBCN"

  // Grant email consent
  const res = await fetch(
    `https://api.voyantcloud.com/v1/people/${personId}/consent`,
    {
      method: "PATCH",
      headers: {
        Authorization: `Bearer ${process.env.VOYANT_API_KEY}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        channel: "email",
        granted: true,
      }),
    }
  )
  const result = await res.json()
  ```

  ```python Python theme={null}
  import os, requests

  person_id = "people_01HZYPM2QF2R8X9SZQ0J9SYBCN"

  # Grant email consent
  resp = requests.patch(
    f"https://api.voyantcloud.com/v1/people/{person_id}/consent",
    json={"channel": "email", "granted": True},
    headers={"Authorization": f"Bearer {os.environ['VOYANT_API_KEY']}"},
  )
  result = resp.json()
  ```
</RequestExample>

## Response Example

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "channel": "email",
    "granted": true,
    "updated_at": "2025-01-15T10:30:00.000Z"
  }
  ```

  ```json 404 Not Found theme={null}
  {
    "error": "Person not found"
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "error": "Invalid request body",
    "code": "VALIDATION_400",
    "details": [
      {
        "code": "invalid_enum_value",
        "message": "Invalid enum value. Expected 'email' | 'sms', received 'push'",
        "path": ["channel"]
      }
    ]
  }
  ```
</ResponseExample>

<Warning>
  Marketing consent is a legal requirement in many jurisdictions (GDPR, CAN-SPAM, etc.). Only send marketing communications to people who have granted consent. Always record the source of consent for compliance purposes.
</Warning>

<Tip>
  When integrating with external forms or signup flows, use this endpoint to record consent captured from those sources. The `source` field will be set to `api` for all updates made through this endpoint.
</Tip>
