✂️

Text Chunker API

Split any text into overlapping chunks for RAG pipelines. Three strategies: token, sentence, and paragraph. Zero external API calls — runs entirely locally. Natural pair for /embeddings.

API Docs $0.001 / request

About this tool

POST /text/chunk splits large text into smaller, optionally-overlapping chunks — the first step in any RAG (Retrieval-Augmented Generation) pipeline. Use it to prepare documents for /embeddings and then store them in /memory/upsert.

  • token — fixed character windows (1 token ≈ 4 chars), reliable for LLM context limits
  • sentence — groups complete sentences up to chunk_size; preserves readability (default)
  • paragraph — groups paragraphs separated by double newlines; ideal for structured documents

Max input: 500,000 characters. Overlap prevents context loss at chunk boundaries.

Quick Start

curl -X POST https://api.iteratools.com/text/chunk \ -H "Authorization: Bearer YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "text": "Your long document goes here...", "chunk_size": 500, "overlap": 50, "strategy": "sentence" }'

Request Parameters

Parameter Type Default Description
text * string Text to chunk (max 500,000 chars)
chunk_size integer 500 Approximate tokens per chunk (1 token ≈ 4 chars)
overlap integer 50 Overlap tokens between consecutive chunks
strategy string sentence token | sentence | paragraph

Response

{ "ok": true, "data": { "chunks": [ "The quick brown fox jumps over the lazy dog.", "This is the second chunk with some overlap context.", "..." ], "count": 12, "strategy": "sentence", "avg_length": 487 } }

RAG Pipeline Example

Use /text/chunk + /embeddings + /memory/upsert for a complete RAG pipeline:

# Step 1: Chunk your document chunks=$(curl -s -X POST https://api.iteratools.com/text/chunk \ -H "Authorization: Bearer YOUR_KEY" \ -d '{"text":"...","strategy":"sentence"}' | jq '.data.chunks') # Step 2: Embed each chunk embeddings=$(curl -s -X POST https://api.iteratools.com/embeddings \ -H "Authorization: Bearer YOUR_KEY" \ -d "{\"text\": $chunks}") # Step 3: Store in memory curl -X POST https://api.iteratools.com/memory/upsert \ -H "Authorization: Bearer YOUR_KEY" \ -d '{"namespace":"docs","id":"chunk-1","text":"..."}'

Pricing

$0.001 per request via x402 micropayment on Base (USDC). Zero external API calls — pure local processing.

Full Documentation Browse All Tools