## Folder search

`POST /v1/folders/search`

Lists folder contents via a POST request with a filter in the body. Behavior matches [`GET /v1/folders`](./list.md) — parameters are passed in the body rather than in the query string. The filter must contain `parentId`.

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|---------|
| `filter` | object | yes | Selection conditions. Must contain `parentId` — the ID of the folder whose contents are listed.<br>[Filtering syntax](/docs/filtering). Example: `{"parentId":27,"type":"folder"}` |
| `select` | array | no | List of returned fields. Example: `["id","name"]` |
| `order` | object | no | Sort by field. Example: `{"name":"asc"}` |
| `limit` | number | no | How many records to return. Default 50, maximum 5000 |
| `offset` | number | no | Offset for paginated selection |

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/folders/search" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"filter":{"parentId":27,"type":"folder"},"limit":10}'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/folders/search" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"filter":{"parentId":27,"type":"folder"},"limit":10}'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/folders/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ filter: { parentId: 27, type: 'folder' }, limit: 10 }),
})

const { success, data, meta } = await res.json()
console.log('Found:', data.length)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/folders/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ filter: { parentId: 27, type: 'folder' }, limit: 10 }),
})

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | array | Array of records — subfolders and files. All fields — see [Folder fields](./fields.md) |
| `data[].type` | string | Record type: `"folder"` or `"file"` |
| `meta.total` | number | Number of records matching the filter |
| `meta.hasMore` | boolean | Whether more records exist beyond `limit` |
| `meta.durationMs` | number | Request duration in milliseconds |

The `meta` fields sit next to `data`, not inside it. Pages must be walked by `meta.hasMore`: a `data` length equal to `limit` does not rule out the last page.

## Response example

```json
{
  "success": true,
  "data": [
    {
      "id": 9301,
      "name": "Documents",
      "code": null,
      "storageId": 1,
      "type": "folder",
      "realObjectId": 9301,
      "parentId": 27,
      "deletedType": 0,
      "createdAt": "2026-06-25T12:10:00.000Z",
      "updatedAt": "2026-06-25T12:10:00.000Z",
      "deletedAt": null,
      "createdBy": 1,
      "updatedBy": 1,
      "deletedBy": null,
      "detailUrl": "https://<portal>.bitrix24.com/company/personal/user/1/disk/path/Documents"
    }
  ],
  "meta": { "total": 1, "hasMore": false, "durationMs": 125 }
}
```

## Error response example

403 — no `disk` scope:

```json
{
  "success": false,
  "error": {
    "code": "SCOPE_DENIED",
    "message": "This endpoint requires 'disk' scope"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `MISSING_REQUIRED_PARAMS` | The filter does not contain the required `parentId`. `message` lists the missing fields |
| 403 | `SCOPE_DENIED` | API key does not have the `disk` scope |
| 401 | `TOKEN_MISSING` | API key has no configured portal tokens |

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

## Known specifics

Search lists the contents of a single folder specified via `parentId`, rather than searching across the whole storage. For one-off selections it is simpler to use [`GET /v1/folders`](./list.md) with the same set of parameters in the query string.

## See also

- [Folder contents list](/docs/entities/folders/list)
- [Folder fields](/docs/entities/folders/fields)
- [Folders](/docs/entities/folders)
- [Filtering syntax](/docs/filtering)
