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

# Get a past evaluation

> Reads only. Returns an evaluation of this organization and the key's environment, including assignment_mode and the submitted subject when stored. Subject is absent when content was not stored (store_content: false); another environment's evaluation is 404, so a test key never reads production traffic. The web app (WebApi) may not read evaluations (403): a blind spot-check card carries the id.



## OpenAPI

````yaml /openapi.json get /v1/evaluations/{evaluation_id}
openapi: 3.1.0
info:
  title: Moonbounce Decisions API
  version: 0.0.0
  description: >-
    Moonbounce decisions: evaluate items against a decision spec (features
    combined by aggregators), record feedback and seed examples, review a ranked
    queue, and improve the spec through suggestions that ship as code diffs,
    each with a preview (backtest) and an evidence label.


    **Authentication.** Send an API key as `Authorization: Bearer <key>` on
    every operation except `GET /health` and `POST /v1/specs/hash`. Call the API
    from a server, never a browser: a key must not reach one, and the API sends
    no CORS headers. A key belongs to one organization and one environment:
    production, or test for a key with the `env:test` permission. Test traffic
    never counts as production traffic.


    **Requests.** JSON bodies (`Content-Type: application/json`) of at most 1
    MB, parsed strictly: duplicate keys, lone surrogates, integers outside
    ±(2^53 - 1), `__proto__` keys, U+0000 and nesting deeper than 64 are a 400.


    **Retries.** Send an `Idempotency-Key` on every POST under /v1 that takes
    one (all but `POST /v1/specs/hash`). Keep it for the request's retries. The
    same key with the same request returns the first stored result, marked
    `Idempotent-Replayed: true`, for 24 hours (410 if that result was since
    deleted); with another request it is 422 IDEMPOTENCY_KEY_REUSED. Keys are
    scoped to the organization and environment across every operation, so use a
    fresh key per request. A request that failed before its result was stored
    runs again when retried. 429 and 503 under /v1 may carry `Retry-After`
    (seconds); a daily QUOTA_EXCEEDED cap instead names its reset time.


    **Errors.** Every error under /v1 is `{"error": {"type", "message",
    "reason"?, "param"?, "details"?}}` (ErrorBody); `GET /health` answers its
    own shape. Every response carries a `Request-Id` header. Rate limits apply
    per key and per client IP, counted per Cloudflare location.
servers:
  - url: https://api.moonbounce.ai
    description: Production
security: []
paths:
  /v1/evaluations/{evaluation_id}:
    get:
      tags:
        - evaluate
      summary: Get a past evaluation
      description: >-
        Reads only. Returns an evaluation of this organization and the key's
        environment, including assignment_mode and the submitted subject when
        stored. Subject is absent when content was not stored (store_content:
        false); another environment's evaluation is 404, so a test key never
        reads production traffic. The web app (WebApi) may not read evaluations
        (403): a blind spot-check card carries the id.
      operationId: getEvaluation
      parameters:
        - schema:
            $ref: '#/components/schemas/EvlId'
          required: true
          name: evaluation_id
          in: path
      responses:
        '200':
          description: The evaluation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EvaluationResponse'
        '400':
          description: 'Invalid request: `param` names the field at fault when one applies'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '401':
          description: Missing or invalid API key (reason KEY_INVALID)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '403':
          description: The key may not do this
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '404':
          description: Not found, or not in this key's organization and environment
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '429':
          description: >-
            RATE_LIMITED: retry after Retry-After seconds; QUOTA_EXCEEDED:
            details.reset_at gives the daily reset time (no Retry-After), or
            details.too_large asks for a smaller request
          headers:
            Retry-After:
              schema:
                type: string
                description: Seconds to wait before retrying, when waiting helps.
              required: false
              description: Seconds to wait before retrying, when waiting helps.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '503':
          description: >-
            Temporarily unavailable, with Retry-After (for example reason
            AUTH_UNAVAILABLE, ENGINE_UNAVAILABLE or STORE_UNAVAILABLE): retry
            with the same Idempotency-Key
          headers:
            Retry-After:
              schema:
                type: string
                description: Seconds to wait before retrying, when waiting helps.
              required: true
              description: Seconds to wait before retrying, when waiting helps.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
      security:
        - bearerAuth:
            - decisions:evaluate
