curl --request POST \
--url https://api.moonbounce.ai/v1/evaluate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"decision_id": "<string>",
"subject": [
{
"type": "text",
"text": "<string>",
"name": "<string>",
"sensitive": true
}
],
"item_id": "<string>",
"spec": {
"format": "moonbounce.spec/0",
"nodes": {},
"output": "<string>",
"guidance": "<string>",
"target": "<string>",
"meta": {
"title": "<string>",
"description": "<string>",
"owner": "<string>",
"tags": [
"<string>"
],
"display": {}
}
},
"weights": "default",
"context": [
{
"type": "text",
"text": "<string>",
"name": "<string>",
"sensitive": true
}
],
"metadata": {},
"summary": "<string>",
"dry_run": true,
"structure": "<string>"
}
'import requests
url = "https://api.moonbounce.ai/v1/evaluate"
payload = {
"decision_id": "<string>",
"subject": [
{
"type": "text",
"text": "<string>",
"name": "<string>",
"sensitive": True
}
],
"item_id": "<string>",
"spec": {
"format": "moonbounce.spec/0",
"nodes": {},
"output": "<string>",
"guidance": "<string>",
"target": "<string>",
"meta": {
"title": "<string>",
"description": "<string>",
"owner": "<string>",
"tags": ["<string>"],
"display": {}
}
},
"weights": "default",
"context": [
{
"type": "text",
"text": "<string>",
"name": "<string>",
"sensitive": True
}
],
"metadata": {},
"summary": "<string>",
"dry_run": True,
"structure": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
decision_id: '<string>',
subject: [{type: 'text', text: '<string>', name: '<string>', sensitive: true}],
item_id: '<string>',
spec: {
format: 'moonbounce.spec/0',
nodes: {},
output: '<string>',
guidance: '<string>',
target: '<string>',
meta: {
title: '<string>',
description: '<string>',
owner: '<string>',
tags: ['<string>'],
display: {}
}
},
weights: 'default',
context: [{type: 'text', text: '<string>', name: '<string>', sensitive: true}],
metadata: {},
summary: '<string>',
dry_run: true,
structure: '<string>'
})
};
fetch('https://api.moonbounce.ai/v1/evaluate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.moonbounce.ai/v1/evaluate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'decision_id' => '<string>',
'subject' => [
[
'type' => 'text',
'text' => '<string>',
'name' => '<string>',
'sensitive' => true
]
],
'item_id' => '<string>',
'spec' => [
'format' => 'moonbounce.spec/0',
'nodes' => [
],
'output' => '<string>',
'guidance' => '<string>',
'target' => '<string>',
'meta' => [
'title' => '<string>',
'description' => '<string>',
'owner' => '<string>',
'tags' => [
'<string>'
],
'display' => [
]
]
],
'weights' => 'default',
'context' => [
[
'type' => 'text',
'text' => '<string>',
'name' => '<string>',
'sensitive' => true
]
],
'metadata' => [
],
'summary' => '<string>',
'dry_run' => true,
'structure' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.moonbounce.ai/v1/evaluate"
payload := strings.NewReader("{\n \"decision_id\": \"<string>\",\n \"subject\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\",\n \"name\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"item_id\": \"<string>\",\n \"spec\": {\n \"format\": \"moonbounce.spec/0\",\n \"nodes\": {},\n \"output\": \"<string>\",\n \"guidance\": \"<string>\",\n \"target\": \"<string>\",\n \"meta\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"owner\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"display\": {}\n }\n },\n \"weights\": \"default\",\n \"context\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\",\n \"name\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"metadata\": {},\n \"summary\": \"<string>\",\n \"dry_run\": true,\n \"structure\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.moonbounce.ai/v1/evaluate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"decision_id\": \"<string>\",\n \"subject\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\",\n \"name\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"item_id\": \"<string>\",\n \"spec\": {\n \"format\": \"moonbounce.spec/0\",\n \"nodes\": {},\n \"output\": \"<string>\",\n \"guidance\": \"<string>\",\n \"target\": \"<string>\",\n \"meta\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"owner\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"display\": {}\n }\n },\n \"weights\": \"default\",\n \"context\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\",\n \"name\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"metadata\": {},\n \"summary\": \"<string>\",\n \"dry_run\": true,\n \"structure\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moonbounce.ai/v1/evaluate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"decision_id\": \"<string>\",\n \"subject\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\",\n \"name\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"item_id\": \"<string>\",\n \"spec\": {\n \"format\": \"moonbounce.spec/0\",\n \"nodes\": {},\n \"output\": \"<string>\",\n \"guidance\": \"<string>\",\n \"target\": \"<string>\",\n \"meta\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"owner\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"display\": {}\n }\n },\n \"weights\": \"default\",\n \"context\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\",\n \"name\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"metadata\": {},\n \"summary\": \"<string>\",\n \"dry_run\": true,\n \"structure\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"environment": "production",
"id": "<string>",
"decision_id": "<string>",
"version": {
"structure": "<string>",
"weights": "<string>",
"weights_source": "pinned",
"weights_fitted": true,
"binding": 2,
"engine_profile": "<string>"
},
"status": "scored",
"nodes": {},
"engines": {},
"usage": {
"input_tokens": 123,
"output_tokens": 123
},
"item_id": "<string>",
"score": 123,
"outcome": "<string>",
"outcomes": {
"below": "<string>",
"cuts": [
{
"at": 123,
"outcome": "<string>"
}
],
"abstain": "<string>"
},
"cost": {
"engine_calls": 1,
"cache_hits": 1,
"input_tokens": 1,
"usd_micros": 1
},
"summary": "<string>",
"metadata": {},
"warnings": [
{
"code": "<string>",
"message": "<string>",
"param": "<string>"
}
]
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}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.
curl --request POST \
--url https://api.moonbounce.ai/v1/evaluate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"decision_id": "<string>",
"subject": [
{
"type": "text",
"text": "<string>",
"name": "<string>",
"sensitive": true
}
],
"item_id": "<string>",
"spec": {
"format": "moonbounce.spec/0",
"nodes": {},
"output": "<string>",
"guidance": "<string>",
"target": "<string>",
"meta": {
"title": "<string>",
"description": "<string>",
"owner": "<string>",
"tags": [
"<string>"
],
"display": {}
}
},
"weights": "default",
"context": [
{
"type": "text",
"text": "<string>",
"name": "<string>",
"sensitive": true
}
],
"metadata": {},
"summary": "<string>",
"dry_run": true,
"structure": "<string>"
}
'import requests
url = "https://api.moonbounce.ai/v1/evaluate"
payload = {
"decision_id": "<string>",
"subject": [
{
"type": "text",
"text": "<string>",
"name": "<string>",
"sensitive": True
}
],
"item_id": "<string>",
"spec": {
"format": "moonbounce.spec/0",
"nodes": {},
"output": "<string>",
"guidance": "<string>",
"target": "<string>",
"meta": {
"title": "<string>",
"description": "<string>",
"owner": "<string>",
"tags": ["<string>"],
"display": {}
}
},
"weights": "default",
"context": [
{
"type": "text",
"text": "<string>",
"name": "<string>",
"sensitive": True
}
],
"metadata": {},
"summary": "<string>",
"dry_run": True,
"structure": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
decision_id: '<string>',
subject: [{type: 'text', text: '<string>', name: '<string>', sensitive: true}],
item_id: '<string>',
spec: {
format: 'moonbounce.spec/0',
nodes: {},
output: '<string>',
guidance: '<string>',
target: '<string>',
meta: {
title: '<string>',
description: '<string>',
owner: '<string>',
tags: ['<string>'],
display: {}
}
},
weights: 'default',
context: [{type: 'text', text: '<string>', name: '<string>', sensitive: true}],
metadata: {},
summary: '<string>',
dry_run: true,
structure: '<string>'
})
};
fetch('https://api.moonbounce.ai/v1/evaluate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.moonbounce.ai/v1/evaluate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'decision_id' => '<string>',
'subject' => [
[
'type' => 'text',
'text' => '<string>',
'name' => '<string>',
'sensitive' => true
]
],
'item_id' => '<string>',
'spec' => [
'format' => 'moonbounce.spec/0',
'nodes' => [
],
'output' => '<string>',
'guidance' => '<string>',
'target' => '<string>',
'meta' => [
'title' => '<string>',
'description' => '<string>',
'owner' => '<string>',
'tags' => [
'<string>'
],
'display' => [
]
]
],
'weights' => 'default',
'context' => [
[
'type' => 'text',
'text' => '<string>',
'name' => '<string>',
'sensitive' => true
]
],
'metadata' => [
],
'summary' => '<string>',
'dry_run' => true,
'structure' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.moonbounce.ai/v1/evaluate"
payload := strings.NewReader("{\n \"decision_id\": \"<string>\",\n \"subject\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\",\n \"name\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"item_id\": \"<string>\",\n \"spec\": {\n \"format\": \"moonbounce.spec/0\",\n \"nodes\": {},\n \"output\": \"<string>\",\n \"guidance\": \"<string>\",\n \"target\": \"<string>\",\n \"meta\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"owner\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"display\": {}\n }\n },\n \"weights\": \"default\",\n \"context\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\",\n \"name\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"metadata\": {},\n \"summary\": \"<string>\",\n \"dry_run\": true,\n \"structure\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.moonbounce.ai/v1/evaluate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"decision_id\": \"<string>\",\n \"subject\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\",\n \"name\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"item_id\": \"<string>\",\n \"spec\": {\n \"format\": \"moonbounce.spec/0\",\n \"nodes\": {},\n \"output\": \"<string>\",\n \"guidance\": \"<string>\",\n \"target\": \"<string>\",\n \"meta\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"owner\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"display\": {}\n }\n },\n \"weights\": \"default\",\n \"context\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\",\n \"name\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"metadata\": {},\n \"summary\": \"<string>\",\n \"dry_run\": true,\n \"structure\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moonbounce.ai/v1/evaluate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"decision_id\": \"<string>\",\n \"subject\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\",\n \"name\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"item_id\": \"<string>\",\n \"spec\": {\n \"format\": \"moonbounce.spec/0\",\n \"nodes\": {},\n \"output\": \"<string>\",\n \"guidance\": \"<string>\",\n \"target\": \"<string>\",\n \"meta\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"owner\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"display\": {}\n }\n },\n \"weights\": \"default\",\n \"context\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\",\n \"name\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"metadata\": {},\n \"summary\": \"<string>\",\n \"dry_run\": true,\n \"structure\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"environment": "production",
"id": "<string>",
"decision_id": "<string>",
"version": {
"structure": "<string>",
"weights": "<string>",
"weights_source": "pinned",
"weights_fitted": true,
"binding": 2,
"engine_profile": "<string>"
},
"status": "scored",
"nodes": {},
"engines": {},
"usage": {
"input_tokens": 123,
"output_tokens": 123
},
"item_id": "<string>",
"score": 123,
"outcome": "<string>",
"outcomes": {
"below": "<string>",
"cuts": [
{
"at": 123,
"outcome": "<string>"
}
],
"abstain": "<string>"
},
"cost": {
"engine_calls": 1,
"cache_hits": 1,
"input_tokens": 1,
"usd_micros": 1
},
"summary": "<string>",
"metadata": {},
"warnings": [
{
"code": "<string>",
"message": "<string>",
"param": "<string>"
}
]
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"reason": "<string>",
"param": "<string>",
"details": {}
}
}Authorizations
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
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.
1 - 255^[\x20-\x7e]+$wait=<seconds> (RFC 7240) shortens the request's 10 s budget.
256Body
- Option 1
- Option 2
^[a-z][a-z0-9_.-]{0,127}$1 - 64 elements- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
Show child attributes
Show child attributes
1 - 256Show child attributes
Show child attributes
default Show child attributes
Show child attributes
64- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
Show child attributes
Show child attributes
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.
Show child attributes
Show child attributes
1 - 140Spends engine calls and stores only usage, with no evaluation or feedback target. Refuses Idempotency-Key.
^sha256:[0-9a-f]{64}$Response
The evaluation
- Option 1
- Option 2
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.
production, test ^evl_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$^[a-z][a-z0-9_.-]{0,127}$Show child attributes
Show child attributes
scored, no_outcomes, abstained 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.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
^[a-z][a-z0-9_]{0,63}$Show child attributes
Show child attributes
Always present on fresh responses; absent only on an idempotent replay of a response stored before costs were reported.
Show child attributes
Show child attributes
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.
Show child attributes
Show child attributes
Show child attributes
Show child attributes