> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aiql.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Split text into chunks

> Break converted text into smaller chunks with the split tool

The `split` tool breaks markdown content into smaller chunks. Chunking keeps each piece small enough for the `shape` and `extract` steps to process reliably.

## Prerequisites

* An AiQL API key in the `AIQL_API_KEY` environment variable
* Markdown content from the [Convert](/cookbooks/convert) step

## Split markdown content

Send the markdown to split. Tool requests authenticate with a Bearer token and do not need a workspace.

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://api.aiql.io/split \
    -H "Authorization: Bearer $AIQL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"markdown": "# Report\n\nThe full markdown content..."}'
  ```

  ```python Python theme={null}
  import os
  from aiql import AiQL

  client = AiQL(api_key=os.environ["AIQL_API_KEY"])

  chunks = client.tools.split(markdown=markdown)
  print(len(chunks))
  ```

  ```typescript TypeScript theme={null}
  import { AiQL } from "@aiql.io/sdk";

  const client = new AiQL({ apiKey: process.env.AIQL_API_KEY });

  const chunks = await client.tools.split({ markdown });
  console.log(chunks.length);
  ```
</CodeGroup>

The response is an ordered list of chunks. Smaller chunks isolate context more tightly; larger chunks keep related content together.

## Next step

Pass the chunks to [Shape](/cookbooks/shape) to infer the schema of the data.

<Note>
  `split` is billed at 1 credit per 1,000 words of converted text, with a minimum of 1 credit. See [Pricing](/pricing) for details.
</Note>
