For AI agents: markdown of this page — /docs-content-en/entities/files/search.md documentation index — /llms.txt

File search

POST /v1/files/search

Returns folder contents — the same as GET /v1/files, only the conditions are passed in the request body rather than in the query string. The filter must contain folderId.

Request fields (body)

Field Type Required Description
filter object yes Selection conditions. Must contain folderId — the ID of the folder whose contents are returned.
Filtering syntax. Example: {"folderId":27,"type":"file"}
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 pagination

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/files/search" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"filter":{"folderId":27,"type":"file"},"limit":10}'

curl — OAuth application

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

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/files/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ filter: { folderId: 27, type: 'file' }, 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/files/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ filter: { folderId: 27, type: 'file' }, 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 File fields
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": 205,
      "name": "presentation_q1.pdf",
      "code": null,
      "storageId": 1,
      "type": "file",
      "folderId": 27,
      "size": 31232,
      "fileId": 363,
      "globalContentVersion": 1,
      "downloadUrl": "https://example.bitrix24.com/rest/1/XXXXXX/download/?token=PLACEHOLDER",
      "deletedType": 0,
      "createdBy": 5,
      "updatedBy": 5,
      "deletedBy": null,
      "createdAt": "2023-03-15T09:29:09.000Z",
      "updatedAt": "2023-03-15T09:29:09.000Z",
      "deletedAt": null,
      "detailUrl": "https://example.bitrix24.com/docs/path/to/file/"
    }
  ],
  "meta": { "total": 1, "hasMore": false, "durationMs": 206 }
}

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 folderId. 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.

Known specifics

Search is limited to a single folder specified in folderId and does not span the whole storage. The same result is returned by GET /v1/files with parameters in the query string.

The response contains both folders (type: "folder") and files (type: "file") — distinguish them by the type field. Folders have a realObjectId field, files do not. The contentProvider field is not returned for files on the Bitrix24 Drive.

See also