Skip to main content
When vault search returns a truncated text_preview, use chunk retrieval to fetch the full chunk text and nearby chunks from the document manifest stored in Vault.

Endpoint

Endpoint
GET /vault/:id/objects/:objectId/chunks

When to use it

Search is optimized for relevance and compact responses. That means results often contain only a preview of the matched chunk. If the match lands inside a table, exhibit list, or a passage that spans several chunks, call read-chunks to recover the surrounding text. Example workflow:
  1. Search returns chunk 13 with a partial exhibit table.
  2. Request start=12&end=14.
  3. Read the full text of chunks 12, 13, and 14 together.
Ranges are inclusive and capped at 10 chunks per request.

Parameters

ParameterTypeRequiredDescription
idstringYesVault ID
objectIdstringYesProcessed object ID
startintegerNoFirst chunk index to return. Defaults to 0.
endintegerNoLast chunk index to return, inclusive. If omitted, only the start chunk is returned.

Example

curl "https://api.case.dev/vault/$VAULT_ID/objects/$OBJECT_ID/chunks?start=12&end=14" \
  -H "Authorization: Bearer $CASEDEV_API_KEY"
Response
{
  "object_id": "obj_abc123",
  "vault_id": "vault_def456",
  "chunks": [
    {
      "index": 12,
      "text": "full text of chunk 12...",
      "page_start": 5,
      "page_end": 5,
      "word_start_index": 5544,
      "word_end_index": 6055
    },
    {
      "index": 13,
      "text": "full text of chunk 13...",
      "page_start": 5,
      "page_end": 6,
      "word_start_index": 6056,
      "word_end_index": 6532
    },
    {
      "index": 14,
      "text": "full text of chunk 14...",
      "page_start": 6,
      "page_end": 6,
      "word_start_index": 6533,
      "word_end_index": 6881
    }
  ],
  "total_chunks": 42
}

Response fields

FieldDescription
object_idObject that owns the returned chunks
vault_idVault containing the object
chunksFull chunk entries for the requested range
total_chunksTotal stored chunk count for the object
Each chunk includes:
FieldDescription
indexChunk index within the document
textFull text of the chunk
page_start, page_endPDF page span when available
word_start_index, word_end_indexOCR word range when available

Notes

  • end is clamped to the document’s final chunk if you request past the end.
  • Requests where start is out of range return an error.
  • Objects without stored chunks return total_chunks: 0 and an empty chunks array.