Skip to main content
POST
/
v2
/
chunking
cURL
curl --request POST \
  --url https://api.orq.ai/v2/chunking \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "text": "The quick brown fox jumps over the lazy dog. This is a sample text that will be chunked into smaller pieces. Each chunk will maintain context while respecting the maximum chunk size.",
  "strategy": "semantic",
  "chunk_size": 256,
  "threshold": 0.8,
  "embedding_model": "openai/text-embedding-3-small",
  "dimensions": 512,
  "mode": "window",
  "similarity_window": 1,
  "metadata": true
}
'
{
  "chunks": [
    {
      "id": "01HQ3K4M5N6P7Q8R9SATBVCWDX",
      "text": "The quick brown fox jumps over the lazy dog.",
      "index": 0,
      "metadata": {
        "start_index": 0,
        "end_index": 44,
        "token_count": 10
      }
    },
    {
      "id": "01HQ3K4M5N6P7Q8R9SATBVCWDY",
      "text": "This is a sample text that will be chunked into smaller pieces.",
      "index": 1,
      "metadata": {
        "start_index": 45,
        "end_index": 108,
        "token_count": 12
      }
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Request payload for text chunking with strategy-specific configuration

text
string
required

The text content to be chunked

strategy
enum<string>
required
Available options:
token
metadata
boolean
default:true

Whether to include metadata for each chunk

return_type
enum<string>
default:chunks

Return format: chunks (with metadata) or texts (plain strings)

Available options:
chunks,
texts
chunk_size
integer
default:512

Maximum tokens per chunk

chunk_overlap
integer
default:0

Number of tokens to overlap between chunks

Required range: x >= 0

Response

200 - application/json

Text successfully chunked

chunks
object[]
required