
## Search pages

`POST /v1/pages/search`

Returns a list of pages by a filter in the request body. Compared with [`GET /v1/pages`](./list.md) it is more convenient for complex conditions: parameters are passed in JSON, and you can use nested operators (`>=`, `<=`, `!`, `in`) in MongoDB style.

## Request fields (body)

| Field | Type | Default | Description |
|------|-----|-----------|---------|
| `filter` | object | — | Filter by the page's key fields.<br>[Filtering syntax](/docs/filtering). Example: `{"filter": {"siteId": 3}}` |
| `select` | string[] | — | List of fields to return. Without `select` the response contains the full set of page fields in camelCase (as in the card) |
| `limit` | number | `50` | Number of records (up to 5000) |
| `offset` | number | `0` | Skip N records |
| `scope` | string | — | Internal landing area: `KNOWLEDGE` / `GROUP` / `MAINPAGE`. Without the parameter, pages of regular landing sites are returned. Accepted at the top level of the body (`"scope": "KNOWLEDGE"`) or inside `filter.scope` — both forms produce the same request to Bitrix24 |

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/pages/search" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": { "siteId": 3 },
    "select": ["id", "title", "code", "siteId", "active", "dateModify"],
    "limit": 10
  }'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/pages/search" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": { "siteId": 3 },
    "select": ["id", "title", "code", "siteId", "active", "dateModify"],
    "limit": 10
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/pages/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    filter: { siteId: 3 },
    select: ['id', 'title', 'code', 'siteId', 'active', 'dateModify'],
    limit: 10,
  }),
})

const { success, data, meta } = await res.json()
console.log(`Found ${meta.total} pages in ${meta.durationMs} ms`)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/pages/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    filter: { siteId: 3 },
    select: ['id', 'title', 'code', 'siteId', 'active', 'dateModify'],
    limit: 10,
  }),
})

const { success, data, meta } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | array | Array of found pages |
| `data[].id` | number | Page identifier |
| `data[].title` | string | Page title |
| `data[].code` | string | Symbolic code of the page |
| `data[].siteId` | number | Site identifier |
| `data[].active` | boolean | Whether the page is active |
| `data[].description` | string \| null | Arbitrary description |
| `data[].createdById` | number | Identifier of the employee who created it |
| `data[].dateCreate` | datetime | Creation date |
| `data[].dateModify` | datetime | Last modification date |
| `meta.total` | number | Total number of records matching the filter |
| `meta.hasMore` | boolean | Whether there are more records beyond `limit` |
| `meta.durationMs` | number | Request execution time (ms) |

The URL of any page from the `data` array is built from its `id` and `siteId`:

```
https://<portal>.bitrix24.com/sites/site/<siteId>/view/<id>/
```

`<siteId>` — ID of the site the page belongs to (the `siteId` field of each item). `<portal>` — the Bitrix24 account domain. Access is restricted by the employee's permissions in Bitrix24.

## Response example

```json
{
  "success": true,
  "data": [
    {
      "id": 3,
      "title": "Title change",
      "code": "promo-page",
      "siteId": 3,
      "active": true,
      "description": null,
      "createdById": 1,
      "dateCreate": "22.04.2020 14:39:17",
      "dateModify": "06.05.2024 15:43:27"
    },
    {
      "id": 7,
      "title": "Test page",
      "code": "test",
      "siteId": 3,
      "active": true,
      "description": null,
      "createdById": 1,
      "dateCreate": "25.05.2020 17:34:17",
      "dateModify": "10.10.2022 15:25:30"
    }
  ],
  "meta": {
    "total": 13,
    "hasMore": true,
    "durationMs": 171
  }
}
```

## Error response example

422 — a nonexistent field in the filter:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Unknown field definition `nonsense` (nonsense) for \\Bitrix\\Landing\\Internals\\Landing Entity."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 422 | `BITRIX_ERROR` | An unknown field in `filter` or another parameter not supported by Bitrix24 was passed |
| 403 | `SCOPE_DENIED` | The API key does not have the `landing` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |

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

## Known specifics

**When to choose `search` versus `list`.** Both endpoints return the same set of pages by a filter. Use `POST /v1/pages/search` when the filter is more complex than equality (for example, `id in [3, 7, 9]`) — a JSON body escapes nested operators more conveniently. For simple `filter[field]=value` cases, `GET /v1/pages` is enough.

**Date format in the filter.** Dates in the filter are accepted only in the Bitrix24 format `DD.MM.YYYY HH:MM:SS`, **not** ISO 8601. `{">=dateModify": "06.06.2026 00:00:00"}` works. The ISO value `{">=dateModify": "2026-06-06"}` is accepted without error but produces an incorrect result — Bitrix24 does not recognize it. The same `DD.MM.YYYY HH:MM:SS` format is also returned in the response, see the `dateCreate`/`dateModify` fields.

**`meta.durationMs`.** Unlike list, search always returns the request duration in milliseconds — useful when debugging performance.

**Pagination via `offset` is supported.** Vibecode returns the requested `[offset, offset + limit)` window. The `meta.total` value is the exact number of records matching the filter, and `meta.hasMore` shows whether there are records beyond the window.

## See also

- [List pages](/docs/entities/pages/list) — `GET` counterpart for simple filters
- [Get a page](/docs/entities/pages/get) — data of a single page by ID
- [Filtering syntax](/docs/filtering)
- [Limits and optimization](/docs/optimization)
