Skip to main content
POST
/
chunking
Chunk Document
curl --request POST \
  --url https://api.example.com/chunking \
  --header 'Content-Type: application/json' \
  --data '{}'
{
  "status": "<string>",
  "job_id": "<string>",
  "collection_name": "<string>",
  "error": "<string>"
}

Overview

This endpoint accepts a PDF file upload and queues an asynchronous background job to chunk the document into smaller segments and index them into a Qdrant vector collection. The document is processed in the background, and you can track the job status using the returned job_id.

Request

Body Parameters

file
file
PDF file to upload for chunking and indexing. The file will be saved and processed asynchronously.
doc_path
string
(Legacy) Path to a local PDF file or folder. Use file parameter for uploads instead.
You must provide either file (for uploads) or doc_path (for legacy local paths). If neither is provided, the request will fail.

Response

status
string
required
Current status of the job. Returns "queued" when successfully submitted, or "failed" if the request is invalid.
job_id
string
Unique identifier for the background processing job. Use this with the /chunking/status endpoint to check progress.
collection_name
string
Generated Qdrant collection name where the document chunks will be stored. Format: edu_mate_<uuid>
error
string
Error message if the request failed due to missing parameters.

Example

Upload a PDF file

curl -X POST http://localhost:8000/chunking \
  -F "file=@/path/to/document.pdf"

Response (Success)

{
  "status": "queued",
  "job_id": "a3f7b9c1-4e5d-6789-0abc-def123456789",
  "collection_name": "edu_mate_a1b2c3d4e5f67890abcdef1234567890"
}

Response (Error)

{
  "status": "failed",
  "error": "Provide either 'file' (upload) or 'doc_path' (legacy)."
}

Processing Details

The chunking process runs asynchronously. Poll the /chunking/status endpoint with the returned job_id to check when processing is complete.

Build docs developers (and LLMs) love