---
title: "Delete template file"
type: reference
method: POST
path: /rest-api/template/template-file/delete.do
tag: "Templates"
---

# Delete template file

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

Removes a specific file from the given template by its file ID. The template version is automatically incremented after the file is removed, which invalidates any cached template content. Returns a JSON object with a 'success' boolean indicating whether the file was found and deleted. Requires edit permission on the template through ownership or sharing; returns permissionDenied if the caller lacks write access.

## Form params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `templateId` | integer | yes | `300` | Unique numeric identifier of the template that contains the file to be deleted |
| `id` | integer | yes | `123` | Unique numeric identifier of the template file to delete |

## Responses

- `200` — Operation result with success status
- `400` — Bad request — invalid or missing parameters
- `401` — Authentication error
- `403` — Forbidden — insufficient permissions

## Example request

```bash
curl --request POST \
  --url 'https://YOUR-NETWORK-DOMAIN/rest-api/template/template-file/delete.do' \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'templateId=300' \
  --data-urlencode 'id=123'
```

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