---
title: "Parse text"
method: POST
path: "/v2/chunking"
tags: ["Chunking"]
---

# Parse text

`POST /v2/chunking`

Split large text documents into smaller, manageable chunks using different chunking strategies optimized for RAG (Retrieval-Augmented Generation) workflows. This endpoint supports multiple chunking algorithms including token-based, sentence-based, recursive, semantic, and specialized strategies.

## Request body

- union — Request payload for text chunking with strategy-specific configuration
  - object — Splits text based on token count. Best for ensuring chunks fit within LLM context windows and maintaining consistent chunk sizes for embedding models.
    - `text` string, required — The text content to be chunked
    - `metadata` boolean — Whether to include metadata for each chunk
    - `return_type` 'chunks' | 'texts' — Return format: chunks (with metadata) or texts (plain strings)
    - `strategy` 'token', required
    - `chunk_size` integer — Maximum tokens per chunk
    - `chunk_overlap` integer — Number of tokens to overlap between chunks
  - object — Splits text at sentence boundaries while respecting token limits. Ideal for maintaining semantic coherence and readability.
    - `text` string, required — The text content to be chunked
    - `metadata` boolean — Whether to include metadata for each chunk
    - `return_type` 'chunks' | 'texts' — Return format: chunks (with metadata) or texts (plain strings)
    - `strategy` 'sentence', required
    - `chunk_size` integer — Maximum tokens per chunk
    - `chunk_overlap` integer — Number of overlapping tokens between chunks
    - `min_sentences_per_chunk` integer — Minimum number of sentences per chunk
  - object — Recursively splits text using a hierarchy of separators (paragraphs, sentences, words). Versatile general-purpose chunker that preserves document structure.
    - `text` string, required — The text content to be chunked
    - `metadata` boolean — Whether to include metadata for each chunk
    - `return_type` 'chunks' | 'texts' — Return format: chunks (with metadata) or texts (plain strings)
    - `strategy` 'recursive', required
    - `chunk_size` integer — Maximum tokens per chunk
    - `separators` string[] — Hierarchy of separators to use for splitting
    - `min_characters_per_chunk` integer — Minimum characters allowed per chunk
  - object — Groups semantically similar sentences using embeddings. Excellent for maintaining topic coherence and context within chunks.
    - `text` string, required — The text content to be chunked
    - `metadata` boolean — Whether to include metadata for each chunk
    - `return_type` 'chunks' | 'texts' — Return format: chunks (with metadata) or texts (plain strings)
    - `strategy` 'semantic', required
    - `chunk_size` integer — Maximum tokens per chunk
    - `threshold` union — Similarity threshold for grouping (0-1) or "auto" for automatic detection
      - number
      - 'auto'
    - `embedding_model` string, required — Embedding model to use for semantic similarity. (Available embedding models)[https://docs.orq.ai/docs/proxy/supported-models#embedding-models]
    - `dimensions` integer — Number of dimensions for the embedding output. Required for text-embedding-3 models. Supported range: 256-3072 for text-embedding-3-large, 256-1536 for text-embedding-3-small.
    - `max_tokens` integer — Maximum number of tokens per embedding request. Default is 8191 for text-embedding-3 models.
    - `mode` 'window' | 'sentence' — Chunking mode: window-based or sentence-based similarity
    - `similarity_window` integer — Window size for similarity comparison
  - object — Agentic LLM-powered chunker that uses AI to determine optimal split points. Best for complex documents requiring intelligent segmentation.
    - `text` string, required — The text content to be chunked
    - `metadata` boolean — Whether to include metadata for each chunk
    - `return_type` 'chunks' | 'texts' — Return format: chunks (with metadata) or texts (plain strings)
    - `strategy` 'agentic', required
    - `model` string, required — Model to use for chunking. (Available models)[https://docs.orq.ai/docs/proxy/supported-models#chat-models]
    - `chunk_size` integer — Maximum tokens per chunk
    - `candidate_size` integer — Size of candidate splits for LLM evaluation
    - `min_characters_per_chunk` integer — Minimum characters allowed per chunk
    - `system_prompt` string — Custom system prompt for the agentic chunker LLM. Overrides the default prompt that instructs the model how to identify chunk boundaries. Maximum 20,000 tokens.
  - object — High-performance SIMD-optimized byte-level chunking. Best for large files (>1MB) where speed and memory efficiency are critical. 2x faster and 3x less memory than token-based chunking.
    - `text` string, required — The text content to be chunked
    - `metadata` boolean — Whether to include metadata for each chunk
    - `return_type` 'chunks' | 'texts' — Return format: chunks (with metadata) or texts (plain strings)
    - `strategy` 'fast', required
    - `target_size` integer — Target chunk size in bytes
    - `delimiters` string — Single-byte delimiter characters. Each character is treated as a separate delimiter (e.g., ".?!" splits on period, question mark, or exclamation). Use escaped sequences for special chars.
    - `pattern` string — Multi-byte pattern for splitting (e.g., "▁" for SentencePiece tokenizers). Takes precedence over delimiters if set.
    - `prefix` boolean — Attach delimiter to start of next chunk instead of end of current chunk
    - `consecutive` boolean — When true, splits at the START of consecutive delimiter runs, keeping the run with the following chunk (e.g., splits before "\n\n\n" not in the middle)
    - `forward_fallback` boolean — Search forward if no delimiter found in backward search window

## Response `200`

Text successfully chunked

- object
  - `chunks` object[], required
    - `text` string, required — The text content of the chunk
    - `index` number, required — The position index of this chunk in the sequence
    - `metadata` object
      - `start_index` number, nullable, required
      - `end_index` number, nullable, required
      - `token_count` number, nullable, required

---

[API](https://skmtc.net/orq-ai/apis/orq-ai-api.md) · [All operations](https://skmtc.net/orq-ai/apis/orq-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/orq-ai/orq-ai-api/versions/41c02aedc7c0/schema)
