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

# List suggestions for a decision

> Newest first, the key's environment's suggestions only. On a production key, acceptance is recorded before the list is read: a suggestion whose candidate hashes have since served primary production traffic comes back `accepted`. A test key's suggestions are never accepted. `stale` is set on a suggestion when feedback on a case it was evaluated on changed after its evidence was read (an answer changed, withdrawn, corrected or newly given); its evidence is never rescored, so preview it again.



## OpenAPI

````yaml /openapi.json get /v1/decisions/{decision_id}/suggestions
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/decisions/{decision_id}/suggestions:
    get:
      tags:
        - suggestions
      summary: List suggestions for a decision
      description: >-
        Newest first, the key's environment's suggestions only. On a production
        key, acceptance is recorded before the list is read: a suggestion whose
        candidate hashes have since served primary production traffic comes back
        `accepted`. A test key's suggestions are never accepted. `stale` is set
        on a suggestion when feedback on a case it was evaluated on changed
        after its evidence was read (an answer changed, withdrawn, corrected or
        newly given); its evidence is never rescored, so preview it again.
      operationId: listSuggestions
      parameters:
        - schema:
            $ref: '#/components/schemas/DecisionId'
          required: true
          name: decision_id
          in: path
        - schema:
            $ref: '#/components/schemas/SuggestionStatus'
          required: false
          name: status
          in: query
        - schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
          required: false
          name: limit
          in: query
        - schema:
            type: string
            minLength: 1
            maxLength: 1024
          required: false
          name: cursor
          in: query
      responses:
        '200':
          description: A page of suggestions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuggestionList'
        '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:develop
