# Create or change an unsubscribe group

`POST /mail/groups` · Rivier · campaigns

Create or change an unsubscribe group. The group is the consent purpose email.<id>, so the preference page and one-click unsubscribe already honour it.

- Scope: campaigns:write
- Graphql: Mutation.campaignsMailGroupSave
- Sdk: mail.groups.save
- Cli: mail group-save

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 40,
      "description": "Lower-case letters, digits, dashes; the consent purpose is email.<id>"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "description": {
      "type": "string",
      "maxLength": 300
    },
    "kind": {
      "type": "string",
      "enum": [
        "service",
        "marketing"
      ],
      "description": "marketing needs the person's granted consent; service (receipts, security) does not, but honours a full unsubscribe"
    },
    "isDefault": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "name"
  ],
  "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/mail/groups' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "string",
  "name": "string"
}'
```
