# emailTemplates query


`emailTemplates` is a GraphQL query 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).

Returns the e-mail templates: the MAX built-in templates first, then the organisation's own by
name. Use it to pick a template for [`sendEmail`](/chameleoon-max/mutation/send-email) or to find one to edit.

#### Permissions

Requires the `email.send` or `emailTemplate.manage` permission.

#### Cost

- A page costs 2 + first (or last) × the cost of one node.
- A variant's `htmlBody`, `textBody` and `design` cost 50 points each.
- `variants` costs 26 points plus 26 × one variant's selection.
- `texts` is a connection priced by the page you ask for, each key as 25 translations.
- `languages` and `allLanguages` read no body.

#### Paging

A connection, paged with `first`/`after` or `last`/`before`, at most 250 a page.
Pass exactly one of `first` or `last`, from 1 to 250. `first` (with `after`) pages
forward; `last` (with `before`) pages backward. `last` alone returns the last page.

## Arguments

- `first`: `Int`
- `after`: `String`
- `last`: `Int`
- `before`: `String`

## Returns

[`EmailTemplateConnection!`](/chameleoon-max/type/email-template-connection): a page of [`EmailTemplate`](/chameleoon-max/type/email-template).

## Example

**Query**

```graphql
query emailTemplates($first: Int) {
  emailTemplates(first: $first) {
    edges {
      cursor
    }
    nodes {
      id
      code
      name
      builtIn
      resourceKind
      syntax
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
  }
}
```

**Variables**

```json
{
  "first": 10
}
```

**Response**

```json
{
  "data": {
    "emailTemplates": {
      "edges": [
        {
          "cursor": "example"
        }
      ],
      "nodes": [
        {
          "id": "00000000-0000-4000-8000-000000000001",
          "code": "example",
          "name": "example",
          "builtIn": true,
          "resourceKind": "NONE",
          "syntax": "HTML"
        }
      ],
      "pageInfo": {
        "hasNextPage": true,
        "hasPreviousPage": true,
        "startCursor": "example",
        "endCursor": "example"
      }
    }
  }
}
```

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