# setEmailTemplateTexts mutation


`setEmailTemplateTexts` is a GraphQL mutation of the Chameleoon MAX API. Send it as `POST https://max-api.chameleoon.sk/api/v1/graphql` with your API key, see [Chameleoon MAX](/chameleoon-max).

Replaces the template's whole dictionary of texts. Call it with the `version` you read.

- Requires the `emailTemplate.manage` permission.
- A blank value is dropped.
- A value with a Liquid `{% %}` tag, or one that does not parse, is refused with `VALIDATION`, reason
  `TEMPLATE_ERROR`, `extensions.part` `texts` and the key in `extensions.key`.
- `CONFLICT` with reason `TEMPLATE_CHANGED` when somebody saved the template after you read it.

## Arguments

- `input`: [`SetEmailTemplateTextsInput!`](/chameleoon-max/type/set-email-template-texts-input) · required

## Returns

[`EmailTemplate!`](/chameleoon-max/type/email-template)

## Example

**Mutation**

```graphql
mutation setEmailTemplateTexts($input: SetEmailTemplateTextsInput!) {
  setEmailTemplateTexts(input: $input) {
    id
    code
    name
    builtIn
    resourceKind
    syntax
    variants {
      language
      subject
      htmlBody
      textBody
      design
    }
    languages
    allLanguages
    texts(first: 10) {
      totalCount
    }
    defaultTo
    defaultCc
    defaultBcc
    defaultAttachments
    copiedFrom
    version
  }
}
```

**Variables**

```json
{
  "input": {
    "code": "example",
    "version": 1,
    "texts": [
      {
        "key": "example",
        "translations": [
          {
            "language": "example",
            "value": "example"
          }
        ]
      }
    ]
  }
}
```

**Response**

```json
{
  "data": {
    "setEmailTemplateTexts": {
      "id": "00000000-0000-4000-8000-000000000001",
      "code": "example",
      "name": "example",
      "builtIn": true,
      "resourceKind": "NONE",
      "syntax": "HTML",
      "variants": [
        {
          "language": "example",
          "subject": "example",
          "htmlBody": "example",
          "textBody": "example",
          "design": {}
        }
      ],
      "languages": [
        "example"
      ],
      "allLanguages": true,
      "texts": {
        "totalCount": 1
      },
      "defaultTo": "CUSTOMER",
      "defaultCc": [
        "example"
      ],
      "defaultBcc": [
        "example"
      ],
      "defaultAttachments": [
        "ORDER_INVOICE_PDF"
      ],
      "copiedFrom": "example",
      "version": 1
    }
  }
}
```

Values are illustrative: replace IDs and codes with your own before you send the call.
