curl --request POST \
--url https://api.moonbounce.ai/v1/decisions/{decision_id}/binding/revisions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"engine": "clef",
"model": "@cf/cloudflare/clef"
}
'import requests
url = "https://api.moonbounce.ai/v1/decisions/{decision_id}/binding/revisions"
payload = {
"engine": "clef",
"model": "@cf/cloudflare/clef"
}
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({engine: 'clef', model: '@cf/cloudflare/clef'})
};
fetch('https://api.moonbounce.ai/v1/decisions/{decision_id}/binding/revisions', 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/decisions/{decision_id}/binding/revisions",
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([
'engine' => 'clef',
'model' => '@cf/cloudflare/clef'
]),
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/decisions/{decision_id}/binding/revisions"
payload := strings.NewReader("{\n \"engine\": \"clef\",\n \"model\": \"@cf/cloudflare/clef\"\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/decisions/{decision_id}/binding/revisions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"engine\": \"clef\",\n \"model\": \"@cf/cloudflare/clef\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moonbounce.ai/v1/decisions/{decision_id}/binding/revisions")
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 \"engine\": \"clef\",\n \"model\": \"@cf/cloudflare/clef\"\n}"
response = http.request(request)
puts response.read_body{
"decision_id": "<string>",
"environment": "production",
"revision": 2,
"engine": "clef",
"model": "@cf/cloudflare/clef",
"pinned": true,
"created_at": "2023-11-07T05:31:56Z",
"created": true
}{
"decision_id": "<string>",
"environment": "production",
"revision": 2,
"engine": "clef",
"model": "@cf/cloudflare/clef",
"pinned": true,
"created_at": "2023-11-07T05:31:56Z",
"created": true
}{
"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": {}
}
}Choose the engine a decision runs on
Sets the engine and model a decision runs on in this environment, as a new binding revision. Appends a binding revision for the calling key’s environment, with one engine for every node. Evaluations run on it from the next call, unless they pin weights fit for one engine profile: those keep running on the newest revision that profile fits, and 409 WEIGHTS_INCOMPATIBLE when none does. Default weights, and weights carried from them, fit any engine, so they move at once, and a switch also moves seeds, previews and suggestions. Weights tuned on one engine’s answers are not checked against another’s, so switch with a test key first and backtest there: each environment has its own binding. 201 with the new revision; 200 and no new revision when the body matches the current one. An engine or model this deployment does not offer is 400 CAPABILITY_UNSUPPORTED. 404 until a structure is registered for the decision in this environment. An Idempotency-Key covers the body as sent, so retry with the same body; it replays even if the engine’s configuration changed. Send model to pin the model rather than take the default.
curl --request POST \
--url https://api.moonbounce.ai/v1/decisions/{decision_id}/binding/revisions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"engine": "clef",
"model": "@cf/cloudflare/clef"
}
'import requests
url = "https://api.moonbounce.ai/v1/decisions/{decision_id}/binding/revisions"
payload = {
"engine": "clef",
"model": "@cf/cloudflare/clef"
}
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({engine: 'clef', model: '@cf/cloudflare/clef'})
};
fetch('https://api.moonbounce.ai/v1/decisions/{decision_id}/binding/revisions', 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/decisions/{decision_id}/binding/revisions",
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([
'engine' => 'clef',
'model' => '@cf/cloudflare/clef'
]),
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/decisions/{decision_id}/binding/revisions"
payload := strings.NewReader("{\n \"engine\": \"clef\",\n \"model\": \"@cf/cloudflare/clef\"\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/decisions/{decision_id}/binding/revisions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"engine\": \"clef\",\n \"model\": \"@cf/cloudflare/clef\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moonbounce.ai/v1/decisions/{decision_id}/binding/revisions")
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 \"engine\": \"clef\",\n \"model\": \"@cf/cloudflare/clef\"\n}"
response = http.request(request)
puts response.read_body{
"decision_id": "<string>",
"environment": "production",
"revision": 2,
"engine": "clef",
"model": "@cf/cloudflare/clef",
"pinned": true,
"created_at": "2023-11-07T05:31:56Z",
"created": true
}{
"decision_id": "<string>",
"environment": "production",
"revision": 2,
"engine": "clef",
"model": "@cf/cloudflare/clef",
"pinned": true,
"created_at": "2023-11-07T05:31:56Z",
"created": true
}{
"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]+$Path Parameters
^[a-z][a-z0-9_.-]{0,127}$Body
Response
Unchanged: the body matches the current revision
^[a-z][a-z0-9_.-]{0,127}$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 The binding revision; evaluations report the one they ran on as version.binding.
x >= 1An engine id from GET /v1/engines, e.g. jev or clef. Open: new engines are added without a contract change.
1 - 64"clef"
A model id the engine lists in GET /v1/engines. *-latest and *-preview aliases are refused; whether an id fixes the model's behavior is its pinned flag.
1 - 128"@cf/cloudflare/clef"
Whether this deployment's engine reports the model as pinned (see GET /v1/engines). False when the engine is not offered.
False when the body matched the current revision, so nothing was written.