# List toc

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

> Answers one of the caller's org files' table of contents: every section in document order with its depth, its parent and a one-line summary.

`GET /v1/knowledge/files/{id}/toc`

> [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}/toc` |
| **Method**    | `GET`                                              |
| **Operation** | `get_knowledge_files_by_id_toc`                    |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`             |

Answers one of the caller's org files' table of contents: every
section in document order with its depth, its parent and a one-line summary.
It is the map a reader — a person in Drive, or an agent deciding where to
look — reads before opening a section with GET
/v1/knowledge/files/{id}/sections/{section}.

## Request

1 field.

| Field | In   | Type   | Required | Description                                                   |
| ----- | ---- | ------ | -------- | ------------------------------------------------------------- |
| `id`  | path | string | yes      | ID is the file's id, as POST /v1/knowledge/files answered it. |

## Response

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

`200` body — 30 fields.

| Field                  | In   | Type                  | Always | Description                                                                                                                                                                                    |
| ---------------------- | ---- | --------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `file`                 | body | knowledge.File        | —      |                                                                                                                                                                                                |
| `file.bucket`          | body | string                | —      | Bucket is the org bucket the object is in, by the friendly name /v1/s3/buckets lists.                                                                                                          |
| `file.chars`           | body | integer (int64)       | —      | Chars is the length of the text read out of the file, in bytes.                                                                                                                                |
| `file.clipped`         | body | boolean               | —      | Clipped is true when only the file's beginning is indexed: its text ran past the org's bound or the room the index has.                                                                        |
| `file.created`         | body | integer (int64)       | —      | Created is when the file was first registered, in unix seconds.                                                                                                                                |
| `file.done`            | body | integer (int64)       | —      | Done is how far the running stage has come, of Total: bytes of the file read (extract), sections summarized (toc), cut into passages (passages) and linked (graph), passages embedded (embed). |
| `file.embedded`        | body | integer (int64)       | —      | Embedded is how many of those passages carry a vector — Passages once the embed stage is done, unless Note says the file is embedded in part.                                                  |
| `file.error`           | body | string                | —      | Error is why a stored or failed file was not indexed — or, on a ready file, why it is searched by its words alone — in words a person can act on.                                              |
| `file.id`              | body | string                | —      | ID names the file in its org.                                                                                                                                                                  |
| `file.key`             | body | string                | —      | Key is the object's key in that bucket.                                                                                                                                                        |
| `file.name`            | body | string                | —      | Name is the object's file name, the last segment of its key.                                                                                                                                   |
| `file.note`            | body | string                | —      | Note says in words where the file is indexed less than whole and why: its text past the org's bound or the room the index has, its passages past the bound on vectors.                         |
| `file.parent`          | body | string                | —      | Parent is the id of the archive this file was unpacked from.                                                                                                                                   |
| `file.passages`        | body | integer (int64)       | —      | Passages is how many passages its text was cut into.                                                                                                                                           |
| `file.project`         | body | string                | —      | Project is the project scope it is indexed under.                                                                                                                                              |
| `file.sections`        | body | integer (int64)       | —      | Sections is how many nodes its table of contents has, the document's own root included.                                                                                                        |
| `file.size`            | body | integer (int64)       | —      | Size is the object's length in bytes, as the store reports it.                                                                                                                                 |
| `file.stage`           | body | string                | —      | Stage is the ingest stage the file is in: extract, toc, passages or graph while indexing, embed while a ready file's vectors are written.                                                      |
| `file.status`          | body | string                | —      | Status is queued, indexing, ready, stored (kept but not indexed — Error says why) or failed.                                                                                                   |
| `file.total`           | body | integer (int64)       | —      | Total is what the running stage has to do in all, in Done's units.                                                                                                                             |
| `file.type`            | body | string                | —      | Type is the object's media type as the store holds it, or the one its name implies when the store holds only the generic default.                                                              |
| `file.updated`         | body | integer (int64)       | —      | Updated is when its record last changed, in unix seconds.                                                                                                                                      |
| `sections`             | body | knowledge.tocEntry\[] | —      | Sections are its nodes in document order, the document first; Parent makes them a tree.                                                                                                        |
| `sections[].id`        | body | integer (int64)       | —      | ID is the section's number; 0 is the document itself.                                                                                                                                          |
| `sections[].level`     | body | integer (int64)       | —      | Level is its depth: 0 for the document, 1 for a top-level heading.                                                                                                                             |
| `sections[].parent`    | body | integer (int64)       | —      | Parent is the id of the section it sits in; -1 for the document.                                                                                                                               |
| `sections[].size`      | body | integer (int64)       | —      | Size is how many bytes of the document it spans, subsections included.                                                                                                                         |
| `sections[].summary`   | body | string                | —      | Summary is a one-line account of what it covers.                                                                                                                                               |
| `sections[].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.                                                                                     |
| `sections[].title`     | body | string                | —      | Title is its heading.                                                                                                                                                                          |

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.getKnowledgeFilesByIdToc({ id: 'id' });
```

**.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_toc(id='id')
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.KnowledgeAPI.GetKnowledgeFilesByIdToc(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_toc(&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).getKnowledgeFilesByIdToc();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/knowledge/files/<id>/toc \
  -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)
