---
title: "Create or update template"
type: reference
method: POST
path: /rest-api/template/edit.do
tag: "Templates"
---

# Create or update template

`POST https://YOUR-NETWORK-DOMAIN/rest-api/template/edit.do`

Creates a new creative template or updates an existing one. When the 'id' parameter is provided, the existing template is updated; otherwise a new template is created. The template version is automatically incremented on each save. Returns the saved template object on success.

## Form params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `id` | integer | no | `12` | ID of the template — omit on edit to create a new template; delete and export need it |
| `active` | boolean | no | `true` | Whether the template is active |
| `alwaysRedirect` | boolean | no | `false` | Whether the template always uses redirect mode for click tracking |
| `content` | string | no | `<div>{{BANNER}}</div>` | Template HTML/JS content body |
| `global` | boolean | no | `false` | Whether this is a global (system-wide) template |
| `impressionRecordedByTemplate` | boolean | no | `false` | Whether impression tracking is handled by the template itself |
| `maxRequiredNativeAdsAmount` | integer | no | `1` | Maximum number of native ads supported by this template |
| `minRequiredNativeAdsAmount` | integer | no | `1` | Minimum number of native ads required by this template |
| `placementType` | string | no | `SITE_PLACEMENT` | Placement type this template applies to |
| `title` | string | no | `Standard Banner 300x250` | Template title |
| `type` | string | no | `GENERAL` | Template type |

## Responses

- `200` — Template saved successfully
- `400` — Bad request — invalid or missing parameters
- `401` — Authentication error
- `403` — Insufficient permissions

## Example request

```bash
curl --request POST \
  --url 'https://YOUR-NETWORK-DOMAIN/rest-api/template/edit.do' \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'id=12' \
  --data-urlencode 'placementType=SITE_PLACEMENT' \
  --data-urlencode 'type=GENERAL' \
  --data-urlencode 'active=true'
```

Source: https://epom.com/ad-server/docs/api/templates/post-template-edit