## Revoke a guest link

`DELETE /v1/chats/:dialogId/guest-links`

Revokes your guest link to the chat: its URL can no longer be used to join the chat. The link code is not needed; the dialog ID is enough.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `dialogId` (path) | string | yes | Dialog ID: `chatXXX` for a group chat, a numeric user ID for a private chat, `me` — your personal dialog. List — [`GET /v1/chats/recent`](/docs/chats/discovery/recent) |

The request takes no body: body fields and query parameters are rejected with `400 INVALID_PARAMS`.

## Examples

### curl — personal key

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

### curl — OAuth application

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/chats/chat42/guest-links" \
  -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/chat42/guest-links', {
  method: 'DELETE',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

const { data } = await res.json()
console.log('Revoked:', data.result)
```

### JavaScript — OAuth application

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

const { data } = await res.json()
console.log('Revoked:', data.result)
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data.result` | boolean | `true` — the link is revoked |

## Response example

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

## Error response example

422 — there is no valid guest link:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "SHARING_LINK_NOT_FOUND",
    "b24Code": "SHARING_LINK_NOT_FOUND"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | A body field or a query parameter was passed. Checked before any call to Bitrix24 |
| 422 | `BITRIX_ERROR` | Bitrix24 returned an error; the portal code is in `error.b24Code`. `SHARING_LINK_NOT_FOUND` — you have no valid guest link, `GUEST_FEATURE_DISABLED` — guests are disabled on the portal, `CHAT_NOT_FOUND` — the chat does not exist on the portal |
| 404 | `ENTITY_NOT_FOUND` | Bitrix24 answered with an unspecified "not found" code; the portal code is in `error.b24Code` |
| 502 | `ME_ALIAS_RESOLUTION_FAILED` | Failed to resolve the user for the `me` alias |
| 403 | `BITRIX_ACCESS_DENIED` | No right to manage the chat's guest links — Bitrix24 refused with the `ACCESS_DENIED` code |
| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only — see [access rights](/docs/access-rights) |
| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |

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

## Known specifics

**Automatic chat membership.** The call can make the key owner a member of a chat that allows auto-join, even if the link operation is subsequently refused. A read-only key is blocked before Bitrix24 is called.

**The revocation is visible in the chat.** After revocation, a system message saying that you revoked the guest link appears in the chat, and all members see it.

**Guests who already joined are removed.** Revocation closes the old URL to new guests and removes from the chat guests who joined through it. Personal email and SMS invitations remain valid until `dateExpire`.

## See also

- [Get a guest link](/docs/chats/sharing/guest-link)
- [Regenerate a guest link](/docs/chats/sharing/guest-link-regenerate)
- [Revoke a link by code](/docs/chats/sharing/link-revoke)
- [Links and guests](/docs/chats/sharing)
