## Full-text Disk search

`POST /v1/files/fulltext-search`

Searches the index across accessible Disk. [Single-folder search](/docs/entities/files/search) accepts filters, while this route accepts a search string. Requires `disk` scope. READONLY keys are allowed.

## Request fields

| Field | Type | Required | Description |
|---|---|---|---|
| `query` | string | yes | Required. Whitespace is collapsed and trimmed, then length must be 3..255 characters |
| `type` | string | no | `file`, `folder`, `all`. Default `file` |
| `filter.storageId` | number | no | Positive integer ID from [storage listing](/docs/entities/storages/list) |
| `filter.folderId` | number | no | Positive integer ID from [folder listing](/docs/entities/folders/list) |
| `filter.fileType` | string or array | no | Only with `type=file`: `document`, `image`, `video`, `audio`, `archive`, `pdf`, `vector_image`, `board`, `known`, `unknown`. Arrays must be nonempty |
| `offset` | number | no | Integer 0..1000, default 0 |

Unknown fields are refused. `limit` is not accepted: the native Bitrix24 page size is fixed at 50 records.

## Examples

### curl — personal key

```bash
curl -X POST 'https://vibecode.bitrix24.com/v1/files/fulltext-search' \
  -H 'X-Api-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"query":"report","filter":{"fileType":"document"},"offset":0}'
```

### curl — OAuth application

```bash
curl -X POST 'https://vibecode.bitrix24.com/v1/files/fulltext-search' \
  -H 'X-Api-Key: YOUR_APP_KEY' \
  -H 'Authorization: Bearer USER_SESSION_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"report","filter":{"fileType":"document"},"offset":0}'
```

### JavaScript — personal key

```javascript
const response = await fetch('https://vibecode.bitrix24.com/v1/files/fulltext-search', {
  method: 'POST',
  headers: {"X-Api-Key": "YOUR_API_KEY", "Content-Type": "application/json"},
  body: JSON.stringify({"query": "report", "filter": {"fileType": "document"}, "offset": 0}),
})
const result = await response.json()
console.log(result)
```

### JavaScript — OAuth application

```javascript
const response = await fetch('https://vibecode.bitrix24.com/v1/files/fulltext-search', {
  method: 'POST',
  headers: {"X-Api-Key": "YOUR_APP_KEY", "Authorization": "Bearer USER_SESSION_TOKEN", "Content-Type": "application/json"},
  body: JSON.stringify({"query": "report", "filter": {"fileType": "document"}, "offset": 0}),
})
const result = await response.json()
console.log(result)
```

## Response fields

| Field | Type | Description |
|---|---|---|
| `success` | boolean | Successful request |
| `data.items` | array | [Files](/docs/entities/files/get) or [folders](/docs/entities/folders/get) |
| `data.meta.nextOffset` | number \| null | Next offset; null at the end |
| `data.meta.maxOffset` | number | Maximum offset: 1000 |

```json
{"success":true,"data":{"items":[{"id":42,"type":"file","name":"report.pdf","folderId":9,"downloadUrl":"https://vibecode.bitrix24.com/v1/files/42/download"}],"meta":{"nextOffset":null,"maxOffset":1000}}}
```

`data.items` contains files in the [files](/docs/entities/files/get) projection and folders in the [folders](/docs/entities/folders/get) projection. Follow `downloadUrl` with the same API key. `data.meta.nextOffset` is the next page offset or `null`; use it in the next request. There is no `total`: Bitrix24 does not return the match count.

Trash is excluded. Empty results do not prove absence: indexing is asynchronous and content indexing depends on format. Name search is more reliable. You cannot continue past offset 1000; narrow the query.

## Errors

Example refusal (400):

```json
{"success":false,"error":{"code":"INVALID_PARAMS","message":"query must contain 3..255 characters after whitespace normalization."}}
```


| HTTP | Code | Description |
|---|---|---|
| 400 | `INVALID_PARAMS` | Invalid query, type, filter or offset, unknown fields |
| 403 | `SCOPE_DENIED` | Missing disk scope |
| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied access |
| 404 | `ENTITY_NOT_FOUND` | Storage or folder not found or inaccessible. These causes are intentionally indistinguishable |
| 422 | `BITRIX_ERROR` | Bitrix24 business refusal or response without a result |
| 422 | `OPERATION_FAILED` | Bitrix24 business refusal or response without a result |

Common refusals: [Errors](/docs/errors).

## See also

- [search](/docs/entities/files/search)
- [list](/docs/entities/storages/list)
