> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mixpeek.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Execution

> Get execution details and statistics.



## OpenAPI

````yaml get /v1/retrievers/{retriever_id}/executions/{execution_id}
openapi: 3.1.0
info:
  title: Mixpeek API
  description: >-
    This is the Mixpeek API, providing access to various endpoints for data
    processing and retrieval.
  termsOfService: https://mixpeek.com/terms
  contact:
    name: Mixpeek Support
    url: https://mixpeek.com/contact
    email: info@mixpeek.com
  version: '0.82'
servers:
  - url: https://api.mixpeek.com
    description: Production
security: []
paths:
  /v1/retrievers/{retriever_id}/executions/{execution_id}:
    get:
      tags:
        - Retrievers
      summary: Get Execution
      description: Get execution details and statistics.
      operationId: get_execution_v1_retrievers__retriever_id__executions__execution_id__get
      parameters:
        - name: retriever_id
          in: path
          required: true
          schema:
            type: string
            description: Retriever ID or name.
            title: Retriever Id
          description: Retriever ID or name.
        - name: execution_id
          in: path
          required: true
          schema:
            type: string
            description: Execution identifier.
            title: Execution Id
          description: Execution identifier.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecutionDetail'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ExecutionDetail:
      properties:
        retriever_id:
          type: string
          title: Retriever Id
          description: >-
            The retriever that was executed. Use this to link interactions back
            to the retriever for learned fusion.
          default: ''
          examples:
            - ret_abc123def456
        execution_id:
          type: string
          title: Execution Id
          description: >-
            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.
          examples:
            - exec_abc123def456
            - exec_xyz789
        status:
          type: string
          title: Status
          description: >-
            REQUIRED. Execution status indicating current state. Common values:
            'completed', 'failed', 'processing', 'pending'. Check this field to
            determine if execution succeeded or requires retry.
          examples:
            - completed
            - failed
            - processing
        documents:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Documents
          description: >-
            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'.
          examples:
            - - document_id: doc_123
                payload:
                  metadata:
                    category: AI
                  text: Sample content
                score: 0.95
              - document_id: doc_456
                payload:
                  metadata:
                    category: ML
                  text: Another document
                score: 0.88
        results:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Results
          description: >-
            DEPRECATED alias for `documents`. Previously a computed field that
            duplicated `documents` byte-for-byte in every response (~half the
            payload). It is no longer populated by default to cut response size;
            pass `?include_legacy_results=true` to restore it during migration.
            Prefer `documents` — it is and has always been the canonical field.
            See FRUSTRATIONS.md 2026-04-02 / 2026-06-29.
        pagination:
          additionalProperties: true
          type: object
          title: Pagination
          description: >-
            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.
          examples:
            - has_next: true
              limit: 10
              offset: 0
              total: 100
            - cursor: abc123
              has_next: false
              page_size: 20
        stage_statistics:
          $ref: '#/components/schemas/RetrieverExecutionStatistics'
          description: >-
            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:
          additionalProperties: true
          type: object
          title: Budget
          description: >-
            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.
          examples:
            - credits_remaining: 99.5
              credits_used: 0.5
              time_used_ms: 150
        cached_at:
          anyOf:
            - type: number
            - type: 'null'
          title: Cached At
          description: >-
            OPTIONAL. Unix timestamp (seconds) when this result was cached.
            Present only when the full response was served from the
            retriever-level cache. Compute freshness as: time.time() -
            cached_at.
        warnings:
          items:
            type: string
          type: array
          title: Warnings
          description: >-
            OPTIONAL. Execution warnings that did not prevent results but
            indicate potential issues — e.g. filtering on unindexed fields.
            Empty when there are no warnings.
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: >-
            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.
          examples:
            - 'Retriever execution failed: Collection not found'
            - 'Budget exceeded: Maximum credits limit reached'
        optimization_applied:
          type: boolean
          title: Optimization Applied
          description: >-
            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.
          default: false
          examples:
            - true
            - false
        optimization_summary:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Optimization Summary
          description: >-
            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.
          examples:
            - 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
            - optimization_time_ms: 2.1
              optimized_stage_count: 3
              original_stage_count: 3
              rules_applied: []
              stage_reduction_pct: 0
        learned_fusion_context:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Learned Fusion Context
          description: >-
            OPTIONAL. Learned fusion context when the retriever uses learned
            fusion (auto-tune) for weight optimization. Contains: context_key
            (resolution level used), sampled_weights (per-feature weight
            vector), feature_uris (features that were weighted),
            effective_exploration (Thompson sampling exploration rate),
            context_level ('personal', 'segment', or 'global'). Only present
            when learned fusion is active on this retriever.
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Timestamp when execution began
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Completed At
          description: Timestamp when execution finished
        current_stage:
          anyOf:
            - type: string
            - type: 'null'
          title: Current Stage
          description: Stage currently running when execution in-flight
        stages_completed:
          type: integer
          minimum: 0
          title: Stages Completed
          description: Number of stages finished so far
          default: 0
        total_stages:
          type: integer
          minimum: 0
          title: Total Stages
          description: Total stages configured
          default: 0
      type: object
      required:
        - execution_id
        - status
      title: ExecutionDetail
      description: Alias wrapper for execution detail documentation.
    ErrorResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Always false for error responses
          default: false
        status:
          type: integer
          title: Status
          description: HTTP status code for this error
        error:
          $ref: '#/components/schemas/ErrorDetail'
          description: Error details payload
      type: object
      required:
        - status
        - error
      title: ErrorResponse
      description: Error response model.
      examples:
        - error:
            details:
              id: ns_123
              resource: namespace
            message: Namespace not found
            type: NotFoundError
          status: 404
          success: false
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    RetrieverExecutionStatistics:
      properties:
        stages:
          additionalProperties:
            $ref: '#/components/schemas/StageStatistics'
          type: object
          title: Stages
          description: Per-stage statistics keyed by stage instance name (REQUIRED).
        total_time_ms:
          type: number
          minimum: 0
          title: Total Time Ms
          description: Total retriever execution time in milliseconds (REQUIRED).
          default: 0
        credits_used:
          type: number
          minimum: 0
          title: Credits Used
          description: Total credits consumed across all stages (OPTIONAL in MVP).
          default: 0
      type: object
      title: RetrieverExecutionStatistics
      description: Aggregated execution statistics for an entire retriever execution run.
    ErrorDetail:
      properties:
        message:
          type: string
          title: Message
          description: Human-readable error message
        type:
          type: string
          title: Type
          description: Stable error type identifier (machine-readable)
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: >-
            Fine-grained error code for programmatic handling (e.g.,
            namespace_name_taken, feature_extractor_not_found). Present only
            when consumers may need to branch on a specific error condition.
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: >-
            Optional structured details to help debugging (validation errors,
            IDs, etc.)
      type: object
      required:
        - message
        - type
      title: ErrorDetail
      description: Error detail model.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    StageStatistics:
      properties:
        input_count:
          type: integer
          minimum: 0
          title: Input Count
          description: Number of documents received by the stage (REQUIRED).
        output_count:
          type: integer
          minimum: 0
          title: Output Count
          description: Number of documents emitted by the stage (REQUIRED).
        duration_ms:
          type: number
          minimum: 0
          title: Duration Ms
          description: Wall-clock duration in milliseconds (REQUIRED).
        efficiency:
          type: number
          minimum: 0
          title: Efficiency
          description: Output/Input ratio. 0 when input_count is 0 (REQUIRED).
        cache_hit:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Cache Hit
          description: Indicates whether the result originated from stage cache (OPTIONAL).
        cached_at:
          anyOf:
            - type: number
            - type: 'null'
          title: Cached At
          description: >-
            Unix timestamp when this stage result was cached. Present only on
            cache hits.
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: >-
            Stage-specific error message if execution failed but retriever
            execution continued (OPTIONAL).
        llm_calls:
          anyOf:
            - type: integer
              minimum: 0
            - type: 'null'
          title: Llm Calls
          description: Number of LLM invocations performed by the stage (OPTIONAL).
        tokens_used:
          anyOf:
            - type: integer
              minimum: 0
            - type: 'null'
          title: Tokens Used
          description: Total tokens consumed by the stage (OPTIONAL, only for LLM stages).
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
          description: >-
            Stage-specific metadata containing additional execution details
            (OPTIONAL). For example, join stages include: join_strategy,
            join_type, matched_count, match_rate, etc. LLM stages may include:
            model_name, temperature, max_tokens, etc.
      type: object
      required:
        - input_count
        - output_count
        - duration_ms
        - efficiency
      title: StageStatistics
      description: Execution metrics for a single stage in a retriever execution run.
      examples:
        - cache_hit: false
          duration_ms: 123.4
          efficiency: 0.05
          input_count: 5000
          output_count: 250

````