Search Files and Folders disk.file.search
Choose a tool for developing with an AI agent:
- use Alaio Vibecode to build an app for Bitrix24 from a task description without knowing any programming language. The agent writes the code and deploys the app to a server, with no manual hosting setup
- use the MCP server to develop a REST API integration in your own project. The agent refers to the official REST documentation
Scope:
diskWho can execute the method: any user
The method disk.file.search finds files and folders on Drive by a text query.
The search works through an index that covers the names of files and folders, and for documents it also covers the text inside the file. The method does not find objects in the trash.
The result includes only the objects the current user has read access to. The method does not return objects from storages without internal access permissions — for example, from the storages of other modules. Chat folders are excluded from the results.
The method rejects a query shorter than three characters, so it is not suitable for suggestions based on the first few characters entered. To walk through a known structure, use the disk.storage.getChildren and disk.folder.getChildren methods, and if the file identifier is already known — disk.file.get.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
QUERY* |
Text of the search query. The length is from 3 to 255 characters. Repeated spaces collapse into one, leading and trailing spaces are trimmed, and the length is validated after that |
|
TYPE |
Type of objects in the result:
The default value is |
|
FILTER |
Search scope (detailed description). Without this parameter, the method searches across all storages available to the user |
|
start |
Offset for pagination. The method returns no more than 50 objects per request. The value of the parameter is the number of skipped objects, not the page number: with The default value is 0. The maximum value is 1000, and the method reduces a larger value to 1000. The name of the parameter is written in lowercase, unlike the other parameters of the method |
FILTER Parameter
|
Name |
Description |
|
STORAGE_ID |
Optional key. Identifier of the storage to search in. You can retrieve the identifier using the disk.storage.getList method |
|
FOLDER_ID |
Optional key. Identifier of the folder to search in. The search also covers nested folders, and the folder itself is not included in the result. You can retrieve the identifier using the disk.folder.getChildren method |
Both keys can be passed together — in that case the method verifies that the folder belongs to the specified storage and returns the NOT_FOUND error if it does not.
The method does not accept other keys in FILTER and returns the INVALID_FILTER error.
Code Examples
How to Use Examples in Documentation
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"QUERY":"test","TYPE":"all","FILTER":{"STORAGE_ID":1}}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/disk.file.search
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"QUERY":"test","TYPE":"all","FILTER":{"STORAGE_ID":1},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/disk.file.search
// This snippet is an ES module: top-level await requires type="module" or a bundler.
// $b24 is an already-initialized SDK instance (see the SDK "Get started" guide).
import { Text } from '@bitrix24/b24jssdk'
import type { B24Frame, ISODate } from '@bitrix24/b24jssdk'
declare const $b24: B24Frame
// Shape of the payload returned in result (match the "response handling" section of the page)
// Fields marked optional come only for files or only for folders
type DiskFileSearchItem = {
ID: string
NAME: string
CODE: string | null
STORAGE_ID: string
TYPE: 'file' | 'folder'
REAL_OBJECT_ID?: string
PARENT_ID: string
DELETED_TYPE: string
GLOBAL_CONTENT_VERSION?: string
FILE_ID?: string
SIZE?: string
CREATE_TIME: ISODate
UPDATE_TIME: ISODate
DELETE_TIME: ISODate | null
CREATED_BY: string
UPDATED_BY: string
DELETED_BY: string
DOWNLOAD_URL?: string
DETAIL_URL: string | null
}
try {
const response = await $b24.actions.v2.call.make<DiskFileSearchItem[]>({
method: 'disk.file.search',
params: {
QUERY: 'test',
TYPE: 'all',
FILTER: {
STORAGE_ID: 1,
},
},
requestId: Text.getUuidRfc4122()
})
// The payload is available only on a successful response
if (!response.isSuccess) {
console.error(response.getErrorMessages().join('; '))
} else {
const result = response.getData()!.result
result.forEach((item) => console.info(item.ID, item.TYPE, item.NAME))
}
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
<!-- Load the SDK (UMD build); it is exposed as the global B24Js -->
<script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
<script>
async function searchDiskFiles() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'disk.file.search',
params: {
QUERY: 'test',
TYPE: 'all',
FILTER: {
STORAGE_ID: 1
}
},
requestId: B24Js.Text.getUuidRfc4122()
})
// The payload is available only on a successful response
if (!response.isSuccess) {
console.error(response.getErrorMessages().join('; '))
return
}
const result = response.getData().result
result.forEach(function (item) {
console.info(item.ID, item.TYPE, item.NAME)
})
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', searchDiskFiles)
</script>
try {
$response = $b24Service
->core
->call(
'disk.file.search',
[
'QUERY' => 'test',
'TYPE' => 'all',
'FILTER' => [
'STORAGE_ID' => 1
]
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
processData($result);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error searching files: ' . $e->getMessage();
}
BX24.callMethod(
"disk.file.search",
{
QUERY: "test",
TYPE: "all",
FILTER: {
STORAGE_ID: 1
}
},
function (result)
{
if (result.error())
console.error(result.error());
else
console.dir(result.data());
}
);
require_once('crest.php');
$result = CRest::call(
'disk.file.search',
[
'QUERY' => 'test',
'TYPE' => 'all',
'FILTER' => [
'STORAGE_ID' => 1
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
// client and ctx are already created — see the Go SDK section
res, err := client.Core().Call(ctx, "disk.file.search", b24.Params{
"QUERY": "test",
"TYPE": "all",
"FILTER": b24.Params{
"STORAGE_ID": 1,
},
})
if err != nil {
return fmt.Errorf("disk.file.search: %w", err)
}
var items []struct {
ID b24.ID `json:"ID"`
Name string `json:"NAME"`
StorageID b24.ID `json:"STORAGE_ID"`
Type string `json:"TYPE"`
RealObjectID b24.ID `json:"REAL_OBJECT_ID"`
ParentID b24.ID `json:"PARENT_ID"`
}
if err := json.Unmarshal(res.Result, &items); err != nil {
return fmt.Errorf("parse response: %w", err)
}
for _, it := range items {
fmt.Println(it.ID, it.Name)
}
Response Handling
HTTP status: 200
{
"result": [
{
"ID": "1739",
"NAME": "New Folder for Process Testing",
"CODE": null,
"STORAGE_ID": "1",
"TYPE": "folder",
"REAL_OBJECT_ID": "1739",
"PARENT_ID": "649",
"DELETED_TYPE": "0",
"CREATE_TIME": "2020-10-26T16:25:33+02:00",
"UPDATE_TIME": "2024-11-26T09:23:03+02:00",
"DELETE_TIME": null,
"CREATED_BY": "0",
"UPDATED_BY": "1",
"DELETED_BY": "0",
"DETAIL_URL": "https://test.bitrix24.com/company/personal/user/1/disk/path/Created files/New Folder for Process Testing"
},
{
"ID": "1277",
"NAME": "Klaus Weber - Software Testing.pdf",
"CODE": null,
"STORAGE_ID": "1",
"TYPE": "file",
"PARENT_ID": "1275",
"DELETED_TYPE": "0",
"GLOBAL_CONTENT_VERSION": "1",
"FILE_ID": "1983",
"SIZE": "5517483",
"CREATE_TIME": "2020-08-07T15:43:48+02:00",
"UPDATE_TIME": "2020-08-07T15:43:48+02:00",
"DELETE_TIME": null,
"CREATED_BY": "1",
"UPDATED_BY": "1",
"DELETED_BY": "0",
"DOWNLOAD_URL": "https://test.bitrix24.com/rest/download.json?auth=**put_access_token_here**&token=disk%7CaWQ9MTI3NyZfPXVqVGJUMmxoclBOb0JmQjVLWmxyWnRISWFTQ2M5V2hT",
"DETAIL_URL": "https://test.bitrix24.com/company/personal/user/1/disk/file/Uploaded files/Imported files/Klaus Weber - Software Testing.pdf"
}
],
"time": {
"start": 1785494344,
"finish": 1785494344.440217,
"duration": 0.4402170181274414,
"processing": 0,
"date_start": "2026-07-31T13:39:04+02:00",
"date_finish": "2026-07-31T13:39:04+02:00",
"operating_reset_at": 1785494944,
"operating": 0.13181495666503906
}
}
If nothing is found, the method returns an empty array:
{
"result": [],
"time": {
"start": 1785496443,
"finish": 1785496443.510742,
"duration": 0.5107419490814209,
"processing": 0,
"date_start": "2026-07-31T14:14:03+02:00",
"date_finish": "2026-07-31T14:14:03+02:00",
"operating_reset_at": 1785497043,
"operating": 0
}
}
Returned Data
|
Name |
Description |
|
result |
Array of found objects (detailed description) |
|
next |
Offset for the next request. It comes only when there is a next page (example) |
|
time |
Information about the request execution time |
Object in the result Array
The set of fields depends on the type of the object. The GLOBAL_CONTENT_VERSION, FILE_ID, SIZE, and DOWNLOAD_URL fields come only for files, and the REAL_OBJECT_ID field comes only for folders.
|
Name |
Description |
|
ID |
Identifier of the object |
|
NAME |
Name of the file or folder |
|
CODE |
Symbolic code of the object. It comes as |
|
STORAGE_ID |
Identifier of the storage the object is located in |
|
TYPE |
Type of the object: |
|
REAL_OBJECT_ID |
Identifier of the folder the object refers to. For a regular folder, it matches |
|
PARENT_ID |
Identifier of the parent folder |
|
DELETED_TYPE |
Deletion status of the object. The method returns only objects with the value |
|
GLOBAL_CONTENT_VERSION |
Incremental counter of the file version. It comes only for files |
|
FILE_ID |
Internal value of the file identifier. It comes only for files |
|
SIZE |
Size of the file in bytes. It comes only for files |
|
CREATE_TIME |
Date and time the object was created |
|
UPDATE_TIME |
Date and time the object was last updated |
|
DELETE_TIME |
Date and time the object was moved to the trash. The method does not return objects from the trash, so the field is always |
|
CREATED_BY |
Identifier of the user who created the object |
|
UPDATED_BY |
Identifier of the user who made the last change |
|
DELETED_BY |
Identifier of the user who deleted the object |
|
DOWNLOAD_URL |
Link to download the file. It comes only for files |
|
DETAIL_URL |
Link to open the object in the interface. For objects from storages that do not belong to Drive, it comes as |
The objects are sorted by the date of the last change, from newest to oldest.
Pagination
The method returns no more than 50 objects per request. If more are found, the next field comes next to result — the offset the next page starts from. The method does not return the total number of found objects.
The response of the first page, with result in the example shortened to 2 objects out of 50:
{
"result": [
{
"ID": "9739",
"NAME": "report-51.txt",
"CODE": null,
"STORAGE_ID": "1",
"TYPE": "file",
"PARENT_ID": "9637",
"DELETED_TYPE": "0",
"GLOBAL_CONTENT_VERSION": "1",
"FILE_ID": "36819",
"SIZE": "6",
"CREATE_TIME": "2026-07-31T14:15:49+02:00",
"UPDATE_TIME": "2026-07-31T14:15:49+02:00",
"DELETE_TIME": null,
"CREATED_BY": "1",
"UPDATED_BY": "1",
"DELETED_BY": "0",
"DOWNLOAD_URL": "https://test.bitrix24.com/rest/download.json?auth=**put_access_token_here**&token=disk%7CaWQ9OTczOSZfPTFEU1hGMGtkY3E2Q3FZUTIyM2tiV3R6Tk5jZHgxMzR2",
"DETAIL_URL": "https://test.bitrix24.com/company/personal/user/1/disk/file/Reports/report-51.txt"
},
{
"ID": "9737",
"NAME": "report-50.txt",
"CODE": null,
"STORAGE_ID": "1",
"TYPE": "file",
"PARENT_ID": "9637",
"DELETED_TYPE": "0",
"GLOBAL_CONTENT_VERSION": "1",
"FILE_ID": "36817",
"SIZE": "6",
"CREATE_TIME": "2026-07-31T14:15:48+02:00",
"UPDATE_TIME": "2026-07-31T14:15:48+02:00",
"DELETE_TIME": null,
"CREATED_BY": "1",
"UPDATED_BY": "1",
"DELETED_BY": "0",
"DOWNLOAD_URL": "https://test.bitrix24.com/rest/download.json?auth=**put_access_token_here**&token=disk%7CaWQ9OTczNyZfPTBmQlVlRDFCMTA0ajNhc3ZwbFdVRnhXNUg1MFpha3JO",
"DETAIL_URL": "https://test.bitrix24.com/company/personal/user/1/disk/file/Reports/report-50.txt"
}
],
"next": 50,
"time": {
"start": 1785496566,
"finish": 1785496566.197965,
"duration": 0.19796490669250488,
"processing": 0,
"date_start": "2026-07-31T14:16:06+02:00",
"date_finish": "2026-07-31T14:16:06+02:00",
"operating_reset_at": 1785497166,
"operating": 0
}
}
Pass the value of next in the start parameter:
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"QUERY":"report","start":50}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/disk.file.search
On the last page, the response has no next field:
{
"result": [
{
"ID": "9639",
"NAME": "report-01.txt",
"CODE": null,
"STORAGE_ID": "1",
"TYPE": "file",
"PARENT_ID": "9637",
"DELETED_TYPE": "0",
"GLOBAL_CONTENT_VERSION": "1",
"FILE_ID": "36719",
"SIZE": "6",
"CREATE_TIME": "2026-07-31T14:14:56+02:00",
"UPDATE_TIME": "2026-07-31T14:14:56+02:00",
"DELETE_TIME": null,
"CREATED_BY": "1",
"UPDATED_BY": "1",
"DELETED_BY": "0",
"DOWNLOAD_URL": "https://test.bitrix24.com/rest/download.json?auth=**put_access_token_here**&token=disk%7CaWQ9OTYzOSZfPXFPZWc1bnBGZFFPcXd0anlzd3BHN2VEQ3c4UXlGdk5l",
"DETAIL_URL": "https://test.bitrix24.com/company/personal/user/1/disk/file/Reports/report-01.txt"
}
],
"time": {
"start": 1785496584,
"finish": 1785496584.545265,
"duration": 0.5452649593353271,
"processing": 0,
"date_start": "2026-07-31T14:16:24+02:00",
"date_finish": "2026-07-31T14:16:24+02:00",
"operating_reset_at": 1785497184,
"operating": 0
}
}
The navigation depth is limited: the method reduces an offset greater than 1000 to 1000. The results do not move past the object number 1050, so there is no point in increasing start indefinitely. If there are too many results, narrow the search scope with the FILTER parameter.
Error Handling
HTTP status: 400
{
"error": "INVALID_QUERY",
"error_description": "Search query is invalid. (INVALID_QUERY)."
}
|
Name |
Description |
|
error |
String error code. It consists of digits, Latin letters, and underscores. It may arrive empty — in that case only |
|
error_description |
Error message for the developer. Do not show it to the end user without processing |
Possible Error Codes
|
Code |
Description |
Value |
|
|
Invalid value of parameter { Parameter #0 [ |
The required |
|
|
Search query is invalid. (INVALID_QUERY). |
The query is shorter than 3 or longer than 255 characters, or it is not passed as a string |
|
|
Search result type is invalid. (INVALID_TYPE). |
The |
|
|
Search filter contains an unknown field. (INVALID_FILTER). |
A key other than |
|
|
Search scope was not found. (NOT_FOUND). |
The storage or folder from |
|
|
Search is not supported for this storage. (UNSUPPORTED_STORAGE). |
The specified storage does not use the internal access permissions of Drive |
Statuses and System Error Codes
HTTP Status: 4xx, 5xx
The errors described below are returned by the REST API itself, not by the logic of a specific method. They can arrive in response to any method.
|
Status |
Code |
Description |
|
|
|
An internal server error has occurred. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support |
|
|
|
The server returned an unexpected response. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support |
|
|
|
The request intensity limit has been exceeded |
|
|
|
The method is blocked because the request resource intensity limit has been exceeded. The block is lifted automatically once the accumulated execution time of the method no longer exceeds the limit |
|
|
|
The request contains no authorization data: neither an access token nor a webhook code was passed |
|
|
|
Methods are called over the HTTPS protocol only |
|
|
|
The REST API is blocked due to overload. This is a manual individual block. To have it lifted, contact Bitrix24 technical support |
|
|
|
REST API access is not active for this account. In Bitrix24 Cloud, check the current plan or trial status: Vibe+ plans include REST API access, while Essentials plans do not. A webhook receives a different error message — |
|
|
|
No active webhook with the specified user identifier and secret code was found |
|
|
|
No method with this name was found. The name is misspelled, the method does not exist in the REST API, or it is unavailable without the required scope |
|
|
|
The request requires broader permissions than the token has: for a webhook these are the permissions granted to it, for an application it is the scope. For an application, the error message ends with |
|
|
|
The access token has expired |
|
|
|
The application is installed, but the Bitrix24 administrator has granted access to it only to specific users |
|
|
|
The public part of the site is closed. To open it on an on-premise installation, disable the "Temporary closure of the public part of the site" option. Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site |
Continue Learning
- Copy File to Specified Folder disk.file.copyTo
- Permanently Delete File disk.file.delete
- Get Public Link for File disk.file.getExternalLink
- Get Description of File Fields for disk.file.getFields
- List of File Versions for disk.file.getVersions
- Get File Parameters disk.file.get
- Move File to Trash disk.file.markDeleted
- Move File to Specified Folder disk.file.moveTo
- Rename File disk.file.rename
- Restore a File from a Specific Version disk.file.restoreFromVersion
- Restore File from Trash disk.file.restore
- Upload a New Version of a File disk.file.uploadVersion