## Remove a link from the list

`DELETE /v1/chats/links/:linkId`

Removes a link from the chat's link list — the Links tab of the side panel. The message that carries the link stays unchanged.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `linkId` (path) | number | yes | Link ID, a positive integer — the `id` field from the [chat's link list](/docs/chats/messages/links) |

No body and no query parameters are accepted: any body field or query parameter is rejected with `400 INVALID_PARAMS`.

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/chats/links/12" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/chats/links/12" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/links/12', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success } = await res.json()
console.log('Removed:', success)
```

### JavaScript — OAuth application

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

const { success } = await res.json()
console.log('Removed:', success)
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | boolean | `true` — the link is removed from the list |

## Response example

```json
{
  "success": true,
  "data": true
}
```

## Error response example

422 — there is no link with this ID:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Url not found",
    "b24Code": "URL_NOT_FOUND"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | `linkId` is not a positive integer, or a body field or query parameter was passed. Checked before any call to Bitrix24 |
| 422 | `BITRIX_ERROR` | `error.b24Code` is `URL_NOT_FOUND` — there is no link with this ID |
| 422 | `BITRIX_ERROR` | `error.b24Code` is `URL_ACCESS_ERROR` — another employee sent the link, and the current employee is not a Bitrix24 account administrator |
| 422 | `BITRIX_ERROR` | `error.b24Code` is `ACCESS_ERROR` — the employee has no access to the link's chat |
| 404 | `ENTITY_NOT_FOUND` | Bitrix24 returned a generic "not found" error; the code is in `error.b24Code` |
| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | A read-only key cannot remove links — see [access rights](/docs/access-rights) |
| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |

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

## See also

- [List a chat's links](/docs/chats/messages/links)
- [Number of a chat's links](/docs/chats/messages/links-count)
- [Messages](/docs/chats/messages)
