Get sections

Answers one section of one of the caller's org files: its own text, its subsections, the sections it links to or shares entities with — in this file or another — and the entities it names.

GET /v1/knowledge/files/{id}/sections/{section}

Addresshttps://api.hanzo.ai/v1/knowledge/files/{id}/sections/{section}
MethodGET
Operationget_knowledge_files_by_id_sections_by_section
AuthAuthorization: Bearer $HANZO_API_KEY

Answers one section of one of the caller's org files: its own text, its subsections, the sections it links to or shares entities with — in this file or another — and the entities it names. Open the document itself with section 0.

Request

2 fields.

FieldInTypeRequiredDescription
idpathstringyesID is the file's id.
sectionpathstringyesSection is the section's number in the file's table of contents.

Response

StatusBodyMeaning
200knowledge.sectionOutok
defaultproblem-detailsrefused

200 body — 38 fields.

FieldInTypeAlwaysDescription
childrenbodyknowledge.tocEntry[]—Children are its subsections, to open next.
children[].idbodyinteger (int64)—ID is the section's number; 0 is the document itself.
children[].levelbodyinteger (int64)—Level is its depth: 0 for the document, 1 for a top-level heading.
children[].parentbodyinteger (int64)—Parent is the id of the section it sits in; -1 for the document.
children[].sizebodyinteger (int64)—Size is how many bytes of the document it spans, subsections included.
children[].summarybodystring—Summary is a one-line account of what it covers.
children[].syntheticbodyboolean—Synthetic is true for a section the index cut out of a long run of text the document gave no structure to.
children[].titlebodystring—Title is its heading.
entitiesbodyknowledge.fileEntity[]—Entities are the entities it names.
entities[].filesbodyinteger (int64)—Files is how many other files of the org name it too.
entities[].kindbodystring—Kind is person, org, product, place or term.
entities[].namebodystring—Name is the entity as the text names it.
entities[].sectionsbodyinteger (int64)—Sections is how many of the file's sections name it.
filebodyknowledge.fileBrief—
file.bucketbodystring—Bucket and Key are where its bytes are: GET /v1/s3/buckets/{bucket}/objects/{key} answers a signed download URL.
file.idbodystring—ID is the file's id.
file.keybodystring—Key is the object's key in Bucket.
file.namebodystring—Name is the file's name.
file.typebodystring—Type is the file's media type.
linksbodyknowledge.sectionLink[]—Links are the sections the graph reaches from it, strongest first.
links[].filebodyknowledge.fileBrief—
links[].file.bucketbodystring—Bucket and Key are where its bytes are: GET /v1/s3/buckets/{bucket}/objects/{key} answers a signed download URL.
links[].file.idbodystring—ID is the file's id.
links[].file.keybodystring—Key is the object's key in Bucket.
links[].file.namebodystring—Name is the file's name.
links[].file.typebodystring—Type is the file's media type.
links[].kindbodystring—Kind is href, xref, cites, or entity (the two sections name the same entities).
links[].labelbodystring—Label is the link's text, or the entities the two share.
links[].sectionbodyknowledge.sectionBrief—
links[].section.idbodyinteger (int64)—ID is the section's number in its file's table of contents; 0 is the document itself.
links[].section.pathbodystring—Path is the section's place in its document: the titles from the document's own down to it, joined by " › ".
links[].section.titlebodystring—Title is the section's heading.
sectionbodyknowledge.sectionBrief—
section.idbodyinteger (int64)—ID is the section's number in its file's table of contents; 0 is the document itself.
section.pathbodystring—Path is the section's place in its document: the titles from the document's own down to it, joined by " › ".
section.titlebodystring—Title is the section's heading.
summarybodystring—Summary is its one-line account.
textbodystring—Text is its own text — up to its first subsection — at most 64 KB.

Failure carries the platform error shape — see Errors.

Examples

hanzo has no subcommand for this operation — the CLI serves only what cloud's live route table confirms. Use HTTP or an SDK.

import { Configuration, KnowledgeApi } from 'hanzoai';

const api = new KnowledgeApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getKnowledgeFilesByIdSectionsBySection({ id: 'id', section: 'section' });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import KnowledgeApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = KnowledgeApi(client).get_knowledge_files_by_id_sections_by_section(id='id', section='section')
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.KnowledgeAPI.GetKnowledgeFilesByIdSectionsBySection(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, knowledge_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = knowledge_api::get_knowledge_files_by_id_sections_by_section(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.KnowledgeApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new KnowledgeApi(client).getKnowledgeFilesByIdSectionsBySection();
curl https://api.hanzo.ai/v1/knowledge/files/<id>/sections/<section> \
  -H "Authorization: Bearer $HANZO_API_KEY"

MCP reaches knowledge through the knowledge tool, which names its 9 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_knowledge_connectors"
         }
       }
     }'

Knowledge API · All Hanzo APIs · Interactive reference

Was this page useful?