# Send a text, a picture message or a WhatsApp message

`POST /phone/messages` · Rivier · voice

Send a text, a picture message or a WhatsApp message. Checks opt-out, agreement, the WhatsApp window, the country's rules and the plan allowance first, and refuses with a plain reason and the next step rather than dropping anything. Marketing needs the person's recorded agreement.

- Scope: voice:write
- Mcp: rivier_phone_send
- Graphql: Mutation.voicePhoneMessageSend
- Sdk: voice.phoneMessage.send
- Cli: voice phone message send

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "to": {
      "type": "string",
      "pattern": "^\\+\\d{6,15}$"
    },
    "channel": {
      "type": "string",
      "enum": [
        "sms",
        "mms",
        "whatsapp"
      ]
    },
    "body": {
      "type": "string",
      "maxLength": 1600
    },
    "mediaUrls": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uri"
      },
      "maxItems": 10
    },
    "templateId": {
      "type": "string",
      "maxLength": 80
    },
    "variables": {
      "type": "object",
      "additionalProperties": {
        "type": "string",
        "maxLength": 1000
      }
    },
    "senderId": {
      "type": "string",
      "maxLength": 80
    },
    "serviceId": {
      "type": "string",
      "maxLength": 80
    },
    "purpose": {
      "type": "string",
      "enum": [
        "service",
        "marketing"
      ]
    },
    "idempotencyKey": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    }
  },
  "required": [
    "to"
  ],
  "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/phone/messages' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "to": "string"
}'
```
