Get file content by path
Interface Description
Read a readable knowledge-base file by its path, such as index.md or pages/example.md.
Endpoint
| Field | Value |
|---|---|
| Method | GET |
| Path | /openapi/v2/knowledge-bases/{knowledgeBaseId}/files/content |
| Operation ID | getFileContentByPath |
| Authentication | Bearer OpenAPI key |
Parameters
| Name | Location | Required | Type | Example | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | Yes | string | knowledge-base-11111111-1111-4111-8111-111111111111 | Knowledge-base identifier returned by knowledge-base APIs. |
path | query | Yes | string | pages/guide.md | Readable knowledge-base file path returned by tree, search, or file APIs. Parent traversal, backslashes, and storage paths are rejected. |
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/files/content?path=pages%2Fguide.md" \
-H "Authorization: Bearer <openapi-key>"Successful Responses
200
Complete content of the readable file at the requested path. A file under pages/ that comes from uploaded Markdown preserves the current uploaded text, including frontmatter order, line breaks, and the final newline. Generated navigation, index, graph, and log resources return their generated content.
| Field | Required | Type | Description |
|---|---|---|---|
file | Yes | object | Readable file metadata returned by the request. |
content | Yes | string | Complete readable file content. |
Success Response Example
json
{
"file": {
"activeContentRevision": 1,
"fileId": "source-file-11111111-1111-4111-8111-111111111111",
"knowledgeBaseId": "knowledge-base-11111111-1111-4111-8111-111111111111",
"sourceFileId": "source-file-11111111-1111-4111-8111-111111111111",
"path": "pages/guide.md",
"fileKind": "page",
"contentType": "text/markdown; charset=utf-8",
"sizeBytes": 2048,
"okfType": "Guide",
"title": "Verified guide",
"description": null,
"tags": [
"guide",
"policy"
],
"frontmatter": {
"okf_version": "0.2",
"type": "Guide",
"title": "Verified guide",
"tags": [
"guide",
"policy"
],
"sources": [
{
"id": "source-a",
"resource": "references/source-a.md"
}
],
"generated": {
"by": "publisher:example",
"at": "2026-06-17T00:00:00Z"
},
"verified": [
{
"by": "human:reviewer",
"at": "2026-06-17T01:00:00Z"
}
],
"status": "stable",
"stale_after": "2026-12-31"
},
"okfSignals": {
"effectiveStatus": "stable",
"trustTier": "human-reviewed",
"isStale": false,
"staleAfter": "2026-12-31",
"generatedAt": "2026-06-17T00:00:00.000Z",
"generatedAtSource": "generated",
"latestVerifiedAt": "2026-06-17T01:00:00.000Z",
"sourceCount": 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"
}
},
"content": "---\ntype: page\ntitle: Guide\n---\n# Guide\n\nContent."
}Error Codes
The table below lists every error response documented for this operation.
| HTTP Status | Error Code | Explanation |
|---|---|---|
| 401 | UNAUTHORIZED | The Bearer API key is missing, malformed, unknown, revoked, or deleted. |
| 404 | NOT_FOUND | The requested resource was not found. |
| 413 | PAYLOAD_TOO_LARGE | The request body or requested file exceeds the size limit for this operation. |
| 422 | VALIDATION_ERROR | The request failed validation. |
| 429 | RATE_LIMITED | The request exceeded the configured rate limits. |
| 500 | INTERNAL_ERROR | The API encountered an internal error. |
| 503 | DATABASE_REPOSITORY_UNAVAILABLE | The data required by this operation is temporarily unavailable. |