
## Delete an automation rule

`DELETE /v1/bizproc-robots/:code`

Deletes a registered automation rule by code. A deleted automation rule cannot be restored through the API — register a new one if needed.

## Parameters

| Parameter | Type | Req. | Description |
|----------|-----|:-----:|---------|
| `code` (path) | string | yes | The automation rule code set at registration |

## Examples

Only an authorization key can delete an automation rule — 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-robots/deal_notify" \
  -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-robots/deal_notify', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

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

## Response

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

## Response example

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

## Error response example

422 — an automation rule with the given code was not found:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Activity or Robot not found!"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 403 | `OAUTH_REQUIRED` | The request was sent with an API key. Only an authorization key can delete automation rules |
| 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 |
| 422 | `BITRIX_ERROR` | Bitrix24 did not find an automation rule with the given code or rejected the deletion — reason in `error.message` |

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

## See also

- [Register an automation rule](/docs/entities/bizproc-robots/create)
- [Update an automation rule](/docs/entities/bizproc-robots/update)
- [Keys and authorization](/docs/keys-auth)
