import Morphik from 'morphik';
const client = new Morphik({
apiKey: process.env['MORPHIK_API_KEY'], // This is the default and can be omitted
});
const chunkResults = await client.retrieve.chunks.create();
console.log(chunkResults);curl https://api.morphik.ai/retrieve/chunks \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $MORPHIK_API_KEY" \
-d '{}'[
{
"content": "<string>",
"score": 123,
"document_id": "<string>",
"chunk_number": 123,
"metadata": {},
"content_type": "<string>",
"filename": "<string>",
"download_url": "<string>",
"is_padding": false
}
]{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Retrieve Chunks
Retrieve relevant chunks.
The optional request.filters payload accepts equality checks (which also match scalars inside JSON arrays)
plus the logical operators $and, $or, $nor, and $not. Field-level predicates include $eq, $ne,
$in, $nin, $exists, $type, $regex, $contains, and the comparison operators $gt, $gte, $lt,
and $lte. Comparison clauses evaluate typed metadata (number, decimal, datetime, or date) and
raise detailed validation errors when operands cannot be coerced. Regex filters allow the optional i flag
for case-insensitive matching, while $contains performs substring checks (case-insensitive by default,
configurable via case_sensitive). Filters can be nested freely, for example:
{
"$and": [
{"category": "policy"},
{"$or": [{"region": "emea"}, {"priority": {"$in": ["p0", "p1"]}}]}
]
}
Returns a list of ChunkResult objects ordered by relevance.
import Morphik from 'morphik';
const client = new Morphik({
apiKey: process.env['MORPHIK_API_KEY'], // This is the default and can be omitted
});
const chunkResults = await client.retrieve.chunks.create();
console.log(chunkResults);curl https://api.morphik.ai/retrieve/chunks \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $MORPHIK_API_KEY" \
-d '{}'[
{
"content": "<string>",
"score": 123,
"document_id": "<string>",
"chunk_number": 123,
"metadata": {},
"content_type": "<string>",
"filename": "<string>",
"download_url": "<string>",
"is_padding": false
}
]{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Body
Base retrieve request model
Was this page helpful?

