For AI agents: markdown of this page — /docs-content-en/note/collections/tree.md documentation index — /llms.txt
Knowledge base document tree
GET /v1/note/collections/:collectionId/documents
Returns the document tree of a knowledge base: top-level documents and the child documents nested within them. Use it to traverse the knowledge base structure or to obtain its document identifiers.
The generic filter parameter is not applied by this endpoint. By default, the API preserves the previous HTTP 200 response and data, adds Warning: 299 - "filter is not supported on this endpoint and was ignored", and records unsupported-filter use in the server log.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ParametercollectionId (path) |
Typenumber | Requiredyes | DescriptionKnowledge base identifier. List: GET /v1/note/collections |
Examples
curl — personal key
curl https://vibecode.bitrix24.com/v1/note/collections/9/documents \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl https://vibecode.bitrix24.com/v1/note/collections/9/documents \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN"
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/note/collections/9/documents', {
headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
const { data } = await res.json()
console.log('Document tree:', data)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/note/collections/9/documents', {
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
const { data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | DescriptionAlways true on success |
Fielddata |
Typearray | DescriptionTop-level documents of the knowledge base |
Fielddata[].id |
Typenumber | DescriptionDocument identifier |
Fielddata[].collectionId |
Typenumber | DescriptionIdentifier of the knowledge base the document belongs to. List: GET /v1/note/collections |
Fielddata[].parentId |
Typenumber or null | DescriptionIdentifier of the parent document. null for a top-level document |
Fielddata[].title |
Typestring | DescriptionDocument title |
Fielddata[].position |
Typenumber | DescriptionNumeric position of the document among its siblings |
Fielddata[].children |
Typearray | DescriptionNested documents of the same structure |
Fieldmeta.truncated |
Typeboolean | Descriptiontrue if the tree is not shown in full |
Response example
{
"success": true,
"data": [
{
"id": 65,
"collectionId": 27,
"parentId": null,
"title": "Chapter 1",
"position": 1000,
"children": [
{
"id": 67,
"collectionId": 27,
"parentId": 65,
"title": "Section 1.1",
"position": 1000,
"children": []
}
]
}
],
"meta": { "truncated": false }
}
Error response example
404 — knowledge base not found:
{
"success": false,
"error": {
"code": "ENTITY_NOT_FOUND",
"message": "Record with ID = `999999` not found"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP200 | CodeWarning: 299 |
DescriptionThe filter is ignored by default; previous data is preserved and the warning is sent in the Warning header. |
| HTTP400 (strict mode only) | CodeUNSUPPORTED_FILTER |
DescriptionThe server mode is disabled by default; until it is enabled, the endpoint preserves HTTP 200 and the previous data. |
| HTTP400 | CodeINVALID_PARAMS |
DescriptioncollectionId is not a positive integer |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionKnowledge base with the specified collectionId not found |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key lacks the note scope |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe key has no configured tokens |
Full list of common API errors — Errors.
Known specifics
Archived documents are not included in the tree. Only active documents of the knowledge base are returned.
The meta.truncated field comes back true when the tree reaches the internal limit of 5000 nodes. In this case only part of the structure is shown.