# Desktop app logout

Marks the caller's desktop app and the caller themselves "offline" in the messenger — as the Bitrix24 desktop app does when it logs out. Bitrix24 sessions are not ended.

## Mark the logout

`POST /v1/chats/desktop/logout`

The v2 messenger method `im.v2.Desktop.logout`.

## Parameters

There are no parameters. Any body field or query parameter is rejected with `400 INVALID_PARAMS`.

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/chats/desktop/logout" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

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

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

### JavaScript — OAuth application

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

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | array | An empty array — that is how Bitrix24 answers |

## Response example

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

## Error response example

400 — a body field was passed:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Body field `dialogId` is not accepted by POST /v1/chats/desktop/logout. It takes no body fields."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | A body field or query parameter was passed — the operation accepts none |
| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |
| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only |
| 422 | `BITRIX_ERROR` | Bitrix24 returned an error; the portal code is in `error.b24Code` |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |

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

## Known specifics

- The call does not sign out of Bitrix24 and does not revoke keys — only the presence status changes.
- Any subsequent messenger call from the same user, such as a request for the [update state](/docs/chats/service/state), marks them "online" again.

## See also

- [Update state](/docs/chats/service/state)
- [User status](/docs/chats/settings/status)
- [Service methods](/docs/chats/service)
