> ## 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.

# Evaluate an item against a decision

> Spends engine calls and, with dry_run: true, stores no evaluation; otherwise stores an evaluation. Scores one item with a spec (inline, or by registered hash), returning the score, outcome and every node's value. Fresh responses include recorded cost; engine_calls counts upstream calls, which can answer several features, and cache_hits is 0 today. A dry run stores only usage, returns a dry_ id and dry_run: true, and refuses Idempotency-Key. It does not register an inline spec, create a binding or cache answers. Otherwise an inline spec is registered on first sight and the response follows the evaluation commit. A replay with the same Idempotency-Key returns the first result with the Idempotent-Replayed header. Each request has a 10 s budget; `Prefer: wait=<seconds>` shortens it.



## OpenAPI

````yaml /openapi.json post /v1/evaluate
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 for requests without a valid key; a 429
    RATE_LIMITED carries `Retry-After`.
servers:
  - url: https://api.moonbounce.ai
    description: Production
security: []
paths:
  /v1/evaluate:
    post:
      tags:
        - evaluate
      summary: Evaluate an item against a decision
      description: >-
        Spends engine calls and, with dry_run: true, stores no evaluation;
        otherwise stores an evaluation. Scores one item with a spec (inline, or
        by registered hash), returning the score, outcome and every node's
        value. Fresh responses include recorded cost; engine_calls counts
        upstream calls, which can answer several features, and cache_hits is 0
        today. A dry run stores only usage, returns a dry_ id and dry_run: true,
        and refuses Idempotency-Key. It does not register an inline spec, create
        a binding or cache answers. Otherwise an inline spec is registered on
        first sight and the response follows the evaluation commit. A replay
        with the same Idempotency-Key returns the first result with the
        Idempotent-Replayed header. Each request has a 10 s budget; `Prefer:
        wait=<seconds>` shortens it.
      operationId: evaluate
      parameters:
        - schema:
            type: string
            minLength: 1
            maxLength: 255
            pattern: ^[\x20-\x7e]+$
            description: >-
              Makes a retry safe. For 24 hours, the same key with the same
              request returns the first stored result (with Idempotent-Replayed:
              true); the same key with a different request is a 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 with its key.
          required: false
          description: >-
            Makes a retry safe. For 24 hours, the same key with the same request
            returns the first stored result (with Idempotent-Replayed: true);
            the same key with a different request is a 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 with its key.
          name: idempotency-key
          in: header
        - schema:
            type: string
            maxLength: 256
            description: '`wait=<seconds>` (RFC 7240) shortens the request''s 10 s budget.'
          required: false
          description: '`wait=<seconds>` (RFC 7240) shortens the request''s 10 s budget.'
          name: prefer
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EvaluateRequest'
      responses:
        '200':
          description: The evaluation
          headers:
            Idempotent-Replayed:
              schema:
                type: string
                enum:
                  - 'true'
                description: >-
                  Present and `true` when this is the stored result of an
                  earlier request with the same Idempotency-Key.
              required: false
              description: >-
                Present and `true` when this is the stored result of an earlier
                request with the same Idempotency-Key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EvaluateResponse'
        '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'
        '409':
          description: Conflict with the current state
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '410':
          description: >-
            The Idempotency-Key's first result was deleted, so it cannot be
            replayed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '422':
          description: >-
            The request is well formed but cannot be processed (for example
            reason IDEMPOTENCY_KEY_REUSED)
          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'
        '502':
          description: >-
            An engine failed to answer a feature the output needs (type
            engine_failed, reason ENGINE_FAILED)
          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:
    EvaluateRequest:
      anyOf:
        - $ref: '#/components/schemas/EvaluateRequestBySpec'
        - $ref: '#/components/schemas/EvaluateRequestByHash'
    EvaluateResponse:
      anyOf:
        - 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: >-
                Always present on fresh responses; absent only on an idempotent
                replay of a response stored before costs were reported.
            item_id:
              type: string
            summary:
              type: string
            metadata:
              $ref: '#/components/schemas/Metadata'
            warnings:
              type: array
              items:
                $ref: '#/components/schemas/Warning'
          required:
            - environment
            - id
            - decision_id
            - version
            - status
            - nodes
            - engines
            - usage
            - item_id
          additionalProperties: false
        - type: object
          properties:
            environment:
              $ref: '#/components/schemas/Environment'
            id:
              $ref: '#/components/schemas/DryId'
            dry_run:
              type: boolean
              enum:
                - true
            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:
              $ref: '#/components/schemas/PreviewCost'
            item_id:
              type: string
            summary:
              type: string
            metadata:
              $ref: '#/components/schemas/Metadata'
            warnings:
              type: array
              items:
                $ref: '#/components/schemas/Warning'
          required:
            - environment
            - id
            - dry_run
            - decision_id
            - version
            - status
            - nodes
            - engines
            - usage
            - cost
            - item_id
          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
    EvaluateRequestBySpec:
      type: object
      properties:
        decision_id:
          $ref: '#/components/schemas/DecisionId'
        weights:
          $ref: '#/components/schemas/WeightsRef'
        outcomes:
          $ref: '#/components/schemas/Outcomes'
        subject:
          type: array
          items:
            $ref: '#/components/schemas/RequestContentPart'
          minItems: 1
          maxItems: 64
        context:
          type: array
          items:
            $ref: '#/components/schemas/RequestContentPart'
          maxItems: 64
        item_id:
          type: string
          minLength: 1
          maxLength: 256
        metadata:
          $ref: '#/components/schemas/Metadata'
        summary:
          type: string
          minLength: 1
          maxLength: 140
        dry_run:
          type: boolean
          description: >-
            Spends engine calls and stores only usage, with no evaluation or
            feedback target. Refuses Idempotency-Key.
        spec:
          $ref: '#/components/schemas/Spec'
        structure:
          $ref: '#/components/schemas/VersionHash'
      required:
        - decision_id
        - subject
        - item_id
        - spec
      additionalProperties: false
    EvaluateRequestByHash:
      type: object
      properties:
        decision_id:
          $ref: '#/components/schemas/DecisionId'
        weights:
          $ref: '#/components/schemas/WeightsRef'
        outcomes:
          $ref: '#/components/schemas/Outcomes'
        subject:
          type: array
          items:
            $ref: '#/components/schemas/RequestContentPart'
          minItems: 1
          maxItems: 64
        context:
          type: array
          items:
            $ref: '#/components/schemas/RequestContentPart'
          maxItems: 64
        item_id:
          type: string
          minLength: 1
          maxLength: 256
        metadata:
          $ref: '#/components/schemas/Metadata'
        summary:
          type: string
          minLength: 1
          maxLength: 140
        dry_run:
          type: boolean
          description: >-
            Spends engine calls and stores only usage, with no evaluation or
            feedback target. Refuses Idempotency-Key.
        structure:
          $ref: '#/components/schemas/VersionHash'
      required:
        - decision_id
        - subject
        - item_id
        - structure
      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.
    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}$
    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
    DryId:
      type: string
      pattern: >-
        ^dry_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
    PreviewCost:
      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
    ErrorType:
      type: string
      enum:
        - invalid_request
        - authentication
        - permission_denied
        - not_found
        - conflict
        - rate_limited
        - engine_failed
        - unavailable
        - internal
    WeightsRef:
      anyOf:
        - type: string
          enum:
            - default
        - $ref: '#/components/schemas/VersionHash'
      default: default
    RequestContentPart:
      oneOf:
        - $ref: '#/components/schemas/TextPart'
        - $ref: '#/components/schemas/JsonPart'
        - $ref: '#/components/schemas/ImagePart'
        - $ref: '#/components/schemas/AudioPart'
        - $ref: '#/components/schemas/VideoPart'
        - $ref: '#/components/schemas/DocumentPart'
        - $ref: '#/components/schemas/TurnPart'
      discriminator:
        propertyName: type
        mapping:
          text: '#/components/schemas/TextPart'
          json: '#/components/schemas/JsonPart'
          image: '#/components/schemas/ImagePart'
          audio: '#/components/schemas/AudioPart'
          video: '#/components/schemas/VideoPart'
          document: '#/components/schemas/DocumentPart'
          turn: '#/components/schemas/TurnPart'
    Spec:
      type: object
      properties:
        format:
          type: string
          enum:
            - moonbounce.spec/0
        guidance:
          type: string
          minLength: 1
          maxLength: 20000
        nodes:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/SpecNode'
          description: >-
            The spec's named nodes, 1 to 64: boolean features and the
            aggregators that read them. Every reference (`output`, a combine
            term's `node`, a calibrate's `node`) names a node in this map, with
            no cycles.
        output:
          $ref: '#/components/schemas/Name'
        target:
          type: string
          minLength: 1
          maxLength: 4000
          description: >-
            The yes/no statement the output's score is the probability of.
            Required when `output` is a combine or calibrate node, optional on a
            boolean output. Feedback `target` claims need it.
        meta:
          $ref: '#/components/schemas/Meta'
      required:
        - format
        - nodes
        - output
      additionalProperties: false
    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
    ImagePart:
      type: object
      properties:
        type:
          type: string
          enum:
            - image
        source:
          $ref: '#/components/schemas/MediaSource'
        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
        - source
      additionalProperties: false
      description: >-
        Recognized, not accepted yet: 400 CAPABILITY_UNSUPPORTED
        (content.image).
    AudioPart:
      type: object
      properties:
        type:
          type: string
          enum:
            - audio
        source:
          $ref: '#/components/schemas/MediaSource'
        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
        - source
      additionalProperties: false
      description: >-
        Recognized, not accepted yet: 400 CAPABILITY_UNSUPPORTED
        (content.audio).
    VideoPart:
      type: object
      properties:
        type:
          type: string
          enum:
            - video
        source:
          $ref: '#/components/schemas/MediaSource'
        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
        - source
      additionalProperties: false
      description: >-
        Recognized, not accepted yet: 400 CAPABILITY_UNSUPPORTED
        (content.video).
    DocumentPart:
      type: object
      properties:
        type:
          type: string
          enum:
            - document
        source:
          $ref: '#/components/schemas/MediaSource'
        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
        - source
      additionalProperties: false
      description: >-
        Recognized, not accepted yet: 400 CAPABILITY_UNSUPPORTED
        (content.document).
    TurnPart:
      type: object
      properties:
        type:
          type: string
          enum:
            - turn
        role:
          type: string
          minLength: 1
          maxLength: 64
        content:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/TextPart'
              - $ref: '#/components/schemas/JsonPart'
              - $ref: '#/components/schemas/ImagePart'
              - $ref: '#/components/schemas/AudioPart'
              - $ref: '#/components/schemas/VideoPart'
              - $ref: '#/components/schemas/DocumentPart'
            discriminator:
              propertyName: type
              mapping:
                text: '#/components/schemas/TextPart'
                json: '#/components/schemas/JsonPart'
                image: '#/components/schemas/ImagePart'
                audio: '#/components/schemas/AudioPart'
                video: '#/components/schemas/VideoPart'
                document: '#/components/schemas/DocumentPart'
          minItems: 1
          maxItems: 64
        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
        - role
        - content
      additionalProperties: false
      description: 'Recognized, not accepted yet: 400 CAPABILITY_UNSUPPORTED (content.turn).'
    SpecNode:
      oneOf:
        - $ref: '#/components/schemas/BooleanFeature'
        - $ref: '#/components/schemas/Combine'
        - $ref: '#/components/schemas/Calibrate'
      discriminator:
        propertyName: type
        mapping:
          boolean: '#/components/schemas/BooleanFeature'
          combine: '#/components/schemas/Combine'
          calibrate: '#/components/schemas/Calibrate'
    Meta:
      type: object
      properties:
        title:
          type: string
          maxLength: 200
        description:
          type: string
          maxLength: 4000
        owner:
          type: string
          maxLength: 200
        tags:
          type: array
          items:
            type: string
            maxLength: 64
          maxItems: 32
        display:
          type: object
          additionalProperties:
            type: object
            properties:
              text:
                type: string
                minLength: 1
                maxLength: 40
              help:
                type: string
                maxLength: 200
            required:
              - text
            additionalProperties: false
      additionalProperties: false
    MediaSource:
      oneOf:
        - type: object
          properties:
            kind:
              type: string
              enum:
                - url
            url:
              type: string
              format: uri
          required:
            - kind
            - url
          additionalProperties: false
        - type: object
          properties:
            kind:
              type: string
              enum:
                - base64
            media_type:
              type: string
              minLength: 1
              maxLength: 255
            data:
              type: string
              minLength: 1
          required:
            - kind
            - media_type
            - data
          additionalProperties: false
        - type: object
          properties:
            kind:
              type: string
              enum:
                - file
            file_id:
              type: string
              minLength: 1
              maxLength: 256
          required:
            - kind
            - file_id
          additionalProperties: false
    BooleanFeature:
      type: object
      properties:
        type:
          type: string
          enum:
            - boolean
        prompt:
          type: string
          minLength: 1
          maxLength: 4000
        guidance:
          type: string
          minLength: 1
          maxLength: 4000
        inputs:
          type: array
          items:
            $ref: '#/components/schemas/Name'
          minItems: 1
          description: >-
            Names of the `subject` parts this feature reads (default: all of
            them); `context` parts are always read. Every name must match a
            subject part's `name`, or the request is a 400 CONTENT_INVALID.
        criteria:
          type: object
          properties:
            'true':
              type: string
              minLength: 1
              maxLength: 4000
            'false':
              type: string
              minLength: 1
              maxLength: 4000
          additionalProperties: false
      required:
        - type
        - prompt
      additionalProperties: false
    Combine:
      type: object
      properties:
        type:
          type: string
          enum:
            - combine
        terms:
          type: array
          items:
            $ref: '#/components/schemas/CombineTerm'
          minItems: 1
          maxItems: 64
        prior:
          type: string
          enum:
            - mean
            - any
          description: >-
            Default combine weights before fitting. mean averages oriented
            inputs; any computes sigmoid(-4 + 8·Σraises - 8·Σlowers), a logistic
            of a signed sum: one strong raise is enough and weak raises add up.
        fixed:
          type: object
          properties:
            link:
              type: string
              enum:
                - identity
                - logistic
              description: >-
                identity: the weighted sum plus bias, clipped to 0..1; logistic:
                the sigmoid of the weighted sum plus bias.
            weights:
              type: object
              additionalProperties:
                type: number
              description: Signed weights per term key (node; options are reserved).
            bias:
              type: number
              description: Offset added to the weighted sum before applying the link.
          required:
            - link
            - weights
            - bias
          additionalProperties: false
          description: >-
            Numbers fixed in code, never overridden by fitted weights. Signed
            weights multiply raw P(yes): raises weights must be >= 0 and lowers
            weights <= 0.
      required:
        - type
        - terms
      additionalProperties: false
      description: >-
        Scores a node from its terms. Before fitting (and without fixed
        numbers), mean averages the oriented inputs, so each of n terms weighs
        1/n and adding a term dilutes the others; any computes sigmoid(-4 +
        8·Σraises - 8·Σlowers): one strong raise is enough, weak raises add up,
        and lowers cancel raises. Fitted or fixed numbers replace the prior.
    Calibrate:
      type: object
      properties:
        type:
          type: string
          enum:
            - calibrate
        node:
          $ref: '#/components/schemas/Name'
      required:
        - type
        - node
      additionalProperties: false
    CombineTerm:
      type: object
      properties:
        node:
          $ref: '#/components/schemas/Name'
        option:
          type: string
          pattern: ^[a-z][a-z0-9_]{0,63}$
          description: >-
            Reserved for choice and scale features, which are not available yet:
            any value is a 400.
        effect:
          type: string
          enum:
            - raises
            - lowers
          default: raises
          description: >-
            raises: a yes pushes the score up; lowers: a yes pushes it down. The
            sign lives here; fixed weights must agree with it.
      required:
        - node
      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.