# Record how and where a person agreed to receive messages

`POST /phone/opt-in` · Rivier · voice

Record how and where a person agreed to receive messages. Needed before marketing and before a WhatsApp template to someone who has not written first.

- Scope: voice:write
- Mcp: rivier_phone_opt_in
- Graphql: Mutation.voicePhoneContactOptIn
- Sdk: voice.phoneContact.optIn
- Cli: voice phone contact opt in

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "peer": {
      "type": "string",
      "pattern": "^\\+\\d{6,15}$"
    },
    "channel": {
      "type": "string",
      "enum": [
        "sms",
        "mms",
        "whatsapp"
      ],
      "default": "sms"
    },
    "source": {
      "type": "string",
      "minLength": 3,
      "maxLength": 300
    }
  },
  "required": [
    "peer",
    "source"
  ],
  "additionalProperties": false
}
```

## Responses

- `200`: 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/phone/opt-in' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "peer": "string",
  "source": "string"
}'
```
