Preview a credit alert rule
curl --request POST \
--url https://api.neoagent.io/public-api/agents/{agent_id}/credit-alert-rule/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"disable_agent": true,
"enabled": true,
"multiplier": 123,
"recipients": [
"<string>"
],
"notify_admins": true
}
'import requests
url = "https://api.neoagent.io/public-api/agents/{agent_id}/credit-alert-rule/preview"
payload = {
"disable_agent": True,
"enabled": True,
"multiplier": 123,
"recipients": ["<string>"],
"notify_admins": True
}
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({
disable_agent: true,
enabled: true,
multiplier: 123,
recipients: ['<string>'],
notify_admins: true
})
};
fetch('https://api.neoagent.io/public-api/agents/{agent_id}/credit-alert-rule/preview', 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.neoagent.io/public-api/agents/{agent_id}/credit-alert-rule/preview",
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([
'disable_agent' => true,
'enabled' => true,
'multiplier' => 123,
'recipients' => [
'<string>'
],
'notify_admins' => true
]),
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.neoagent.io/public-api/agents/{agent_id}/credit-alert-rule/preview"
payload := strings.NewReader("{\n \"disable_agent\": true,\n \"enabled\": true,\n \"multiplier\": 123,\n \"recipients\": [\n \"<string>\"\n ],\n \"notify_admins\": true\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.neoagent.io/public-api/agents/{agent_id}/credit-alert-rule/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"disable_agent\": true,\n \"enabled\": true,\n \"multiplier\": 123,\n \"recipients\": [\n \"<string>\"\n ],\n \"notify_admins\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.neoagent.io/public-api/agents/{agent_id}/credit-alert-rule/preview")
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 \"disable_agent\": true,\n \"enabled\": true,\n \"multiplier\": 123,\n \"recipients\": [\n \"<string>\"\n ],\n \"notify_admins\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"backtest_alert_days": 123,
"backtest_days": 123,
"baseline_average": 123,
"baseline_days_used": 123,
"cap_credits": 123,
"computed_at": "2023-11-07T05:31:56Z",
"daily": [
{
"cap_credits": 123,
"credits": 123,
"day": "2023-12-25"
}
]
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timings_ms": {},
"pagination": {
"has_more": true,
"next_cursor": "<string>"
},
"warnings": [
"<string>"
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}Credit alert rules
Preview a credit alert rule
What the rule in the body would do if it were saved now: its cap, the average it is based on, and on how many of the last 30 days it would have alerted (backtest_alert_days). daily lists those 30 days, oldest first, each with the agent’s credits and the cap the rule gave that day, null where the agent had too little history. Stores nothing. A rule Neo cannot save answers 400 with the reason.
POST
/
public-api
/
agents
/
{agent_id}
/
credit-alert-rule
/
preview
Preview a credit alert rule
curl --request POST \
--url https://api.neoagent.io/public-api/agents/{agent_id}/credit-alert-rule/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"disable_agent": true,
"enabled": true,
"multiplier": 123,
"recipients": [
"<string>"
],
"notify_admins": true
}
'import requests
url = "https://api.neoagent.io/public-api/agents/{agent_id}/credit-alert-rule/preview"
payload = {
"disable_agent": True,
"enabled": True,
"multiplier": 123,
"recipients": ["<string>"],
"notify_admins": True
}
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({
disable_agent: true,
enabled: true,
multiplier: 123,
recipients: ['<string>'],
notify_admins: true
})
};
fetch('https://api.neoagent.io/public-api/agents/{agent_id}/credit-alert-rule/preview', 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.neoagent.io/public-api/agents/{agent_id}/credit-alert-rule/preview",
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([
'disable_agent' => true,
'enabled' => true,
'multiplier' => 123,
'recipients' => [
'<string>'
],
'notify_admins' => true
]),
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.neoagent.io/public-api/agents/{agent_id}/credit-alert-rule/preview"
payload := strings.NewReader("{\n \"disable_agent\": true,\n \"enabled\": true,\n \"multiplier\": 123,\n \"recipients\": [\n \"<string>\"\n ],\n \"notify_admins\": true\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.neoagent.io/public-api/agents/{agent_id}/credit-alert-rule/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"disable_agent\": true,\n \"enabled\": true,\n \"multiplier\": 123,\n \"recipients\": [\n \"<string>\"\n ],\n \"notify_admins\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.neoagent.io/public-api/agents/{agent_id}/credit-alert-rule/preview")
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 \"disable_agent\": true,\n \"enabled\": true,\n \"multiplier\": 123,\n \"recipients\": [\n \"<string>\"\n ],\n \"notify_admins\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"backtest_alert_days": 123,
"backtest_days": 123,
"baseline_average": 123,
"baseline_days_used": 123,
"cap_credits": 123,
"computed_at": "2023-11-07T05:31:56Z",
"daily": [
{
"cap_credits": 123,
"credits": 123,
"day": "2023-12-25"
}
]
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timings_ms": {},
"pagination": {
"has_more": true,
"next_cursor": "<string>"
},
"warnings": [
"<string>"
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}Authorizations
Body
application/json
A daily credit alert rule for one agent.
