Create a Monitor
curl --request POST \
--url https://agent.tinyfish.ai/v1/monitors \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"schedule_cron": "<string>",
"type": "search",
"config": {
"query": "<string>",
"recency_minutes": 2628000,
"result_limit": 10
},
"name": "<string>",
"webhook_url": "<string>",
"purpose": "<string>"
}
'import requests
url = "https://agent.tinyfish.ai/v1/monitors"
payload = {
"schedule_cron": "<string>",
"type": "search",
"config": {
"query": "<string>",
"recency_minutes": 2628000,
"result_limit": 10
},
"name": "<string>",
"webhook_url": "<string>",
"purpose": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
schedule_cron: '<string>',
type: 'search',
config: {query: '<string>', recency_minutes: 2628000, result_limit: 10},
name: '<string>',
webhook_url: '<string>',
purpose: '<string>'
})
};
fetch('https://agent.tinyfish.ai/v1/monitors', 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://agent.tinyfish.ai/v1/monitors",
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([
'schedule_cron' => '<string>',
'type' => 'search',
'config' => [
'query' => '<string>',
'recency_minutes' => 2628000,
'result_limit' => 10
],
'name' => '<string>',
'webhook_url' => '<string>',
'purpose' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://agent.tinyfish.ai/v1/monitors"
payload := strings.NewReader("{\n \"schedule_cron\": \"<string>\",\n \"type\": \"search\",\n \"config\": {\n \"query\": \"<string>\",\n \"recency_minutes\": 2628000,\n \"result_limit\": 10\n },\n \"name\": \"<string>\",\n \"webhook_url\": \"<string>\",\n \"purpose\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://agent.tinyfish.ai/v1/monitors")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"schedule_cron\": \"<string>\",\n \"type\": \"search\",\n \"config\": {\n \"query\": \"<string>\",\n \"recency_minutes\": 2628000,\n \"result_limit\": 10\n },\n \"name\": \"<string>\",\n \"webhook_url\": \"<string>\",\n \"purpose\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agent.tinyfish.ai/v1/monitors")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"schedule_cron\": \"<string>\",\n \"type\": \"search\",\n \"config\": {\n \"query\": \"<string>\",\n \"recency_minutes\": 2628000,\n \"result_limit\": 10\n },\n \"name\": \"<string>\",\n \"webhook_url\": \"<string>\",\n \"purpose\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"monitor": {
"id": "<string>",
"name": "<string>",
"schedule_cron": "0 9 * * *",
"status": "creating",
"last_error": "<string>",
"webhook_url": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"type": "fetch",
"config": {
"url": "<string>",
"format": "markdown",
"links": true,
"image_links": true,
"ttl": 123
}
},
"run": {
"results": [
{
"url": "https://example.com",
"final_url": "https://www.example.com",
"title": "Example Domain",
"description": "This domain is for use in illustrative examples.",
"language": "en",
"format": "markdown",
"text": "<string>",
"author": "John Doe",
"published_date": "2024-01-15",
"links": [
"<string>"
],
"image_links": [
"<string>"
],
"iframe_links": [
"<string>"
],
"page_metadata": {
"canonical": "https://example.com",
"robots": "max-image-preview:large",
"og": {
"title": "Example Domain",
"image": [
"https://example.com/og.png"
]
},
"twitter": {
"card": "summary_large_image"
}
},
"latency_ms": 1183.4,
"not_modified": true,
"etag": "W/\"abc123\"",
"last_modified": "Wed, 21 Oct 2015 07:28:00 GMT",
"unmatched_selectors": [
"aside.related"
]
}
],
"errors": [
{
"url": "https://invalid.example.com",
"error": "target_http_error",
"status": 404,
"unmatched_selectors": [
"article",
"#content"
],
"candidate_selectors": [
"main",
"nav",
"#content"
]
}
],
"id": "<string>",
"is_baseline": true,
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}API Reference
Create a Monitor
Create a Page (fetch) or Topic (search) Monitor and capture its baseline run.
POST
/
v1
/
monitors
Create a Monitor
curl --request POST \
--url https://agent.tinyfish.ai/v1/monitors \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"schedule_cron": "<string>",
"type": "search",
"config": {
"query": "<string>",
"recency_minutes": 2628000,
"result_limit": 10
},
"name": "<string>",
"webhook_url": "<string>",
"purpose": "<string>"
}
'import requests
url = "https://agent.tinyfish.ai/v1/monitors"
payload = {
"schedule_cron": "<string>",
"type": "search",
"config": {
"query": "<string>",
"recency_minutes": 2628000,
"result_limit": 10
},
"name": "<string>",
"webhook_url": "<string>",
"purpose": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
schedule_cron: '<string>',
type: 'search',
config: {query: '<string>', recency_minutes: 2628000, result_limit: 10},
name: '<string>',
webhook_url: '<string>',
purpose: '<string>'
})
};
fetch('https://agent.tinyfish.ai/v1/monitors', 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://agent.tinyfish.ai/v1/monitors",
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([
'schedule_cron' => '<string>',
'type' => 'search',
'config' => [
'query' => '<string>',
'recency_minutes' => 2628000,
'result_limit' => 10
],
'name' => '<string>',
'webhook_url' => '<string>',
'purpose' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://agent.tinyfish.ai/v1/monitors"
payload := strings.NewReader("{\n \"schedule_cron\": \"<string>\",\n \"type\": \"search\",\n \"config\": {\n \"query\": \"<string>\",\n \"recency_minutes\": 2628000,\n \"result_limit\": 10\n },\n \"name\": \"<string>\",\n \"webhook_url\": \"<string>\",\n \"purpose\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://agent.tinyfish.ai/v1/monitors")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"schedule_cron\": \"<string>\",\n \"type\": \"search\",\n \"config\": {\n \"query\": \"<string>\",\n \"recency_minutes\": 2628000,\n \"result_limit\": 10\n },\n \"name\": \"<string>\",\n \"webhook_url\": \"<string>\",\n \"purpose\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agent.tinyfish.ai/v1/monitors")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"schedule_cron\": \"<string>\",\n \"type\": \"search\",\n \"config\": {\n \"query\": \"<string>\",\n \"recency_minutes\": 2628000,\n \"result_limit\": 10\n },\n \"name\": \"<string>\",\n \"webhook_url\": \"<string>\",\n \"purpose\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"monitor": {
"id": "<string>",
"name": "<string>",
"schedule_cron": "0 9 * * *",
"status": "creating",
"last_error": "<string>",
"webhook_url": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"type": "fetch",
"config": {
"url": "<string>",
"format": "markdown",
"links": true,
"image_links": true,
"ttl": 123
}
},
"run": {
"results": [
{
"url": "https://example.com",
"final_url": "https://www.example.com",
"title": "Example Domain",
"description": "This domain is for use in illustrative examples.",
"language": "en",
"format": "markdown",
"text": "<string>",
"author": "John Doe",
"published_date": "2024-01-15",
"links": [
"<string>"
],
"image_links": [
"<string>"
],
"iframe_links": [
"<string>"
],
"page_metadata": {
"canonical": "https://example.com",
"robots": "max-image-preview:large",
"og": {
"title": "Example Domain",
"image": [
"https://example.com/og.png"
]
},
"twitter": {
"card": "summary_large_image"
}
},
"latency_ms": 1183.4,
"not_modified": true,
"etag": "W/\"abc123\"",
"last_modified": "Wed, 21 Oct 2015 07:28:00 GMT",
"unmatched_selectors": [
"aside.related"
]
}
],
"errors": [
{
"url": "https://invalid.example.com",
"error": "target_http_error",
"status": 404,
"unmatched_selectors": [
"article",
"#content"
],
"candidate_selectors": [
"main",
"nav",
"#content"
]
}
],
"id": "<string>",
"is_baseline": true,
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}Authorizations
API key for authentication. Get your key from the API Keys page.
Body
application/json
- Option 1
- Option 2
Maximum string length:
100Available options:
search Show child attributes
Show child attributes
Optional name for this Monitor.
Required string length:
1 - 100Optional URL that receives each scheduled run's results.
Optional plain-language description of the change that matters, e.g. "the price drops".
Required string length:
1 - 2000Was this page helpful?