/datasets/{dataset_id}/documents/{document_id}/segmentsCreate document chunks
Creates one or more chunks within a document in a knowledge base. Provide at least one item in segments, and include non-empty content for each chunk; Q&A-mode documents also require answer. The response includes the created chunks and the document’s chunking mode.
- IdempotentThe SDK sends
Idempotency-Key, so a retried request is only applied once.
Chunk creation payload containing at least one chunk object.
2 documented failures
invalid_paramExceeded maximum segments limit of 1000.
invalid_param (segments limit)
provider_not_initializeNo Embedding Model available. Please configure a valid provider in the Settings -> Model Provider.
provider_not_initialize
One documented failure
forbiddenDataset api access is not enabled.
forbidden (api access)
One documented failure
not_foundDataset not found.
not_found
One documented failure
service_unavailableUnable to verify vector space usage right now. Please try again later.
service_unavailable
A 400 is returned for invalid chunk fields, a missing answer in Q&A mode, too many chunks in one request, an unconfigured embedding model, or schema validation failures; a 403 is returned when access, subscription capacity, rate limits, or plan restrictions block the request. A 404 is returned when the knowledge base or document is missing, incomplete, or disabled; a 503 is returned when vector-space usage cannot be verified on the Cloud Sandbox plan. The dataset_id path parameter and document_id path parameter must be UUIDs. The segments array must contain at least one object, and each object must include non-empty content.