Skip to main content
POST
Register a decision's version

Authorizations

Authorization
string
header
required

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.

Headers

idempotency-key
string

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 string length: 1 - 255
Pattern: ^[\x20-\x7e]+$

Body

application/json

The decision file your repository keeps (moonbounce/<decision_id>.json).

decision_id
string
required

A name you choose for this decision, such as refund-exception: a lowercase letter, then up to 127 of a-z 0-9 _ . -. Unique in your organization and shared by its test and production keys. The first registration or evaluation under a new one creates the decision.

Pattern: ^[a-z][a-z0-9_.-]{0,127}$
structure
object
required

Everything that defines a decision: questions, attribute declarations, aggregations and the result. Names are unique across all three maps.

objective
object | null

What the decision optimizes for, stored for the key's environment. Absent: the stored objective is left as it is. null: cleared, back to balanced losses. An objective: stored as a new revision when it differs from the current one. Its outcomes must be ones this body's structure can produce (400 otherwise), even when that structure is an older version; getObjective checks the stored one against the newest version. Never part of the structure hash.

Response

The version was already registered

decision_id
string
required

A name you choose for this decision, such as refund-exception: a lowercase letter, then up to 127 of a-z 0-9 _ . -. Unique in your organization and shared by its test and production keys. The first registration or evaluation under a new one creates the decision.

Pattern: ^[a-z][a-z0-9_.-]{0,127}$
version
object
required

A registered structure: its hash, its number under the decision and each question's hash.

created
boolean
required

True when this call registered the version, false when it already existed.

objective
object

Present only when the body had an objective key.