# Get sections

URL: https://docs.hanzo.ai/docs/openapi/knowledge/get-knowledge-files-by-id-sections-by-section

> 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}`

> [Knowledge →](https://docs.hanzo.ai/docs/openapi/knowledge) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                                                   |
| ------------- | ----------------------------------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/knowledge/files/{id}/sections/{section}` |
| **Method**    | `GET`                                                             |
| **Operation** | `get_knowledge_files_by_id_sections_by_section`                   |
| **Auth**      | `Authorization: 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.

| Field     | In   | Type   | Required | Description                                                      |
| --------- | ---- | ------ | -------- | ---------------------------------------------------------------- |
| `id`      | path | string | yes      | ID is the file's id.                                             |
| `section` | path | string | yes      | Section is the section's number in the file's table of contents. |

## Response

| Status    | Body                 | Meaning |
| --------- | -------------------- | ------- |
| `200`     | knowledge.sectionOut | ok      |
| `default` | problem-details      | refused |

`200` body — 38 fields.

| Field                   | In   | Type                     | Always | Description                                                                                                      |
| ----------------------- | ---- | ------------------------ | ------ | ---------------------------------------------------------------------------------------------------------------- |
| `children`              | body | knowledge.tocEntry\[]    | —      | Children are its subsections, to open next.                                                                      |
| `children[].id`         | body | integer (int64)          | —      | ID is the section's number; 0 is the document itself.                                                            |
| `children[].level`      | body | integer (int64)          | —      | Level is its depth: 0 for the document, 1 for a top-level heading.                                               |
| `children[].parent`     | body | integer (int64)          | —      | Parent is the id of the section it sits in; -1 for the document.                                                 |
| `children[].size`       | body | integer (int64)          | —      | Size is how many bytes of the document it spans, subsections included.                                           |
| `children[].summary`    | body | string                   | —      | Summary is a one-line account of what it covers.                                                                 |
| `children[].synthetic`  | body | boolean                  | —      | Synthetic is true for a section the index cut out of a long run of text the document gave no structure to.       |
| `children[].title`      | body | string                   | —      | Title is its heading.                                                                                            |
| `entities`              | body | knowledge.fileEntity\[]  | —      | Entities are the entities it names.                                                                              |
| `entities[].files`      | body | integer (int64)          | —      | Files is how many other files of the org name it too.                                                            |
| `entities[].kind`       | body | string                   | —      | Kind is person, org, product, place or term.                                                                     |
| `entities[].name`       | body | string                   | —      | Name is the entity as the text names it.                                                                         |
| `entities[].sections`   | body | integer (int64)          | —      | Sections is how many of the file's sections name it.                                                             |
| `file`                  | body | knowledge.fileBrief      | —      |                                                                                                                  |
| `file.bucket`           | body | string                   | —      | Bucket and Key are where its bytes are: GET /v1/s3/buckets/{bucket}/objects/{key} answers a signed download URL. |
| `file.id`               | body | string                   | —      | ID is the file's id.                                                                                             |
| `file.key`              | body | string                   | —      | Key is the object's key in Bucket.                                                                               |
| `file.name`             | body | string                   | —      | Name is the file's name.                                                                                         |
| `file.type`             | body | string                   | —      | Type is the file's media type.                                                                                   |
| `links`                 | body | knowledge.sectionLink\[] | —      | Links are the sections the graph reaches from it, strongest first.                                               |
| `links[].file`          | body | knowledge.fileBrief      | —      |                                                                                                                  |
| `links[].file.bucket`   | body | string                   | —      | Bucket and Key are where its bytes are: GET /v1/s3/buckets/{bucket}/objects/{key} answers a signed download URL. |
| `links[].file.id`       | body | string                   | —      | ID is the file's id.                                                                                             |
| `links[].file.key`      | body | string                   | —      | Key is the object's key in Bucket.                                                                               |
| `links[].file.name`     | body | string                   | —      | Name is the file's name.                                                                                         |
| `links[].file.type`     | body | string                   | —      | Type is the file's media type.                                                                                   |
| `links[].kind`          | body | string                   | —      | Kind is href, xref, cites, or entity (the two sections name the same entities).                                  |
| `links[].label`         | body | string                   | —      | Label is the link's text, or the entities the two share.                                                         |
| `links[].section`       | body | knowledge.sectionBrief   | —      |                                                                                                                  |
| `links[].section.id`    | body | integer (int64)          | —      | ID is the section's number in its file's table of contents; 0 is the document itself.                            |
| `links[].section.path`  | body | string                   | —      | Path is the section's place in its document: the titles from the document's own down to it, joined by " › ".     |
| `links[].section.title` | body | string                   | —      | Title is the section's heading.                                                                                  |
| `section`               | body | knowledge.sectionBrief   | —      |                                                                                                                  |
| `section.id`            | body | integer (int64)          | —      | ID is the section's number in its file's table of contents; 0 is the document itself.                            |
| `section.path`          | body | string                   | —      | Path is the section's place in its document: the titles from the document's own down to it, joined by " › ".     |
| `section.title`         | body | string                   | —      | Title is the section's heading.                                                                                  |
| `summary`               | body | string                   | —      | Summary is its one-line account.                                                                                 |
| `text`                  | body | string                   | —      | Text is its own text — up to its first subsection — at most 64 KB.                                               |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

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

**SDK**

**.ts**

```ts
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' });
```

**.py**

```python
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')
```

**.go**

```go
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
}
```

**.rs**

```rust
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?;
```

**.java**

```java
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();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/knowledge/files/<id>/sections/<section> \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

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:

```bash
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](https://docs.hanzo.ai/docs/openapi/knowledge) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