components:
  schemas:
    DecisionId:
      type: string
      pattern: ^[a-z][a-z0-9_.-]{0,127}$
    SuggestionStatus:
      type: string
      enum:
        - proposed
        - pulled
        - accepted
        - rejected
        - superseded
    SuggestionList:
      type: object
      properties:
        environment:
          $ref: '#/components/schemas/Environment'
        items:
          type: array
          items:
            $ref: '#/components/schemas/Suggestion'
        next_cursor:
          type:
            - string
            - 'null'
      required:
        - environment
        - items
        - next_cursor
      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.
    Suggestion:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/SugId'
        decision_id:
          $ref: '#/components/schemas/DecisionId'
        kind:
          $ref: '#/components/schemas/SuggestionKind'
        target:
          $ref: '#/components/schemas/SuggestionTarget'
        summary:
          type: string
        environment:
          $ref: '#/components/schemas/Environment'
        base:
          $ref: '#/components/schemas/VersionRef'
        candidate:
          $ref: '#/components/schemas/CandidateRef'
        requires:
          type: array
          items:
            $ref: '#/components/schemas/SugId'
        candidate_spec:
          $ref: '#/components/schemas/Spec'
        diff:
          type: array
          items:
            $ref: '#/components/schemas/SpecDiffEntry'
        evidence:
          $ref: '#/components/schemas/Evidence'
        preview_id:
          $ref: '#/components/schemas/RunId'
        generator:
          $ref: '#/components/schemas/Generator'
        status:
          $ref: '#/components/schemas/SuggestionStatus'
        status_at:
          $ref: '#/components/schemas/Timestamp'
        rejection_reason:
          type: string
        accepted_evaluation_id:
          $ref: '#/components/schemas/EvlId'
        accepted_at:
          $ref: '#/components/schemas/Timestamp'
        created_at:
          $ref: '#/components/schemas/Timestamp'
        stale:
          type: object
          properties:
            reason:
              type: string
            cases:
              type: integer
              minimum: 1
              description: How many of its evaluated cases have changed feedback.
          required:
            - reason
            - cases
          additionalProperties: false
          description: >-
            Present when feedback on cases this suggestion was evaluated on
            changed after its evidence was read: an answer it read was changed,
            withdrawn or corrected, or the owner, a reviewer or a seed judged
            one of its cases since, or any feedback since marked one's input as
            broken. Its evidence is as it was then; preview it again before
            relying on it.
      required:
        - id
        - decision_id
        - kind
        - target
        - summary
        - environment
        - base
        - candidate
        - requires
        - candidate_spec
        - diff
        - evidence
        - preview_id
        - generator
        - status
        - created_at
      additionalProperties: false
    ErrorType:
      type: string
      enum:
        - invalid_request
        - authentication
        - permission_denied
        - not_found
        - conflict
        - rate_limited
        - engine_failed
        - unavailable
        - internal
    SugId:
      type: string
      pattern: >-
        ^sug_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
    SuggestionKind:
      type: string
      enum:
        - feature_rewrite
        - new_feature
    SuggestionTarget:
      type: string
      enum:
        - structure
    VersionRef:
      type: object
      properties:
        structure:
          $ref: '#/components/schemas/VersionHash'
        weights:
          $ref: '#/components/schemas/VersionHash'
        engine_profile:
          type: string
      required:
        - structure
        - weights
        - engine_profile
      additionalProperties: false
    CandidateRef:
      type: object
      properties:
        structure:
          $ref: '#/components/schemas/VersionHash'
        weights:
          $ref: '#/components/schemas/VersionHash'
        engine_profile:
          type: string
        weights_pin:
          $ref: '#/components/schemas/WeightsRef'
      required:
        - structure
        - weights
        - engine_profile
        - weights_pin
      additionalProperties: false
    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
    SpecDiffEntry:
      type: object
      properties:
        op:
          type: string
          enum:
            - replace
            - add
            - remove
        path:
          type: string
          pattern: ^\/nodes\/[a-z][a-z0-9_]*(\/[^/]*)*$
        before: {}
        after: {}
      required:
        - op
        - path
      additionalProperties: false
    Evidence:
      type: object
      properties:
        label:
          $ref: '#/components/schemas/EvidenceLabel'
        frozen_at:
          $ref: '#/components/schemas/Timestamp'
        by_split:
          type: object
          properties:
            seed:
              $ref: '#/components/schemas/SplitStats'
            train:
              $ref: '#/components/schemas/SplitStats'
            holdout:
              $ref: '#/components/schemas/SplitStats'
          additionalProperties: false
        noise_rate:
          type:
            - number
            - 'null'
          minimum: 0
          maximum: 1
        by_source:
          type: object
          properties:
            app_native:
              $ref: '#/components/schemas/SplitStats'
            app_resolution:
              $ref: '#/components/schemas/SplitStats'
            reviewer:
              $ref: '#/components/schemas/SplitStats'
            owner:
              $ref: '#/components/schemas/SplitStats'
            import:
              $ref: '#/components/schemas/SplitStats'
            synthetic_review:
              $ref: '#/components/schemas/SplitStats'
        action_mix:
          anyOf:
            - $ref: '#/components/schemas/ActionMix'
            - type: 'null'
        changed_items:
          type: array
          items:
            $ref: '#/components/schemas/ChangedItem'
        credited_feedback:
          type: array
          items:
            $ref: '#/components/schemas/FbkId'
      required:
        - label
        - frozen_at
        - by_split
        - noise_rate
        - action_mix
        - changed_items
        - credited_feedback
      additionalProperties: false
    RunId:
      type: string
      pattern: >-
        ^run_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
    Generator:
      type: object
      properties:
        name:
          type: string
          minLength: 1
        version:
          type: string
          minLength: 1
        model:
          type: string
      required:
        - name
        - version
      additionalProperties: false
    Timestamp:
      type: string
      format: date-time
    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}$
    VersionHash:
      type: string
      pattern: ^sha256:[0-9a-f]{64}$
    WeightsRef:
      anyOf:
        - type: string
          enum:
            - default
        - $ref: '#/components/schemas/VersionHash'
      default: default
    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'
    Name:
      type: string
      pattern: ^[a-z][a-z0-9_]{0,63}$
    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
    EvidenceLabel:
      type: string
      enum:
        - starting_examples
        - training_cases
        - holdout
    SplitStats:
      type: object
      properties:
        'n':
          type: integer
          minimum: 0
        fixes:
          type: integer
          minimum: 0
        breaks:
          type: integer
          minimum: 0
        base_correct:
          type: integer
          minimum: 0
        candidate_correct:
          type: integer
          minimum: 0
        holdout_uses:
          type: integer
          minimum: 0
        owner_decided:
          type: integer
          minimum: 0
      required:
        - 'n'
        - fixes
        - breaks
        - base_correct
        - candidate_correct
      additionalProperties: false
    ActionMix:
      type: object
      properties:
        before:
          type: object
          additionalProperties:
            type: number
            minimum: 0
            maximum: 1
        after:
          type: object
          additionalProperties:
            type: number
            minimum: 0
            maximum: 1
        'on':
          type: string
        'n':
          type: integer
          minimum: 0
      required:
        - before
        - after
        - 'on'
        - 'n'
      additionalProperties: false
    ChangedItem:
      type: object
      properties:
        evaluation_id:
          $ref: '#/components/schemas/EvlId'
        feedback_id:
          $ref: '#/components/schemas/FbkId'
        split:
          $ref: '#/components/schemas/Split'
        change:
          type: string
          enum:
            - fix
            - break
        before:
          type: object
          properties:
            outcome:
              $ref: '#/components/schemas/Name'
            score:
              type: number
            features:
              type: object
              additionalProperties:
                type:
                  - number
                  - 'null'
                minimum: 0
                maximum: 1
          required:
            - features
          additionalProperties: false
        after:
          type: object
          properties:
            outcome:
              $ref: '#/components/schemas/Name'
            score:
              type: number
            features:
              type: object
              additionalProperties:
                type:
                  - number
                  - 'null'
                minimum: 0
                maximum: 1
          required:
            - features
          additionalProperties: false
      required:
        - evaluation_id
        - feedback_id
        - split
        - change
        - before
        - after
      additionalProperties: false
    FbkId:
      type: string
      pattern: >-
        ^fbk_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
    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
    Split:
      type: string
      enum:
        - seed
        - train
        - holdout
        - burned
    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.