Skip to main content
POST
/
v1
/
retrievers
/
execute
Execute Anonymous Retriever
curl --request POST \
  --url https://api.mixpeek.com/v1/retrievers/execute \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --header 'X-Namespace: <x-namespace>' \
  --data '
{
  "collection_identifiers": [
    "<string>"
  ],
  "input_schema": {},
  "stages": [
    {
      "stage_name": "<string>",
      "config": {},
      "stage_type": "filter",
      "batch_size": "<string>",
      "description": "<string>"
    }
  ],
  "inputs": {},
  "budget_limits": {
    "max_credits": 100,
    "max_time_ms": 60000
  }
}
'
{
  "execution_id": "<string>",
  "status": "<string>",
  "documents": [
    {}
  ],
  "pagination": {},
  "stage_statistics": {
    "stages": {},
    "total_time_ms": 0,
    "credits_used": 0
  },
  "budget": {},
  "error": "Retriever execution failed: Collection not found",
  "optimization_applied": false,
  "optimization_summary": {
    "optimization_time_ms": 8.2,
    "optimized_stage_count": 3,
    "original_stage_count": 5,
    "rules_applied": [
      "push_down_filters",
      "group_by_push_down"
    ],
    "stage_reduction_pct": 40
  }
}

Headers

Authorization
string
required

REQUIRED: Bearer token authentication using your API key. Format: 'Bearer sk_xxxxxxxxxxxxx'. You can create API keys in the Mixpeek dashboard under Organization Settings.

X-Namespace
string
required

REQUIRED: Namespace identifier for scoping this request. All resources (collections, buckets, taxonomies, etc.) are scoped to a namespace. You can provide either the namespace name or namespace ID. Format: ns_xxxxxxxxxxxxx (ID) or a custom name like 'my-namespace'

Body

application/json

Request to execute a retriever anonymously (ad-hoc) without persistence.

This combines retriever creation parameters with execution inputs to allow one-time retrieval without saving the retriever configuration.

Use Cases: - One-time queries without polluting retriever registry - Testing retriever configurations before persisting - Dynamic retrieval with varying stage configurations - Temporary search operations

Behavior: - Retriever is NOT saved to database - Execution history is NOT tracked - Response includes X-Execution-Mode: anonymous header - execution_metadata.retriever_persisted = False

Examples: Simple anonymous search: { "collection_identifiers": ["col_123"], "input_schema": {"query": {"type": "text", "required": True}}, "stages": [{ "stage_name": "search", "stage_type": "filter", "config": { "stage_id": "feature_filter", "parameters": { "feature_uris": [{ "uri": "urn:embedding:text:bge_base_en_v1_5:1", "input": {"text": "{{inputs.query}}"} }], "limit": 10 } } }], "inputs": {"query": "machine learning"}, "limit": 25 }

collection_identifiers
string[]
required

REQUIRED. Collection identifiers (names or IDs) to query. Can be collection names or IDs. Names are automatically resolved.

Minimum array length: 1
input_schema
Input Schema · object
required

REQUIRED. Input schema defining expected inputs. Each key is an input name, value is a BucketSchemaField.

stages
StageConfig · object[]
required

REQUIRED. Ordered list of stage configurations. At least one stage is required for execution.

Minimum array length: 1
inputs
Inputs · object
required

REQUIRED. Input values matching the input_schema. These values are passed to stages for parameterization.

budget_limits
BudgetLimits · object

OPTIONAL. Budget limits for execution.

Example:
{ "max_credits": 100, "max_time_ms": 60000 }

Response

Successful Response

Response from retriever execution.

execution_id
string
required

REQUIRED. Unique identifier for this execution run. Use this ID to track execution status, retrieve execution details, or query execution history. Format: 'exec_' prefix followed by alphanumeric token.

status
string
required

REQUIRED. Execution status indicating current state. Common values: 'completed', 'failed', 'processing', 'pending'. Check this field to determine if execution succeeded or requires retry.

documents
Documents · object[]

REQUIRED. Final document results after retriever completion. Contains documents that passed through all retriever stages. Each document may include: document_id, payload (full document data), score (relevance score), metadata (collection-specific fields), and any fields added by enrichment/join stages. Empty array indicates no documents matched the query criteria. Note: Legacy format may use 'final_results' instead of 'documents'.

pagination
Pagination · object

REQUIRED. Pagination metadata structure. Format varies by pagination method: Offset pagination: {total, limit, offset, has_next, has_previous}, Cursor pagination: {cursor, has_next, page_size}, Keyset pagination: {next_cursor, has_next}. Use this to navigate through result pages.

stage_statistics
RetrieverExecutionStatistics · object

REQUIRED. Per-stage execution statistics including timing, document counts, cache hit rates, and stage-specific metrics. Use this to understand retriever performance and identify bottlenecks.

budget
Budget · object

REQUIRED. Budget usage snapshot for this execution. Contains: credits_used (credits consumed), credits_remaining (remaining budget), time_used_ms (execution time), and budget limits. Use this to track resource consumption and enforce budget limits.

error
string | null

OPTIONAL. Retriever-level error message if execution failed. Only present when status='failed'. Contains human-readable error description to help diagnose the failure. Check stage_statistics for stage-specific errors.

Example:

"Retriever execution failed: Collection not found"

optimization_applied
boolean
default:false

OPTIONAL. Whether automatic pipeline optimizations were applied before execution. Mixpeek automatically optimizes retrieval pipelines for performance by reordering stages, merging operations, and pushing work to the database layer. Optimizations preserve logical equivalence - you get the same results, just faster. When true, see optimization_summary for details about what changed.

optimization_summary
Optimization Summary · object

OPTIONAL. Summary of pipeline optimizations applied before execution. Only present when optimization_applied=true. Contains: - original_stage_count: Number of stages in your original pipeline - optimized_stage_count: Number of stages after optimization - optimization_time_ms: Time spent optimizing (typically <100ms) - rules_applied: List of optimization rules that fired - stage_reduction_pct: Percentage reduction in stage count Use this to understand how the optimizer improved your pipeline. See OptimizationRuleType enum for detailed rule descriptions.

Example:
{
"optimization_time_ms": 8.2,
"optimized_stage_count": 3,
"original_stage_count": 5,
"rules_applied": ["push_down_filters", "group_by_push_down"],
"stage_reduction_pct": 40
}