
## Delete a line

`DELETE /v1/telephony-lines/:number`

Deletes an external application line by its `number` identifier. A deleted line cannot be restored via the API — create a new one with the same `number` if needed.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `number` (path) | string | yes | Line identifier set at creation. If it contains special characters — URL-encode it |

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/telephony-lines/sip-line-1" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/telephony-lines/sip-line-1" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const number = 'sip-line-1'
const res = await fetch(
  `https://vibecode.bitrix24.com/v1/telephony-lines/${encodeURIComponent(number)}`,
  {
    method: 'DELETE',
    headers: {
      'X-Api-Key': 'YOUR_API_KEY',
    },
  }
)

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

### JavaScript — OAuth application

```javascript
const number = 'sip-line-1'
const res = await fetch(
  `https://vibecode.bitrix24.com/v1/telephony-lines/${encodeURIComponent(number)}`,
  {
    method: 'DELETE',
    headers: {
      'X-Api-Key': 'YOUR_APP_KEY',
      'Authorization': 'Bearer USER_SESSION_TOKEN',
    },
  }
)

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

## Response

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

## Response example

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

## Error response example

422 — Bitrix24 error:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "External line not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 422 | `BITRIX_ERROR` | Bitrix24 returned an error — text in `error.message`. Occurs, among other cases, when attempting to delete a nonexistent line |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header was not provided |
| 401 | `INVALID_API_KEY` | Invalid API key |
| 401 | `TOKEN_MISSING` | The key has no configured tokens |
| 401 | `KEY_INACTIVE` | The API key is inactive or revoked |
| 403 | `SCOPE_DENIED` | The key lacks the `telephony` scope |
| 429 | `RATE_LIMITED` | Request rate limit exceeded |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable |

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

## See also

- [List application lines](./list.md) — find the `number` of the line you need before deletion
- [Add a line](./create.md) — create a new line with the same `number`
- [Update a line](./update.md) — `PATCH /v1/telephony-lines/:number`
