curl --request PUT \
--url https://api.example.com/api/graph/v1/pattern-events/scenario-policies \
--header 'Content-Type: application/json' \
--data '
{
"template_id": "<string>",
"symbol_scope": "*",
"action": "log",
"gate_min_n": 30,
"gate_expectancy_floor_r": 0,
"gate_recency_days": 120
}
'import requests
url = "https://api.example.com/api/graph/v1/pattern-events/scenario-policies"
payload = {
"template_id": "<string>",
"symbol_scope": "*",
"action": "log",
"gate_min_n": 30,
"gate_expectancy_floor_r": 0,
"gate_recency_days": 120
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
template_id: '<string>',
symbol_scope: '*',
action: 'log',
gate_min_n: 30,
gate_expectancy_floor_r: 0,
gate_recency_days: 120
})
};
fetch('https://api.example.com/api/graph/v1/pattern-events/scenario-policies', 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/api/graph/v1/pattern-events/scenario-policies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'template_id' => '<string>',
'symbol_scope' => '*',
'action' => 'log',
'gate_min_n' => 30,
'gate_expectancy_floor_r' => 0,
'gate_recency_days' => 120
]),
CURLOPT_HTTPHEADER => [
"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/api/graph/v1/pattern-events/scenario-policies"
payload := strings.NewReader("{\n \"template_id\": \"<string>\",\n \"symbol_scope\": \"*\",\n \"action\": \"log\",\n \"gate_min_n\": 30,\n \"gate_expectancy_floor_r\": 0,\n \"gate_recency_days\": 120\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.put("https://api.example.com/api/graph/v1/pattern-events/scenario-policies")
.header("Content-Type", "application/json")
.body("{\n \"template_id\": \"<string>\",\n \"symbol_scope\": \"*\",\n \"action\": \"log\",\n \"gate_min_n\": 30,\n \"gate_expectancy_floor_r\": 0,\n \"gate_recency_days\": 120\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/graph/v1/pattern-events/scenario-policies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"template_id\": \"<string>\",\n \"symbol_scope\": \"*\",\n \"action\": \"log\",\n \"gate_min_n\": 30,\n \"gate_expectancy_floor_r\": 0,\n \"gate_recency_days\": 120\n}"
response = http.request(request)
puts response.read_body{}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Upsert Scenario Policy
Set one template’s action policy (§9.1).
gate_min_n cannot be set below §10’s display floor: below it the stats
endpoint returns NO estimate at all, so a lower gate would be a gate on a
statistic that structurally does not exist. Migration 194 carries the same CHECK
— this is the friendly 422, not the safety net.
curl --request PUT \
--url https://api.example.com/api/graph/v1/pattern-events/scenario-policies \
--header 'Content-Type: application/json' \
--data '
{
"template_id": "<string>",
"symbol_scope": "*",
"action": "log",
"gate_min_n": 30,
"gate_expectancy_floor_r": 0,
"gate_recency_days": 120
}
'import requests
url = "https://api.example.com/api/graph/v1/pattern-events/scenario-policies"
payload = {
"template_id": "<string>",
"symbol_scope": "*",
"action": "log",
"gate_min_n": 30,
"gate_expectancy_floor_r": 0,
"gate_recency_days": 120
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
template_id: '<string>',
symbol_scope: '*',
action: 'log',
gate_min_n: 30,
gate_expectancy_floor_r: 0,
gate_recency_days: 120
})
};
fetch('https://api.example.com/api/graph/v1/pattern-events/scenario-policies', 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/api/graph/v1/pattern-events/scenario-policies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'template_id' => '<string>',
'symbol_scope' => '*',
'action' => 'log',
'gate_min_n' => 30,
'gate_expectancy_floor_r' => 0,
'gate_recency_days' => 120
]),
CURLOPT_HTTPHEADER => [
"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/api/graph/v1/pattern-events/scenario-policies"
payload := strings.NewReader("{\n \"template_id\": \"<string>\",\n \"symbol_scope\": \"*\",\n \"action\": \"log\",\n \"gate_min_n\": 30,\n \"gate_expectancy_floor_r\": 0,\n \"gate_recency_days\": 120\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.put("https://api.example.com/api/graph/v1/pattern-events/scenario-policies")
.header("Content-Type", "application/json")
.body("{\n \"template_id\": \"<string>\",\n \"symbol_scope\": \"*\",\n \"action\": \"log\",\n \"gate_min_n\": 30,\n \"gate_expectancy_floor_r\": 0,\n \"gate_recency_days\": 120\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/graph/v1/pattern-events/scenario-policies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"template_id\": \"<string>\",\n \"symbol_scope\": \"*\",\n \"action\": \"log\",\n \"gate_min_n\": 30,\n \"gate_expectancy_floor_r\": 0,\n \"gate_recency_days\": 120\n}"
response = http.request(request)
puts response.read_body{}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Body
One row of the §9.1 action ladder.
enabled_by is deliberately NOT a field: escalation must be attributable to
the authenticated operator, and a client-supplied name would let it be forged.
The handler stamps it from request.state.user, and migration 194's CHECK
constraint refuses an auto_arm row without it — belt and braces, because the
database must hold the line for a psql session too.
Response
Successful Response
The response is of type Response Upsert Scenario Policy Api Graph V1 Pattern Events Scenario Policies Put · object.