## Delete a saved block template

`DELETE /v1/block-repository/favorites/:blockId`

Permanently deletes a saved template created by the current Bitrix24 user. Use blockId from [Save a block](/docs/entities/pages/favorite), not a regular page block ID. Missing templates, repeated deletion and regular page blocks return 404 ENTITY_NOT_FOUND. Other users templates cannot be deleted: Bitrix24 checks permissions.

Requires the `landing` scope; READONLY keys receive 403 before mutation. Page-scoped actions check that the block belongs to the page.

Optional query `scope`: `KNOWLEDGE`, `GROUP` or `MAINPAGE` for that page context; omit for a regular site. IDs must be positive safe integers.

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/block-repository/favorites/50" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### JavaScript — personal key

```javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/block-repository/favorites/50", {
  method: "DELETE",
  headers: {"X-Api-Key": "YOUR_API_KEY"},
})
const result = await response.json()
if (!response.ok) throw new Error(result.error.message)
console.log(result.data)
```

### curl — OAuth application

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/block-repository/favorites/50" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — OAuth application

```javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/block-repository/favorites/50", {
  method: "DELETE",
  headers: {"X-Api-Key": "YOUR_APP_KEY", "Authorization": "Bearer USER_SESSION_TOKEN"},
})
const result = await response.json()
if (!response.ok) throw new Error(result.error.message)
console.log(result.data)
```

## Response

```json
{
  "success": true,
  "data": {
    "blockId": 50,
    "deleted": true
  }
}
```

## Errors

| HTTP | Code |
|---|---|
| 400 | INVALID_PARAMS / MISSING_REQUIRED_FIELDS / INVALID_SCOPE |
| 401 | MISSING_API_KEY / INVALID_API_KEY / TOKEN_MISSING |
| 403 | SCOPE_DENIED / WRITE_BLOCKED_READONLY_KEY / BITRIX_ACCESS_DENIED |
| 404 | ENTITY_NOT_FOUND |
| 409 | PORTAL_ADDRESS_CHANGED / LANDING_MODULE_NOT_ENABLED |
| 422 | BITRIX_ERROR / BITRIX_NO_EFFECT |
| 429 | RATE_LIMITED |
| 502 | BITRIX_ERROR |
| 503 | SERVICE_UNAVAILABLE |
