# Delete a template

> operationId: `deleteTemplate`


## Request

This endpoint deletes a template. It has no request body and does not require X-RPA-Catalog-Revision. A template that other templates pin as a child template is still deleted directly. The deletion is not blocked, and parent templates are not modified in cascade. After that, validating or running a parent template, or creating a schedule from it, returns 409 RPA_DEPENDENCY_UNAVAILABLE, and the parent template's reference must be updated. Frozen snapshots and history of existing runs and schedules are kept. New runs cannot find the template. The original deletion receipt remains eligible for replay even though the resource has been deleted.

- **Prerequisites**: You have read the target template and its ETag. Confirm that the user requested this deletion.
- **Authentication**: Same as the rest of the Local API; see [Authentication](/api-reference/getting-started/authentication). Resources belong to the current account/team data scope.
- **Side effects**: The call deletes the template from Custom Templates in the client (a personal cloud template). It does not cascade the deletion to parent templates that reference it, and it does not cancel existing frozen runs.
- **Completion signal**: 200 with data.deleted=true means that the deletion is complete.
- **Retries**: To recover the same intent, reuse the original key, the original body (if any), and the original If-Match (when the endpoint requires it). After an HTTP timeout, first [check the request receipt](/browser-rpa/api/get-request-receipt). Do not generate a new key.


### Endpoint

```http
DELETE /api/rpa/browser/v1/templates/{templateId}
```

Local API: `http://127.0.0.1:<port>/api/rpa/browser/v1/templates/{templateId}`. Use the port configured in the client.

### Headers

| Parameter | Type | Required | Description and constraints |
|  --- | --- | --- | --- |
| `Authorization` | string | When Local API authentication is enabled | See [Authentication](/api-reference/getting-started/authentication). |
| `Idempotency-Key` | string | No | Recommended. Generate a UUID for each new write intent and keep it when you retry after a disconnect; the same key never runs twice. Without it there is no duplicate protection, so a retry after a timeout can run the write again. When present, it must be a UUID. Format "uuid" |
| `If-Match` | string | Yes | Exact ETag from the template response. Wildcard and multiple values are rejected. |


### Path parameters

| Parameter | Type | Required | Description and constraints |
|  --- | --- | --- | --- |
| `templateId` | string | Yes | Target template ID (the cloud ID of the template in Custom Templates in the client, a numeric string). Min length 1; max length 128 |


### Query parameters

None.

### Request body

No request body.

### Request example

This is a documentation example; it was not sent to a live client. Set `RPA_BASE_URL` as described in [API conventions](/browser-rpa/api/common). Resource variables, the catalog revision, and ETags come from actual responses.

```bash
curl -i -X DELETE "${RPA_BASE_URL}/templates/${RPA_TEMPLATE_ID}" \
  -H "Idempotency-Key: ${RPA_REQUEST_KEY}" \
  -H "If-Match: ${RPA_ETAG}"
```

## Response

### 200

200 with data.deleted=true means that the deletion is complete.

Body: `application/json`. The top-level `data` uses the model below. For `meta`, see [Metadata](/browser-rpa/api/data-types#metadata).

| Field | Type | Required | Description and constraints |
|  --- | --- | --- | --- |
| `id` | string | Yes | Unique ID of the resource or node. Take it from a previous response; don't guess it. Min length 1; max length 128. |
| `deleted` | `true` | Yes | See the model definition. |


### Response example

All IDs, timestamps, hashes, and run results are sample data. They don't indicate that the sample was executed.

```json
{
  "data": {
    "id": "template_example",
    "deleted": true
  },
  "meta": {
    "requestId": "7d498f20-7bab-4e59-9b05-88daf51230e9",
    "catalogRevision": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
  }
}
```

### Error responses

| HTTP | error.code | What to do |
|  --- | --- | --- |
| 428 | RPA_PRECONDITION_REQUIRED | If-Match is missing. Read the template first. |
| 412 | RPA_VERSION_CONFLICT | Check the original receipt first. After you confirm that the request was not committed, read the template again and merge, then use a new key for the modified intent. |
| 409 | RPA_REQUEST_CONFLICT | The method/path/body/If-Match sent with the same key differs from the original intent. |
| 504 | RPA_REQUEST_TIMEOUT | This only means that the HTTP wait timed out. Check the original request receipt first. |


A write replayed with the same key keeps the ETag of the original response (if there was one; it may be out of date). The receipt contains only data, not response headers. To continue editing, send a GET first; see [API conventions](/browser-rpa/api/common).

For common 400/401/403/404/429/5xx errors and failure fields, see [Errors and recovery](/browser-rpa/api/common#errors-and-recovery). Error response example (403):

```json
{
  "error": {
    "code": "RPA_PERMISSION_DENIED",
    "message": "The request Host or Origin is not allowed, or the current identity can't access the target environment",
    "retryable": false,
    "issues": [],
    "details": null
  },
  "meta": {
    "requestId": "7d498f20-7bab-4e59-9b05-88daf51230e9",
    "catalogRevision": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
  }
}
```

## Related

[Local API reference](/browser-rpa/local-api) · [API conventions](/browser-rpa/api/common) · [Data models](/browser-rpa/api/data-types) · [Workflow structure](/browser-rpa/api/workflow) · [Quickstart](/browser-rpa/quickstart)