Scenario
curl --request POST \
--url https://api.example.com/v1/models/{model_id}/scenario \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"dataframe": {
"sql": "<string>",
"version": 1
},
"target_value": 123,
"search": {
"n_trials": 500,
"max_steps": 30,
"stop_after_improvement": 0.01,
"rescore_every": 1,
"reattribute_every": 1,
"top_k_features": 2,
"random_state": 42
},
"constraints": {},
"numeric_quantiles": [
123,
123
],
"structural_constraints": [
{
"parent": "<string>",
"child": "<string>",
"child_to_parent": [
[]
],
"kind": "category_hierarchy"
}
]
}
'import requests
url = "https://api.example.com/v1/models/{model_id}/scenario"
payload = {
"dataframe": {
"sql": "<string>",
"version": 1
},
"target_value": 123,
"search": {
"n_trials": 500,
"max_steps": 30,
"stop_after_improvement": 0.01,
"rescore_every": 1,
"reattribute_every": 1,
"top_k_features": 2,
"random_state": 42
},
"constraints": {},
"numeric_quantiles": [123, 123],
"structural_constraints": [
{
"parent": "<string>",
"child": "<string>",
"child_to_parent": [[]],
"kind": "category_hierarchy"
}
]
}
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({
dataframe: {sql: '<string>', version: 1},
target_value: 123,
search: {
n_trials: 500,
max_steps: 30,
stop_after_improvement: 0.01,
rescore_every: 1,
reattribute_every: 1,
top_k_features: 2,
random_state: 42
},
constraints: {},
numeric_quantiles: [123, 123],
structural_constraints: [
{
parent: '<string>',
child: '<string>',
child_to_parent: [[]],
kind: 'category_hierarchy'
}
]
})
};
fetch('https://api.example.com/v1/models/{model_id}/scenario', 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.example.com/v1/models/{model_id}/scenario",
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([
'dataframe' => [
'sql' => '<string>',
'version' => 1
],
'target_value' => 123,
'search' => [
'n_trials' => 500,
'max_steps' => 30,
'stop_after_improvement' => 0.01,
'rescore_every' => 1,
'reattribute_every' => 1,
'top_k_features' => 2,
'random_state' => 42
],
'constraints' => [
],
'numeric_quantiles' => [
123,
123
],
'structural_constraints' => [
[
'parent' => '<string>',
'child' => '<string>',
'child_to_parent' => [
[
]
],
'kind' => 'category_hierarchy'
]
]
]),
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.example.com/v1/models/{model_id}/scenario"
payload := strings.NewReader("{\n \"dataframe\": {\n \"sql\": \"<string>\",\n \"version\": 1\n },\n \"target_value\": 123,\n \"search\": {\n \"n_trials\": 500,\n \"max_steps\": 30,\n \"stop_after_improvement\": 0.01,\n \"rescore_every\": 1,\n \"reattribute_every\": 1,\n \"top_k_features\": 2,\n \"random_state\": 42\n },\n \"constraints\": {},\n \"numeric_quantiles\": [\n 123,\n 123\n ],\n \"structural_constraints\": [\n {\n \"parent\": \"<string>\",\n \"child\": \"<string>\",\n \"child_to_parent\": [\n []\n ],\n \"kind\": \"category_hierarchy\"\n }\n ]\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.example.com/v1/models/{model_id}/scenario")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"dataframe\": {\n \"sql\": \"<string>\",\n \"version\": 1\n },\n \"target_value\": 123,\n \"search\": {\n \"n_trials\": 500,\n \"max_steps\": 30,\n \"stop_after_improvement\": 0.01,\n \"rescore_every\": 1,\n \"reattribute_every\": 1,\n \"top_k_features\": 2,\n \"random_state\": 42\n },\n \"constraints\": {},\n \"numeric_quantiles\": [\n 123,\n 123\n ],\n \"structural_constraints\": [\n {\n \"parent\": \"<string>\",\n \"child\": \"<string>\",\n \"child_to_parent\": [\n []\n ],\n \"kind\": \"category_hierarchy\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/models/{model_id}/scenario")
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 \"dataframe\": {\n \"sql\": \"<string>\",\n \"version\": 1\n },\n \"target_value\": 123,\n \"search\": {\n \"n_trials\": 500,\n \"max_steps\": 30,\n \"stop_after_improvement\": 0.01,\n \"rescore_every\": 1,\n \"reattribute_every\": 1,\n \"top_k_features\": 2,\n \"random_state\": 42\n },\n \"constraints\": {},\n \"numeric_quantiles\": [\n 123,\n 123\n ],\n \"structural_constraints\": [\n {\n \"parent\": \"<string>\",\n \"child\": \"<string>\",\n \"child_to_parent\": [\n []\n ],\n \"kind\": \"category_hierarchy\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"job_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}inference
Scenario
Scenario search: find row modifications that reach a desired class.
POST
/
v1
/
models
/
{model_id}
/
scenario
Scenario
curl --request POST \
--url https://api.example.com/v1/models/{model_id}/scenario \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"dataframe": {
"sql": "<string>",
"version": 1
},
"target_value": 123,
"search": {
"n_trials": 500,
"max_steps": 30,
"stop_after_improvement": 0.01,
"rescore_every": 1,
"reattribute_every": 1,
"top_k_features": 2,
"random_state": 42
},
"constraints": {},
"numeric_quantiles": [
123,
123
],
"structural_constraints": [
{
"parent": "<string>",
"child": "<string>",
"child_to_parent": [
[]
],
"kind": "category_hierarchy"
}
]
}
'import requests
url = "https://api.example.com/v1/models/{model_id}/scenario"
payload = {
"dataframe": {
"sql": "<string>",
"version": 1
},
"target_value": 123,
"search": {
"n_trials": 500,
"max_steps": 30,
"stop_after_improvement": 0.01,
"rescore_every": 1,
"reattribute_every": 1,
"top_k_features": 2,
"random_state": 42
},
"constraints": {},
"numeric_quantiles": [123, 123],
"structural_constraints": [
{
"parent": "<string>",
"child": "<string>",
"child_to_parent": [[]],
"kind": "category_hierarchy"
}
]
}
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({
dataframe: {sql: '<string>', version: 1},
target_value: 123,
search: {
n_trials: 500,
max_steps: 30,
stop_after_improvement: 0.01,
rescore_every: 1,
reattribute_every: 1,
top_k_features: 2,
random_state: 42
},
constraints: {},
numeric_quantiles: [123, 123],
structural_constraints: [
{
parent: '<string>',
child: '<string>',
child_to_parent: [[]],
kind: 'category_hierarchy'
}
]
})
};
fetch('https://api.example.com/v1/models/{model_id}/scenario', 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.example.com/v1/models/{model_id}/scenario",
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([
'dataframe' => [
'sql' => '<string>',
'version' => 1
],
'target_value' => 123,
'search' => [
'n_trials' => 500,
'max_steps' => 30,
'stop_after_improvement' => 0.01,
'rescore_every' => 1,
'reattribute_every' => 1,
'top_k_features' => 2,
'random_state' => 42
],
'constraints' => [
],
'numeric_quantiles' => [
123,
123
],
'structural_constraints' => [
[
'parent' => '<string>',
'child' => '<string>',
'child_to_parent' => [
[
]
],
'kind' => 'category_hierarchy'
]
]
]),
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.example.com/v1/models/{model_id}/scenario"
payload := strings.NewReader("{\n \"dataframe\": {\n \"sql\": \"<string>\",\n \"version\": 1\n },\n \"target_value\": 123,\n \"search\": {\n \"n_trials\": 500,\n \"max_steps\": 30,\n \"stop_after_improvement\": 0.01,\n \"rescore_every\": 1,\n \"reattribute_every\": 1,\n \"top_k_features\": 2,\n \"random_state\": 42\n },\n \"constraints\": {},\n \"numeric_quantiles\": [\n 123,\n 123\n ],\n \"structural_constraints\": [\n {\n \"parent\": \"<string>\",\n \"child\": \"<string>\",\n \"child_to_parent\": [\n []\n ],\n \"kind\": \"category_hierarchy\"\n }\n ]\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.example.com/v1/models/{model_id}/scenario")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"dataframe\": {\n \"sql\": \"<string>\",\n \"version\": 1\n },\n \"target_value\": 123,\n \"search\": {\n \"n_trials\": 500,\n \"max_steps\": 30,\n \"stop_after_improvement\": 0.01,\n \"rescore_every\": 1,\n \"reattribute_every\": 1,\n \"top_k_features\": 2,\n \"random_state\": 42\n },\n \"constraints\": {},\n \"numeric_quantiles\": [\n 123,\n 123\n ],\n \"structural_constraints\": [\n {\n \"parent\": \"<string>\",\n \"child\": \"<string>\",\n \"child_to_parent\": [\n []\n ],\n \"kind\": \"category_hierarchy\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/models/{model_id}/scenario")
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 \"dataframe\": {\n \"sql\": \"<string>\",\n \"version\": 1\n },\n \"target_value\": 123,\n \"search\": {\n \"n_trials\": 500,\n \"max_steps\": 30,\n \"stop_after_improvement\": 0.01,\n \"rescore_every\": 1,\n \"reattribute_every\": 1,\n \"top_k_features\": 2,\n \"random_state\": 42\n },\n \"constraints\": {},\n \"numeric_quantiles\": [\n 123,\n 123\n ],\n \"structural_constraints\": [\n {\n \"parent\": \"<string>\",\n \"child\": \"<string>\",\n \"child_to_parent\": [\n []\n ],\n \"kind\": \"category_hierarchy\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"job_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
An API key or OAuth2/OIDC access token sent as Authorization: Bearer <token>.
Path Parameters
Body
application/json
Inline dataset spec — each materialized row is one query for the scenario search. Caps on row count are enforced inside the worker after materialize().
Show child attributes
Show child attributes
Score the search drives each query's prediction to cross. In label units for regression; the positive-class probability in (0, 1) for binary classification (e.g. 0.5 flips to the other side of the decision boundary). Each query travels in whichever direction reaches it.
Budget, stopping, sparsity, and reproducibility for scenario search.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
- CategoryHierarchySchema
- CategoryCompatibilitySchema
Show child attributes
Show child attributes