# Change a template

`PUT /mail/templates/{id}` · Rivier · campaigns

Change a template. This saves a new version; earlier versions stay and can be restored.

- Scope: campaigns:write
- Graphql: Mutation.campaignsMailTemplateUpdate
- Sdk: mail.templates.update
- Cli: mail template-update

## Parameters

- `id` (path, required), string

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "kind": {
      "type": "string",
      "enum": [
        "transactional",
        "marketing",
        "partial"
      ]
    },
    "language": {
      "type": "string",
      "maxLength": 20,
      "description": "en, dv, ar, ...; sets the direction and footer words of group mail"
    },
    "subject": {
      "type": "string",
      "maxLength": 998
    },
    "html": {
      "type": "string",
      "maxLength": 1000000
    },
    "text": {
      "type": "string",
      "maxLength": 1000000
    },
    "testData": {
      "type": "object",
      "additionalProperties": {},
      "description": "Sample values used by the preview"
    },
    "note": {
      "type": "string",
      "maxLength": 200
    },
    "share": {
      "type": "string",
      "enum": [
        "project",
        "organization"
      ],
      "description": "organization: every project of the organization can use it"
    }
  },
  "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 PUT 'https://api.rivier.ai/mail/templates/{id}' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "kind": "transactional",
  "language": "string",
  "subject": "string",
  "html": "string",
  "text": "string",
  "testData": {},
  "note": "string"
}'
```
