
## Delete a template

`DELETE /v1/bizproc-templates/:id`

Deletes a business process template uploaded by the same application. A deleted template cannot be restored through the API — upload the file again if needed.

## Parameters

| Parameter | Type | Req. | Description |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Template identifier. Source: [`GET /v1/bizproc-templates`](./list.md) |

## Examples

Only an authorization key can delete templates — both examples send the authorization key and the `Authorization: Bearer` header. The session token is issued by OAuth authorization, is valid for 24 hours, and cannot be renewed — [Passing the key](/docs/keys-auth#passing-the-key).

### curl — authorization key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/bizproc-templates/1215" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — authorization key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/bizproc-templates/1215', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

if (res.status === 204) {
  console.log('Template deleted')
}
```

## Response

On successful deletion, HTTP status `204 No Content` is returned with an empty body — success is indicated by the status code.

## Response example

```http
HTTP/1.1 204 No Content
```

## Error response example

422 — the template was uploaded by another application or created in the Bitrix24 designer:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "You can delete ONLY templates created by current application"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 422 | `BITRIX_ERROR` | The template was uploaded by another application — message `You can delete ONLY templates created by current application` |
| 422 | `BITRIX_ERROR` | No template with the given `id`, or it is already deleted — message `Workflow template not found.`, the `b24Code` field contains `ERROR_TEMPLATE_NOT_FOUND` |
| 403 | `OAUTH_REQUIRED` | The request was sent with an API key. Only an authorization key can delete templates |
| 401 | `TOKEN_MISSING` | Authorization key without the `Authorization: Bearer` header |
| 401 | `WRONG_AUTH_SCHEME` | The authorization key was sent in the `Authorization: Bearer` header. The key goes in `X-Api-Key`, while `Authorization: Bearer` carries the session token |
| 401 | `INVALID_SESSION` | The session token has expired or is invalid — authorize again |
| 403 | `SCOPE_DENIED` | The key lacks the `bizproc` scope |

On a Bitrix24-side error the `error` object gains a `b24Code` field — the machine-readable reason code.

The full list of common API errors — [Errors](/docs/errors).

## Known specifics

**Only your own templates can be deleted.** You can delete a template uploaded by the same application whose authorization key sends the request. Templates from the Bitrix24 designer and templates of other applications return `422` and remain in your Bitrix24 account.

## See also

- [Template list](/docs/entities/bizproc-templates/list)
- [Template fields](/docs/entities/bizproc-templates/fields)
- [Upload a template](/docs/entities/bizproc-templates/create)
- [Update a template](/docs/entities/bizproc-templates/update)
- [Keys and authorization](/docs/keys-auth)
