## Dialog metadata

`POST /v1/openlines/dialogs/lookup`

Returns the metadata of a single Open Channel dialog by its identifier: name, type, line, message count and dates. The method does not return the correspondence — only the dialog card. Requires the `imopenlines` scope and applies the Bitrix24 permission model.

The method is handy as an analytics link: by `sessionId` (for example from the `id` field of [`POST /v1/openlines/sessions/search`](/docs/openlines/sessions)) it finds the dialog and its line, and the `lineId` field is the entry point to [`GET /v1/openline-configs/:id`](/docs/openlines/config/get).

## Request fields (body)

Exactly one identifier:

| Field | Type | Description |
|-------|------|-------------|
| `chatId` | number \| string | Chat identifier. A number (`2043`) and the `chat2043` form are both accepted |
| `dialogId` | string | The same chat in the `chat2043` form — an alternative to `chatId` |
| `sessionId` | number | Open Channel session identifier |

Pass one of the three fields. If both a chat identifier and a `sessionId` are given, the call returns `400 INVALID_PARAMS`.

## Response fields

| Field | Type | Description |
|-------|------|-------------|
| `id` | number | Chat identifier of the dialog |
| `dialogId` | string | Dialog identifier in the `chat<N>` form |
| `name` | string | Dialog name |
| `description` | string \| null | Description |
| `type` | string | Chat type (`lines` for Open Channels) |
| `entityType` | string | Entity type (`LINES`) |
| `messageCount` | number | Number of messages in the dialog |
| `lastMessageId` | number | Identifier of the last message |
| `dateCreate` | string | Creation date, ISO 8601 |
| `textFieldEnabled` | boolean | Whether the input field is available |
| `isNew` | boolean | New-dialog flag |
| `lineId` | number \| null | Line (configuration) identifier. `null` if it could not be determined |

## Examples

### curl — by chat identifier

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/openlines/dialogs/lookup" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "chatId": 2043 }'
```

### curl — by session identifier

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/openlines/dialogs/lookup" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "sessionId": 607 }'
```

### Response

```json
{
  "success": true,
  "data": {
    "id": 2043,
    "dialogId": "chat2043",
    "name": "Telegram: John",
    "description": null,
    "type": "lines",
    "entityType": "LINES",
    "messageCount": 36,
    "lastMessageId": 2109,
    "dateCreate": "2026-08-14T10:12:30+00:00",
    "textFieldEnabled": true,
    "isNew": false,
    "lineId": 1
  }
}
```

## Errors

| Code | HTTP | Reason |
|------|:----:|--------|
| `SCOPE_DENIED` | 403 | The key has no `imopenlines` scope |
| `MISSING_PARAMS` | 400 | No identifier was provided |
| `INVALID_PARAMS` | 400 | The identifier value is invalid, or both a chat and a session were passed |
| `ENTITY_NOT_FOUND` | 404 | The dialog was not found |
| `BITRIX_ACCESS_DENIED` | 403 | The key's user has no access to this dialog |
