# Contacts consent record

`POST /crm/contacts/{id}/consent` · Rivier · contacts

Record a consent decision with its proof (the words, the source, the policy version).

- Scope: contacts:write
- Graphql: Mutation.contactsConsentRecord
- Sdk: contacts.consent.record
- Cli: contacts consent record
- Events: contacts.consent.recorded

## Parameters

- `id` (path, required), string

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "channel": {
      "type": "string",
      "enum": [
        "email",
        "sms",
        "whatsapp",
        "phone"
      ]
    },
    "purpose": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_]{0,29}$",
      "default": "marketing"
    },
    "state": {
      "type": "string",
      "enum": [
        "granted",
        "withdrawn",
        "denied",
        "pending"
      ]
    },
    "source": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "policyVersion": {
      "type": "string",
      "maxLength": 40
    },
    "ip": {
      "type": "string",
      "maxLength": 64
    },
    "userAgent": {
      "type": "string",
      "maxLength": 300
    },
    "proof": {
      "type": "object",
      "additionalProperties": {}
    },
    "at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "channel",
    "state",
    "source"
  ],
  "additionalProperties": false
}
```

## Responses

- `201`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X POST 'https://api.rivier.ai/crm/contacts/{id}/consent' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "channel": "email",
  "state": "granted",
  "source": "string"
}'
```
