Skip to content

List file tree ​

Interface Description ​

Browse the currently readable knowledge-base files and directories.

Endpoint ​

FieldValue
MethodGET
Path/openapi/v2/knowledge-bases/{knowledgeBaseId}/tree
Operation IDlistKnowledgeBaseTree
AuthenticationBearer OpenAPI key

Parameters ​

NameLocationRequiredTypeExampleDescription
knowledgeBaseIdpathYesstringknowledge-base-11111111-1111-4111-8111-111111111111Knowledge-base identifier returned by knowledge-base APIs.
parentPathqueryNostringpagesDirectory path to browse, or root for the bundle root. Parent traversal, file paths, and storage paths are rejected.
entryTypequeryNofile | directoryfileOptional tree node type filter.
limitqueryNointeger50Maximum number of records to return. The deployment can enforce a lower limit.
cursorqueryNostringcursor_123Pagination token returned by the same endpoint for reading the next page.

Request Body ​

This operation has no request body.

Request Example ​

bash
curl -X GET "https://openapi.example.com/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/tree?parentPath=pages&entryType=file&limit=50" \
  -H "Authorization: Bearer <openapi-key>"

Successful Responses ​

200 ​

Requested page of direct readable files and directories under the selected parent path.

FieldRequiredTypeDescription
activeContentRevisionYesobjectCurrent readable knowledge-base content revision.
itemsYesarray<GeneratedTreeEntry>Records returned on this page.
nextCursorYesstring | nullPagination token returned by this endpoint. Reuse it only with the same endpoint and readable knowledge-base version. If it is rejected, restart without a cursor.

Success Response Example ​

json
{
  "activeContentRevision": 1,
  "items": [
    {
      "activeContentRevision": 1,
      "id": "tree-file-11111111111111111111111111111111",
      "fileId": "source-file-11111111-1111-4111-8111-111111111111",
      "sourceFileId": "source-file-11111111-1111-4111-8111-111111111111",
      "directoryId": null,
      "parentPath": "pages",
      "name": "guide.md",
      "path": "pages/guide.md",
      "sortKey": "1:guide.md",
      "entryType": "file",
      "fileKind": "page",
      "directEntryCount": 0,
      "directDirectoryCount": 0,
      "directFileCount": 0,
      "descendantFileCount": 0,
      "resourceRevision": 1,
      "deletable": true,
      "contentAvailable": true,
      "readActions": {
        "fileDetailById": "/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/files/source-file-11111111-1111-4111-8111-111111111111",
        "fileContentById": "/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/files/source-file-11111111-1111-4111-8111-111111111111/content",
        "fileContentByPath": "/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/files/content?path=pages%2Fguide.md",
        "relatedFilesById": "/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/files/source-file-11111111-1111-4111-8111-111111111111/related",
        "graphExpansionByFileId": "/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/graph/expand?fileId=source-file-11111111-1111-4111-8111-111111111111",
        "sourceFileStatusById": "/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/source-files/source-file-11111111-1111-4111-8111-111111111111"
      }
    }
  ],
  "nextCursor": null
}

Error Codes ​

The table below lists every error response documented for this operation.

HTTP StatusError CodeExplanation
401UNAUTHORIZEDThe Bearer API key is missing, malformed, unknown, revoked, or deleted.
404NOT_FOUNDThe requested resource was not found.
422VALIDATION_ERRORThe request failed validation.
429RATE_LIMITEDThe request exceeded the configured rate limits.
500INTERNAL_ERRORThe API encountered an internal error.
503DATABASE_REPOSITORY_UNAVAILABLEThe data required by this operation is temporarily unavailable.

Next Steps ​