# createPrintTemplate mutation


`createPrintTemplate` 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).

Creates a print template. Call it to store a layout of your own for a kind of document.

#### Permissions

Requires the `company.write` permission on an API key that no legal-entity scope narrows,
because a template prints the documents of every company.

#### Errors

| Code | Reason | When |
| --- | --- | --- |
| `CONFLICT` | `DUPLICATE_NAME` | An active template of the same name, kind and language exists. |
| `CONFLICT` | `DEFAULT_TAKEN` | Another write made a template the default at the same moment. Try again. |
| `VALIDATION` | `TEMPLATE_INVALID` | The renderer refuses the `body`. `extensions.problems` lists each problem as `{path, message}`. |
| `VALIDATION` | `TOO_LARGE` | The `body` is over 512 KiB. |

## Arguments

- `input`: [`CreatePrintTemplateInput!`](/chameleoon-max/type/create-print-template-input) · required

## Returns

[`PrintTemplate!`](/chameleoon-max/type/print-template)

## Example

**Mutation**

```graphql
mutation createPrintTemplate($input: CreatePrintTemplateInput!) {
  createPrintTemplate(input: $input) {
    id
    kind
    syntax
    output
    language
    name
    isDefault
    bodyBytes
    body
    archivedAt
    createdAt
    updatedAt
  }
}
```

**Variables**

```json
{
  "input": {
    "kind": "SALES_ORDER",
    "language": "example",
    "name": "example",
    "body": "example"
  }
}
```

**Response**

```json
{
  "data": {
    "createPrintTemplate": {
      "id": "00000000-0000-4000-8000-000000000001",
      "kind": "SALES_ORDER",
      "syntax": "JSON",
      "output": "PDF",
      "language": "example",
      "name": "example",
      "isDefault": true,
      "bodyBytes": 1,
      "body": "example",
      "archivedAt": "2026-01-01T00:00:00Z",
      "createdAt": "2026-01-01T00:00:00Z",
      "updatedAt": "2026-01-01T00:00:00Z"
    }
  }
}
```

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