curl --request POST \
--url https://api.nixtla.io/v2/anomaly_detection \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"freq": "D",
"level": 90,
"series": {
"sizes": [
35
],
"y": [
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
10,
4,
5,
6
]
}
}
'import requests
url = "https://api.nixtla.io/v2/anomaly_detection"
payload = {
"freq": "D",
"level": 90,
"series": {
"sizes": [35],
"y": [0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 10, 4, 5, 6]
}
}
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({
freq: 'D',
level: 90,
series: {
sizes: [35],
y: [
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
10,
4,
5,
6
]
}
})
};
fetch('https://api.nixtla.io/v2/anomaly_detection', 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.nixtla.io/v2/anomaly_detection",
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([
'freq' => 'D',
'level' => 90,
'series' => [
'sizes' => [
35
],
'y' => [
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
10,
4,
5,
6
]
]
]),
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.nixtla.io/v2/anomaly_detection"
payload := strings.NewReader("{\n \"freq\": \"D\",\n \"level\": 90,\n \"series\": {\n \"sizes\": [\n 35\n ],\n \"y\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 10,\n 4,\n 5,\n 6\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.nixtla.io/v2/anomaly_detection")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"freq\": \"D\",\n \"level\": 90,\n \"series\": {\n \"sizes\": [\n 35\n ],\n \"y\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 10,\n 4,\n 5,\n 6\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixtla.io/v2/anomaly_detection")
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 \"freq\": \"D\",\n \"level\": 90,\n \"series\": {\n \"sizes\": [\n 35\n ],\n \"y\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 10,\n 4,\n 5,\n 6\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"input_tokens": 1,
"output_tokens": 1,
"finetune_tokens": 1,
"mean": [
123
],
"sizes": [
123
],
"anomaly": [
true
],
"intervals": {},
"weights_x": [
123
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Foundational Time Series Model Multi Series Anomaly Detector
Based on the provided data, this endpoint detects the anomalies in the historical period of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains a flag indicating if the date has an anomaly and also provides the prediction interval used to define if an observation is an anomaly.Get your token at https://nixtla.io/free-trial?utm_source=nixtla.io&utm_campaign=/docs/api-reference.
curl --request POST \
--url https://api.nixtla.io/v2/anomaly_detection \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"freq": "D",
"level": 90,
"series": {
"sizes": [
35
],
"y": [
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
10,
4,
5,
6
]
}
}
'import requests
url = "https://api.nixtla.io/v2/anomaly_detection"
payload = {
"freq": "D",
"level": 90,
"series": {
"sizes": [35],
"y": [0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 10, 4, 5, 6]
}
}
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({
freq: 'D',
level: 90,
series: {
sizes: [35],
y: [
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
10,
4,
5,
6
]
}
})
};
fetch('https://api.nixtla.io/v2/anomaly_detection', 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.nixtla.io/v2/anomaly_detection",
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([
'freq' => 'D',
'level' => 90,
'series' => [
'sizes' => [
35
],
'y' => [
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
3,
4,
5,
6,
0,
1,
2,
10,
4,
5,
6
]
]
]),
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.nixtla.io/v2/anomaly_detection"
payload := strings.NewReader("{\n \"freq\": \"D\",\n \"level\": 90,\n \"series\": {\n \"sizes\": [\n 35\n ],\n \"y\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 10,\n 4,\n 5,\n 6\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.nixtla.io/v2/anomaly_detection")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"freq\": \"D\",\n \"level\": 90,\n \"series\": {\n \"sizes\": [\n 35\n ],\n \"y\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 10,\n 4,\n 5,\n 6\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixtla.io/v2/anomaly_detection")
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 \"freq\": \"D\",\n \"level\": 90,\n \"series\": {\n \"sizes\": [\n 35\n ],\n \"y\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 0,\n 1,\n 2,\n 10,\n 4,\n 5,\n 6\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"input_tokens": 1,
"output_tokens": 1,
"finetune_tokens": 1,
"mean": [
123
],
"sizes": [
123
],
"anomaly": [
true
],
"intervals": {},
"weights_x": [
123
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Body
Model to use as a string. Common options are (but not restricted to) timegpt-1 and timegpt-1-long-horizon. Full options vary by different users. Contact support@nixtla.io for more information. We recommend using timegpt-1-long-horizon for forecasting if you want to predict more than one seasonal period given the frequency of your data.
Specifies the confidence level for the prediction interval used in anomaly detection. It is represented as a percentage between 0 and 100. For instance, a level of 95 indicates that the generated prediction interval captures the true future observation 95% of the time. Any observed values outside of this interval would be considered anomalies. A higher level leads to wider prediction intervals and potentially fewer detected anomalies, whereas a lower level results in narrower intervals and potentially more detected anomalies. Default: 99.
0 <= x < 100Response
Successful Response
Was this page helpful?