## List a chat's links

`GET /v1/chats/:chatId/links`

Returns a page of the links sent in the chat's messages: the same list as on the Links tab of the chat's side panel. The newest links come first.

## Parameters

| Parameter | Type | Required | Default | Description |
|----------|-----|:-----:|-----------|---------|
| `chatId` (path) | number | yes | — | Chat ID. Get it from [`GET /v1/chats/recent`](/docs/chats/discovery/recent) |
| `limit` (query) | number | no | 50 | How many links to return, from 1 to 200. An out-of-range value is clamped to the nearest bound, and the response then carries `meta.requestedLimit` and `meta.appliedLimit` |
| `offset` (query) | number | no | 0 | How many links to skip from the start of the list, a non-negative integer. For the next page, pass the number of links already received |
| `searchQuery` (query) | string | no | — | Returns only links whose address contains this text. A non-empty string of at most 255 characters |

Other query parameters and repeated ones are rejected with `400 INVALID_PARAMS`.

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/chats/1001/links?limit=50" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/chats/1001/links?limit=50" \
  -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/1001/links?limit=50', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { data } = await res.json()
console.log('Links:', data.list.map((link) => link.url.source))
```

### JavaScript — OAuth application

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

const { data } = await res.json()
console.log('Links:', data.list.map((link) => link.url.source))
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data.list` | array | The links on this page |
| `data.list[].id` | number | Link ID. Needed to [remove it from the list](/docs/chats/messages/links-delete) |
| `data.list[].messageId` | number | ID of the message that carries the link |
| `data.list[].chatId` | number | Chat ID |
| `data.list[].authorId` | number | ID of the message sender; the profile is in `data.users` |
| `data.list[].dateCreate` | string | When it was sent (ISO 8601) |
| `data.list[].url.source` | string | The link address as written in the message |
| `data.list[].url.richData` | object | Link preview data: `id`, `type`, `name`, `description`, `previewUrl`, `link`. For a link without a preview all fields are `null` |
| `data.users` | array | Message senders. Fields are those of a member in the [chat member list](/docs/chats/members/list): `id`, `name`, `firstName`, `lastName`, `active`, `type` and others |
| `data.tariffRestrictions.isHistoryLimitExceeded` | boolean | `true` when the plan hides part of the older chat history, and its links are not returned |
| `meta.requestedLimit` | number | The `limit` passed. Only when it is outside the 1–200 range |
| `meta.appliedLimit` | number | The `limit` applied after clamping. Only together with `meta.requestedLimit` |

## Response example

The employee profile is trimmed to the main fields:

```json
{
  "success": true,
  "data": {
    "users": [
      {
        "id": 6,
        "active": true,
        "name": "Anna Smith",
        "firstName": "Anna",
        "lastName": "Smith",
        "workPosition": "",
        "bot": false,
        "extranet": false,
        "status": "online",
        "type": "user"
      }
    ],
    "tariffRestrictions": {
      "isHistoryLimitExceeded": false
    },
    "list": [
      {
        "id": 12,
        "messageId": 34213,
        "chatId": 1001,
        "authorId": 6,
        "dateCreate": "2026-03-03T11:44:09+00:00",
        "url": {
          "source": "https://example.com/page",
          "richData": {
            "id": null,
            "type": null,
            "name": null,
            "description": null,
            "previewUrl": null,
            "link": null
          }
        }
      },
      {
        "id": 11,
        "messageId": 34211,
        "chatId": 1001,
        "authorId": 6,
        "dateCreate": "2026-03-03T11:43:35+00:00",
        "url": {
          "source": "https://example.com/notes",
          "richData": {
            "id": null,
            "type": null,
            "name": null,
            "description": null,
            "previewUrl": null,
            "link": null
          }
        }
      }
    ]
  }
}
```

With `limit=500` the response also carries `"meta": { "requestedLimit": 500, "appliedLimit": 200 }`.

## Error response example

400 — a parameter the method does not accept was passed:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Query parameter `lastId` is not accepted by GET /v1/chats/:chatId/links. Accepted: limit, offset, searchQuery."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_CHAT_ID` | `chatId` is not a positive integer. Checked before any call to Bitrix24 |
| 400 | `INVALID_PARAMS` | `limit` is not an integer, `offset` is not a non-negative integer, `searchQuery` is empty or longer than 255 characters, a parameter is repeated, or a parameter is unknown — the message names it and lists the accepted ones. Checked before any call to Bitrix24 |
| 422 | `BITRIX_ERROR` | `error.b24Code` is `ACCESS_ERROR` — the employee has no access to the chat, or there is no such chat |
| 404 | `ENTITY_NOT_FOUND` | Bitrix24 returned a generic "not found" error; the Bitrix24 code is in `error.b24Code` |
| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |
| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |

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

## Known specifics

**End of the list.** A page with fewer links than `limit` is the last one.

**Only the visible history is returned.** If the employee can see the chat history only from a certain point on — for example, they were added later without access to older messages — links before that point are not returned.

## See also

- [Number of a chat's links](/docs/chats/messages/links-count)
- [Remove a link from the list](/docs/chats/messages/links-delete)
- [Chat file list](/docs/chats/files/list)
- [Messages](/docs/chats/messages)
