Document Chunks
Get the list of chunks for a specified document. This can be used to debug document splitting effects and retrieve hit contents.
Try It
GET
/documents/document_chunks?doc_id=doc_1https://api-platform.ope.aiAuthentication
Uses Bearer Token authentication.
- Header:
Authorization: Bearer <token> - Example:
Authorization: Bearer sk-xxxxxx
Query Parameters
| Field | Type | Required | Description | Default / Range |
|---|---|---|---|---|
doc_id | string | Yes | The ID of the document to query chunks for | - |
Request Examples
- cURL
- JavaScript
curl -X GET "https://api-platform.ope.ai/documents/document_chunks?doc_id=doc_1" \
-H "Authorization: Bearer $OPEAI_API_KEY"
const url = new URL("https://api-platform.ope.ai/documents/document_chunks");
url.searchParams.set("doc_id", "doc_1");
const res = await fetch(url, {
headers: {
Authorization: `Bearer ${process.env.OPEAI_API_KEY}`,
},
});
console.log(await res.json());
Response Example
{
"chunks": [
{
"chunk_id": "chunk_1",
"chunk_text": "This is the content of the document chunk.",
"enabled": true
}
]
}
Error Responses
| Status Code | Scenario | Description |
|---|---|---|
401 | Authentication failed | API Key is missing, invalid, or has insufficient permissions |
422 | Validation failed | doc_id is missing or in an incorrect format |
500 | Query failed | Database query failed or query result is abnormal |