---
title: "Code Chunker"
method: POST
path: "/v1/chunk/code"
---

# Code Chunker

`POST /v1/chunk/code`

Chunk the given code text or file using the Code Chunker.

## Response `200`

Successful Response: A list of code chunk objects.

- CodeChunkSchema[] — A list containing code chunk objects, each detailing a segment of the original code and optionally the corresponding AST nodes.
  - `text` string — The actual code text content of the chunk.
  - `start_index` integer — The starting character index of the chunk within the original input code.
  - `end_index` integer — The ending character index (exclusive) of the chunk within the original input code.
  - `token_count` integer — The number of tokens in this specific chunk, according to the tokenizer used.
  - `nodes` NodeSchema[], nullable — Optional list of AST nodes contained within this chunk (present if include_nodes is true).
    - `text` string — The text content of the node.
    - `start_byte` integer — The starting byte index of the node within the original code text.
    - `end_byte` integer — The ending byte index (exclusive) of the node within the original code text.
    - `type` string — The type of the AST node (e.g., 'function_definition', 'identifier').

## Changes

- **2025-04-22** `29d7b471b697` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/feyninc/apis/chonkie-api/changes/v1/chunk/code/post.md)

---

[API](https://skmtc.dev/feyninc/apis/chonkie-api.md) · [All operations](https://skmtc.dev/feyninc/apis/chonkie-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/feyninc/chonkie-api/revisions/29d7b471b697/schema)
