Get Document Outline
Returns the heading tree built for the current version of a document file.
The outline exists only after indexing has built it, and not at all for a file whose indexing failed before that step. After a re-index, this operation returns the outline the new indexing task built, once that task publishes.
The response is not paginated.
curl --request GET \
--url https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/documents/{document_file_id}/outline \
--header 'Authorization: Bearer <token>'import requests
url = "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/documents/{document_file_id}/outline"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/documents/{document_file_id}/outline', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/documents/{document_file_id}/outline",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/documents/{document_file_id}/outline"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/documents/{document_file_id}/outline")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/documents/{document_file_id}/outline")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"artifact_hash": "3a7bd3e2360a3d29eea436fcfb7e44c735d117c42d1c1835420b6b9942dd4f1b",
"created_at": "2026-09-03T10:04:00Z",
"document_asset_id": "6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b",
"id": "c9d8e7f6-a5b4-4c3d-8e2f-1a0b9c8d7e6f",
"knowledge_space_id": "9b2e5b7a-3c1d-4e2f-8a9b-1c2d3e4f5a6b",
"metadata": {},
"nodes": [
{
"child_node_ids": [
"n-1-1"
],
"children": [
{
"child_node_ids": [],
"children": [],
"end_offset": 4210,
"end_page": 3,
"id": "n-1-1",
"level": 2,
"metadata": {},
"section_path": [
"1 Introduction",
"1.1 Scope"
],
"source_element_ids": [
"el-12"
],
"source_node_ids": [],
"start_offset": 2100,
"start_page": 2,
"summary": null,
"title": "1.1 Scope",
"title_location": null,
"toc_source": "parser-heading"
}
],
"end_offset": 9800,
"end_page": 6,
"id": "n-1",
"level": 1,
"metadata": {},
"section_path": [
"1 Introduction"
],
"source_element_ids": [
"el-3"
],
"source_node_ids": [],
"start_offset": 0,
"start_page": 1,
"summary": null,
"title": "1 Introduction",
"title_location": null,
"toc_source": "parser-heading"
}
],
"outline_version": "document-outline-v1",
"parse_artifact_id": "d1e2f3a4-b5c6-4d7e-8f90-a1b2c3d4e5f6",
"updated_at": null,
"version": 1
}Authorizations
Every request authenticates with an API key: Authorization: Bearer {API_KEY}. App endpoints take an app API key; knowledge endpoints take a knowledge base API key (Get Started).
Keep keys server-side; never embed them in client code. Requests with a missing or invalid key fail with HTTP 401 (unauthorized).
Path Parameters
Knowledge base ID: the last segment of the Service API endpoint shown in the knowledge base's API Access dialog (…/knowledge-fs/spaces/<knowledge base ID>), and the segment after /datasets/new/ in the address bar.
Document file ID. From List Document Files.
Response
The outline.
Internal. Not needed to read the outline.
When the outline was built, ISO 8601.
ID of the document file the outline was built for.
Outline ID.
Internal ID of the knowledge base. Not the knowledge base ID in the path.
Additional outline details. Free-form object.
Top-level headings, in document order. Nested headings are in each heading's children.
Show child attributes
Show child attributes
Internal. Not needed to read the outline.
Internal. Not needed to read the outline.
When the outline last changed, ISO 8601. null when it has not changed since it was built.
The document file's version the outline belongs to. It does not change when a re-index rebuilds the outline, because a document file's version never changes.
Was this page helpful?
curl --request GET \
--url https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/documents/{document_file_id}/outline \
--header 'Authorization: Bearer <token>'import requests
url = "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/documents/{document_file_id}/outline"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/documents/{document_file_id}/outline', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/documents/{document_file_id}/outline",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/documents/{document_file_id}/outline"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/documents/{document_file_id}/outline")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/documents/{document_file_id}/outline")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"artifact_hash": "3a7bd3e2360a3d29eea436fcfb7e44c735d117c42d1c1835420b6b9942dd4f1b",
"created_at": "2026-09-03T10:04:00Z",
"document_asset_id": "6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b",
"id": "c9d8e7f6-a5b4-4c3d-8e2f-1a0b9c8d7e6f",
"knowledge_space_id": "9b2e5b7a-3c1d-4e2f-8a9b-1c2d3e4f5a6b",
"metadata": {},
"nodes": [
{
"child_node_ids": [
"n-1-1"
],
"children": [
{
"child_node_ids": [],
"children": [],
"end_offset": 4210,
"end_page": 3,
"id": "n-1-1",
"level": 2,
"metadata": {},
"section_path": [
"1 Introduction",
"1.1 Scope"
],
"source_element_ids": [
"el-12"
],
"source_node_ids": [],
"start_offset": 2100,
"start_page": 2,
"summary": null,
"title": "1.1 Scope",
"title_location": null,
"toc_source": "parser-heading"
}
],
"end_offset": 9800,
"end_page": 6,
"id": "n-1",
"level": 1,
"metadata": {},
"section_path": [
"1 Introduction"
],
"source_element_ids": [
"el-3"
],
"source_node_ids": [],
"start_offset": 0,
"start_page": 1,
"summary": null,
"title": "1 Introduction",
"title_location": null,
"toc_source": "parser-heading"
}
],
"outline_version": "document-outline-v1",
"parse_artifact_id": "d1e2f3a4-b5c6-4d7e-8f90-a1b2c3d4e5f6",
"updated_at": null,
"version": 1
}