components:
  schemas:
    EvlId:
      type: string
      pattern: >-
        ^evl_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
    EvaluationResponse:
      type: object
      properties:
        environment:
          $ref: '#/components/schemas/Environment'
        id:
          $ref: '#/components/schemas/EvlId'
        decision_id:
          $ref: '#/components/schemas/DecisionId'
        version:
          type: object
          properties:
            structure:
              $ref: '#/components/schemas/VersionHash'
            weights:
              $ref: '#/components/schemas/VersionHash'
            weights_source:
              type: string
              enum:
                - pinned
                - default
                - live
                - carried
              description: >-
                Where the weights came from. v1 returns "pinned" or "default";
                "live" and "carried" are reserved. Tolerate values added later.
            weights_fitted:
              type: boolean
            binding:
              type: integer
              minimum: 1
            engine_profile:
              type: string
          required:
            - structure
            - weights
            - weights_source
            - weights_fitted
            - binding
            - engine_profile
          additionalProperties: false
        status:
          $ref: '#/components/schemas/EvaluateStatus'
        score:
          type: number
        outcome:
          $ref: '#/components/schemas/Name'
        nodes:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/NodeValue'
          description: >-
            The value of each of the spec's named nodes, features and
            aggregators alike, keyed by node name. Every value carries its
            `type`; a node with an answer has `value`, one without has
            `abstained` or `failed`.
        engines:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/EngineUse'
        outcomes:
          $ref: '#/components/schemas/Outcomes'
        usage:
          $ref: '#/components/schemas/Usage'
        cost:
          type: object
          properties:
            engine_calls:
              type: integer
              minimum: 0
              description: >-
                On evaluate and seeds, upstream engine calls reported in usage,
                including retries; one call can answer several features (Jev
                compiles them). On previews, features sent to engines, not
                upstream calls.
            cache_hits:
              type: integer
              minimum: 0
              description: >-
                Feature answers reused from cache. Only previews use the cache
                today; evaluate and seeds report 0.
            input_tokens:
              type: integer
              minimum: 0
            usd_micros:
              type: integer
              minimum: 0
          required:
            - engine_calls
            - cache_hits
            - input_tokens
            - usd_micros
          additionalProperties: false
          description: absent if no spend was recorded for this evaluation
        item_id:
          type: string
        summary:
          type: string
        metadata:
          $ref: '#/components/schemas/Metadata'
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/Warning'
        assignment_mode:
          $ref: '#/components/schemas/AssignmentMode'
        subject:
          type: array
          items:
            $ref: '#/components/schemas/ContentPart'
          description: >-
            The subject as submitted. Absent when content was not stored
            (store_content: false).
      required:
        - environment
        - id
        - decision_id
        - version
        - status
        - nodes
        - engines
        - usage
        - item_id
        - assignment_mode
      additionalProperties: false
    ErrorBody:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              $ref: '#/components/schemas/ErrorType'
            reason:
              type: string
              pattern: ^[A-Z][A-Z0-9_]+$
              description: >-
                Set where a caller can act on it, one of the reasons in the
                ErrorReason schema. New reasons may be added: treat an unknown
                one by the status and `type`.
            message:
              type: string
              description: For people; don't parse it.
            param:
              type: string
              description: >-
                The request field at fault, as a dotted path (`subject.0.text`,
                `claims.1.value`).
            details:
              type: object
              additionalProperties: {}
          required:
            - type
            - message
          additionalProperties: false
      required:
        - error
      additionalProperties: false
    Environment:
      type: string
      enum:
        - production
        - test
      description: >-
        The environment of the key that made the call: `production` or `test`.
        Evaluations, feedback, reviews and suggestions are separate per
        environment; registered structures are shared.
    DecisionId:
      type: string
      pattern: ^[a-z][a-z0-9_.-]{0,127}$
    VersionHash:
      type: string
      pattern: ^sha256:[0-9a-f]{64}$
    EvaluateStatus:
      type: string
      enum:
        - scored
        - no_outcomes
        - abstained
    Name:
      type: string
      pattern: ^[a-z][a-z0-9_]{0,63}$
    NodeValue:
      anyOf:
        - $ref: '#/components/schemas/Abstained'
        - $ref: '#/components/schemas/Failed'
        - type: object
          properties:
            type:
              type: string
              enum:
                - boolean
            value:
              type: number
              minimum: 0
              maximum: 1
          required:
            - type
            - value
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              enum:
                - combine
            value:
              type: number
            contributions:
              type: object
              additionalProperties:
                type: number
          required:
            - type
            - value
            - contributions
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              enum:
                - calibrate
            value:
              type: number
              minimum: 0
              maximum: 1
            calibrated:
              type: boolean
          required:
            - type
            - value
            - calibrated
          additionalProperties: false
    EngineUse:
      type: object
      properties:
        engine:
          type: string
        model:
          type: string
        resolved_model:
          type: string
        adapter:
          type: string
        cached:
          type: boolean
      required:
        - engine
        - model
        - resolved_model
        - adapter
        - cached
      additionalProperties: false
    Outcomes:
      type: object
      properties:
        below:
          type: string
          pattern: ^[a-z][a-z0-9_]{0,63}$
          description: The outcome for a score under the first cut.
        cuts:
          type: array
          items:
            type: object
            properties:
              at:
                type: number
              outcome:
                $ref: '#/components/schemas/Name'
            required:
              - at
              - outcome
            additionalProperties: false
          minItems: 1
          maxItems: 9
        abstain:
          $ref: '#/components/schemas/Name'
      required:
        - below
        - cuts
      additionalProperties: false
    Usage:
      type: object
      properties:
        input_tokens:
          type: integer
        output_tokens:
          type: integer
      required:
        - input_tokens
        - output_tokens
      additionalProperties: false
    Metadata:
      type: object
      additionalProperties:
        anyOf:
          - type: string
            maxLength: 512
          - type: number
          - type: boolean
          - type: 'null'
      description: >-
        Caller key-values, stored with the evaluation and never shown to the
        model. Keys starting `mb.` are reserved for Moonbounce provenance:
        `mb.commit`, `mb.branch`, `mb.service` and `mb.release`, which say where
        a call came from.
    Warning:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        param:
          type: string
      required:
        - code
        - message
      additionalProperties: false
    AssignmentMode:
      type: string
      enum:
        - primary
        - shadow
        - backtest
        - seed
    ContentPart:
      oneOf:
        - $ref: '#/components/schemas/TextPart'
        - $ref: '#/components/schemas/JsonPart'
      discriminator:
        propertyName: type
        mapping:
          text: '#/components/schemas/TextPart'
          json: '#/components/schemas/JsonPart'
    ErrorType:
      type: string
      enum:
        - invalid_request
        - authentication
        - permission_denied
        - not_found
        - conflict
        - rate_limited
        - engine_failed
        - unavailable
        - internal
    Abstained:
      type: object
      properties:
        type:
          type: string
          enum:
            - boolean
            - combine
            - calibrate
        abstained:
          type: boolean
          enum:
            - true
        reason:
          type: string
      required:
        - type
        - abstained
      additionalProperties: false
    Failed:
      type: object
      properties:
        type:
          type: string
          enum:
            - boolean
            - combine
            - calibrate
        failed:
          type: boolean
          enum:
            - true
        reason:
          type: string
      required:
        - type
        - failed
      additionalProperties: false
    TextPart:
      type: object
      properties:
        type:
          type: string
          enum:
            - text
        text:
          type: string
          minLength: 1
        name:
          type: string
          pattern: ^[a-z][a-z0-9_]{0,63}$
          description: >-
            Names the part, so a feature's `inputs` can pick it. In `subject`,
            avoid "context" when the request also sends `context`.
        sensitive:
          type: boolean
          description: >-
            Display policy only: reviewers see the part blurred or behind a
            link. The engine still reads it and it is stored like any other
            part.
      required:
        - type
        - text
      additionalProperties: false
    JsonPart:
      type: object
      properties:
        type:
          type: string
          enum:
            - json
        data:
          anyOf:
            - type: object
              additionalProperties: {}
            - type: array
              items: {}
        name:
          type: string
          pattern: ^[a-z][a-z0-9_]{0,63}$
          description: >-
            Names the part, so a feature's `inputs` can pick it. In `subject`,
            avoid "context" when the request also sends `context`.
        sensitive:
          type: boolean
          description: >-
            Display policy only: reviewers see the part blurred or behind a
            link. The engine still reads it and it is stored like any other
            part.
      required:
        - type
        - data
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        An API key, sent as `Authorization: Bearer <key>`. Each operation lists
        the scope its key needs: `decisions:evaluate` (evaluate and read
        evaluations), `decisions:feedback` (your app's feedback) or
        `decisions:develop` (everything else, including owner feedback and the
        review queue). An operation listing no scope takes any scoped key. A key
        with no scope, or without the operation's, gets 403 INSUFFICIENT_SCOPE.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.