Build a retriever over your own data
Create a namespace, ingest a few files, and compose your first search pipeline in the Studio — no API key setup required.
Multi-stage retrieval is what makes Mixpeek a warehouse, not a database. No other system offers composable filter → sort → reduce → enrich → apply pipelines over multimodal data. This is the query language for unstructured data — the equivalent of SQL for embeddings across modalities. See the Retrieval Cookbook for ready-to-copy pipeline configurations.
Anatomy of a Retriever
Minimal Working Example
The simplest retriever that performs a feature search. Note the required fields:collection_identifiersis required at the retriever root level when usingfeature_searchstages — the search needs to know which collections to query. (Accepts collection names or IDs.)input_schemais a flat map of input field name → type definition (e.g.{ "query": { "type": "text", "required": true } }). It’s required when your stages use{{INPUT.*}}template variables — Mixpeek validates inputs against this schema before execution. It is not JSON Schema: map each field name directly to its{ "type": ..., "required": ... }definition — do not wrap it in{ "type": "object", "properties": { ... } }. Fieldtypeis one of the bucket/input types (text,string,number,boolean,date,image,video,pdf,document_reference, …);requireddefaults tofalse.- Each stage needs a
stage_nameand aconfigobject containing thestage_id(e.g.feature_search) and itsparameters.stage_type(the category, e.g.filter) is optional but recommended.
Stage Catalog
Stages are the building blocks of retriever pipelines. Each stage belongs to a category that defines its behavior:Retrieve the live registry with
GET /v1/retrievers/stages. Each entry includes stage_id, category, icon, and parameter schema so you can dynamically build configuration UIs or validations.Live stages: https://api.mixpeek.com/v1/retrievers/stagesFilter Stages
Filter stages reduce the document set while preserving the document schema. Use these at the start of your pipeline to narrow down candidates.Use
GET /v1/retrievers/stages?category=filter to retrieve the current list of filter stages and their parameter schemas.Sort Stages
Sort stages reorder documents without changing the result set. Place these after filters to control ranking.Use
GET /v1/retrievers/stages?category=sort to retrieve the current list of sort stages and their parameter schemas.Reduce Stages
Reduce stages collapse results into aggregated values. Use these for deduplication, sampling, or summarization.Use
GET /v1/retrievers/stages?category=reduce to retrieve the current list of reduce stages and their parameter schemas.Group Stages
Group stages reshape results by bucketing documents into logical groups or clusters.Use
GET /v1/retrievers/stages?category=group to retrieve the current list of group stages and their parameter schemas.Apply Stages
Apply stages transform or restructure documents. Use these to reshape output, call external services, or run custom code.Enrich Stages
Enrich stages add knowledge to documents using AI models, taxonomies, or cross-collection joins.Enrich Stage Details
document_enrich
Joins documents with data from another collection, similar to a SQL LEFT JOIN. Each input document produces exactly one output document with added fields from the target collection. When to use:- Combine data from multiple collections (e.g., products + catalog info)
- Attach user profiles, metadata, or related entities
- Denormalize data at query time
*Required for direct joins; not needed when using
retriever_id or retriever_config.
Examples:
api_call
Enriches documents by calling external HTTP APIs. Enables integration with third-party services (Stripe, GitHub, weather APIs, etc.) to augment documents with real-time data. Parameters:
Authentication Types:
Examples:
json_transform
Applies a Jinja2 template to each document, rendering the template with full document context and replacing the document with the parsed JSON output. Use this to reformat documents for external APIs or reshape data for downstream consumers. Parameters:
Template Context:
Examples:
external_web_search
Performs AI-native web search using Exa’s neural ranking system. Creates new documents from web search results, enabling retriever pipelines to incorporate real-time internet content.This stage creates new documents (0 → M transformation) rather than enriching existing ones. Use it at the start of a pipeline or to augment internal results with external web sources.
Output Schema:
Each result becomes a document with:
metadata.url– Web page URLmetadata.title– Page titlemetadata.text– Text snippet (ifinclude_text=true)metadata.published_date– Publication date (if available)metadata.author– Author name (if available)metadata.search_query– Original query usedmetadata.search_position– 0-indexed position in resultsscore– Exa relevance score
cross_compare
Compares source documents against a reference collection using a cascading match strategy (exact → fuzzy → semantic → visual). Each comparison produces a classified finding with a score and confidence level. Ideal for drift detection, deduplication, and compliance checking.This stage can output either findings (N → M, one document per comparison) or enriched documents (N → N, results attached as a field). Set
output_mode to control this behavior.
Examples:
Call
GET /v1/retrievers/stages to retrieve the latest stage metadata and parameter schemas.
Execution Lifecycle
- Validate Inputs – Mixpeek enforces the retriever’s
input_schema. - Walk Stages – Each stage receives the current working set, runs, and outputs a new set.
- Apply Pagination –
limit,offset,cursor, orkeysetpagination is handled after the final stage. - Return Telemetry – Responses include
stage_statistics,budget, and optional presigned URLs.
Presigned media URLs are short-lived. Any media field in a result
(
thumbnail_url, video_segment_url, face_crop_url, and similar) is a signed
URL minted fresh on each request and it expires after about 24 hours. The
fields are always present, but don’t persist or hard-code a specific URL value —
re-run the query to get a fresh one, or fetch the blob through the document API.ETag– cache validator; pair withIf-None-Matchfor 304 responses.Cache-Control– TTL derived fromcache_config.X-Cache–HITorMISSfor query-level caching.
Filters & Templates
Structured filters support comparison operators (eq, gt, lte, in, etc.) and logical composition (AND, OR, NOT).
Template Namespaces
Stages support dynamic configuration through template expressions using Jinja2 syntax. Both uppercase and lowercase namespace formats are supported and work identically:Mixed usage within the same stage is supported. For example, you can use
{{INPUT.query}} alongside {{context.budget_remaining}} in the same configuration.Retrievers & Caching
- Query cache – caches entire responses keyed by inputs, filters, pagination, and collection index signatures.
- Stage cache – reuse outputs of expensive stages by listing them under
cache_stage_names. - Inference cache – Engine deduplicates identical model calls.
GET /v1/analytics/retrievers/{id}/cache-performance to monitor hit rates and latency improvements.
Pagination Options
Specify the method in
pagination.method when executing a retriever.
Execute a Retriever
credits_used and credits_limit are internal ledger units (1 credit = $0.001). Dollar-based usage and the rate card live in Billing.Batch Execution
Execute a retriever against multiple inputs in a single request. The retriever is fetched and optimized once, then executed concurrently across all queries with bounded parallelism.
Response:
Streaming
For pipelines with LLM stages that take longer than a few seconds per query, use"stream": true to receive results as each query completes:
: keepalive) are sent every 15 seconds to keep the connection alive through proxies. Results arrive out of order as each query finishes — use query_index to match results to inputs.
When to use batch
Anonymous Retrievers
Anonymous retrievers let you execute a retriever pipeline in a single API call without persisting it. This is ideal for:- Prototyping and experimentation – Test stage configurations quickly without cluttering your retriever list
- Dynamic pipelines – Build pipelines on-the-fly based on user context or application logic
- One-off queries – Run complex searches that don’t need to be reused
- CI/CD testing – Validate retriever configurations in automated tests without creating permanent resources
retriever_id is created or stored.
Publishing & Display Config
Retrievers can be published as public search interfaces hosted atmxp.co. Publishing requires a display_config that controls how the UI renders inputs, results, and styling.
Set display_config when creating or updating a retriever via PATCH /v1/retrievers/{id}:
Once
display_config is set, publish the retriever with POST /v1/retrievers/{id}/publish.
Maintenance & Versioning
- Use
PATCH /v1/retrievers/{id}to rename retrievers or adjust cache settings (stages and schema are immutable; create a new retriever for breaking changes). - List retrievers with filters, search, and sort:
POST /v1/retrievers/list. - Retrieve execution history:
GET /v1/retrievers/{id}/executions. - Diagnose pipelines without executing:
POST /v1/retrievers/{id}/explain.
Interaction Feedback
Capture user feedback with/v1/retrievers/interactions to power downstream analytics, learning-to-rank, or personalized retrieval:
Best Practices
- Start narrow – run a single search stage before adding rerankers or joins.
- Push filters early – stage-level filters shrink the candidate set before expensive operations.
- Use JOIN strategies wisely –
directfor key-based joins,retrieverfor similarity joins; setjoin_strategyto control merge behavior. - Enable caching – stage caching plus query caching dramatically reduces latency for repeat queries.
- Monitor analytics – use retriever analytics endpoints to optimize parameters, detect slow stages, and understand cache ROI.

