curl --request POST \
--url https://api.phare.io/uptime/monitors \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Website",
"request": {
"url": "https://docs.phare.io/introduction",
"tls_skip_verify": false,
"body": "Hello, World!",
"follow_redirects": true,
"user_agent_secret": "definitely-not-a-bot",
"headers": [
{
"name": "X-Phare-Says",
"value": "Hello world!"
}
]
},
"regions": [],
"interval": 60,
"timeout": 20000,
"success_assertions": [
{
"type": "status_code",
"operator": "in",
"value": "2xx,30x,418"
}
],
"incident_confirmations": 1,
"recovery_confirmations": 1,
"region_threshold": 1,
"tags": [
"environment:production"
]
}
'import requests
url = "https://api.phare.io/uptime/monitors"
payload = {
"name": "Website",
"request": {
"url": "https://docs.phare.io/introduction",
"tls_skip_verify": False,
"body": "Hello, World!",
"follow_redirects": True,
"user_agent_secret": "definitely-not-a-bot",
"headers": [
{
"name": "X-Phare-Says",
"value": "Hello world!"
}
]
},
"regions": [],
"interval": 60,
"timeout": 20000,
"success_assertions": [
{
"type": "status_code",
"operator": "in",
"value": "2xx,30x,418"
}
],
"incident_confirmations": 1,
"recovery_confirmations": 1,
"region_threshold": 1,
"tags": ["environment:production"]
}
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({
name: 'Website',
request: {
url: 'https://docs.phare.io/introduction',
tls_skip_verify: false,
body: JSON.stringify('Hello, World!'),
follow_redirects: true,
user_agent_secret: 'definitely-not-a-bot',
headers: [{name: 'X-Phare-Says', value: 'Hello world!'}]
},
regions: [],
interval: 60,
timeout: 20000,
success_assertions: [{type: 'status_code', operator: 'in', value: '2xx,30x,418'}],
incident_confirmations: 1,
recovery_confirmations: 1,
region_threshold: 1,
tags: ['environment:production']
})
};
fetch('https://api.phare.io/uptime/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://api.phare.io/uptime/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([
'name' => 'Website',
'request' => [
'url' => 'https://docs.phare.io/introduction',
'tls_skip_verify' => false,
'body' => 'Hello, World!',
'follow_redirects' => true,
'user_agent_secret' => 'definitely-not-a-bot',
'headers' => [
[
'name' => 'X-Phare-Says',
'value' => 'Hello world!'
]
]
],
'regions' => [
],
'interval' => 60,
'timeout' => 20000,
'success_assertions' => [
[
'type' => 'status_code',
'operator' => 'in',
'value' => '2xx,30x,418'
]
],
'incident_confirmations' => 1,
'recovery_confirmations' => 1,
'region_threshold' => 1,
'tags' => [
'environment:production'
]
]),
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.phare.io/uptime/monitors"
payload := strings.NewReader("{\n \"name\": \"Website\",\n \"request\": {\n \"url\": \"https://docs.phare.io/introduction\",\n \"tls_skip_verify\": false,\n \"body\": \"Hello, World!\",\n \"follow_redirects\": true,\n \"user_agent_secret\": \"definitely-not-a-bot\",\n \"headers\": [\n {\n \"name\": \"X-Phare-Says\",\n \"value\": \"Hello world!\"\n }\n ]\n },\n \"regions\": [],\n \"interval\": 60,\n \"timeout\": 20000,\n \"success_assertions\": [\n {\n \"type\": \"status_code\",\n \"operator\": \"in\",\n \"value\": \"2xx,30x,418\"\n }\n ],\n \"incident_confirmations\": 1,\n \"recovery_confirmations\": 1,\n \"region_threshold\": 1,\n \"tags\": [\n \"environment:production\"\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.phare.io/uptime/monitors")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Website\",\n \"request\": {\n \"url\": \"https://docs.phare.io/introduction\",\n \"tls_skip_verify\": false,\n \"body\": \"Hello, World!\",\n \"follow_redirects\": true,\n \"user_agent_secret\": \"definitely-not-a-bot\",\n \"headers\": [\n {\n \"name\": \"X-Phare-Says\",\n \"value\": \"Hello world!\"\n }\n ]\n },\n \"regions\": [],\n \"interval\": 60,\n \"timeout\": 20000,\n \"success_assertions\": [\n {\n \"type\": \"status_code\",\n \"operator\": \"in\",\n \"value\": \"2xx,30x,418\"\n }\n ],\n \"incident_confirmations\": 1,\n \"recovery_confirmations\": 1,\n \"region_threshold\": 1,\n \"tags\": [\n \"environment:production\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phare.io/uptime/monitors")
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 \"name\": \"Website\",\n \"request\": {\n \"url\": \"https://docs.phare.io/introduction\",\n \"tls_skip_verify\": false,\n \"body\": \"Hello, World!\",\n \"follow_redirects\": true,\n \"user_agent_secret\": \"definitely-not-a-bot\",\n \"headers\": [\n {\n \"name\": \"X-Phare-Says\",\n \"value\": \"Hello world!\"\n }\n ]\n },\n \"regions\": [],\n \"interval\": 60,\n \"timeout\": 20000,\n \"success_assertions\": [\n {\n \"type\": \"status_code\",\n \"operator\": \"in\",\n \"value\": \"2xx,30x,418\"\n }\n ],\n \"incident_confirmations\": 1,\n \"recovery_confirmations\": 1,\n \"region_threshold\": 1,\n \"tags\": [\n \"environment:production\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"name": "Website",
"protocol": "http",
"request": {
"method": "HEAD",
"url": "https://docs.phare.io/introduction",
"tls_skip_verify": false,
"body": "Hello, World!",
"follow_redirects": true,
"user_agent_secret": "definitely-not-a-bot",
"headers": [
{
"name": "X-Phare-Says",
"value": "Hello world!"
}
]
},
"regions": [
"as-jpn-hnd"
],
"id": 1,
"project_id": 1,
"status": "fetching",
"paused": true,
"response_time": 123,
"interval": 60,
"timeout": 20000,
"success_assertions": [
{
"type": "status_code",
"operator": "in",
"value": "2xx,30x,418"
}
],
"incident_confirmations": 1,
"recovery_confirmations": 1,
"region_threshold": 1,
"tags": [
"environment:production"
],
"last_checked_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"message": "Unauthenticated."
}{
"message": "The platform:write permission is required to perform this action."
}{
"message": "<string>",
"errors": {
"key": [
"The key field is required"
]
}
}Create a monitor
Create a monitor
curl --request POST \
--url https://api.phare.io/uptime/monitors \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Website",
"request": {
"url": "https://docs.phare.io/introduction",
"tls_skip_verify": false,
"body": "Hello, World!",
"follow_redirects": true,
"user_agent_secret": "definitely-not-a-bot",
"headers": [
{
"name": "X-Phare-Says",
"value": "Hello world!"
}
]
},
"regions": [],
"interval": 60,
"timeout": 20000,
"success_assertions": [
{
"type": "status_code",
"operator": "in",
"value": "2xx,30x,418"
}
],
"incident_confirmations": 1,
"recovery_confirmations": 1,
"region_threshold": 1,
"tags": [
"environment:production"
]
}
'import requests
url = "https://api.phare.io/uptime/monitors"
payload = {
"name": "Website",
"request": {
"url": "https://docs.phare.io/introduction",
"tls_skip_verify": False,
"body": "Hello, World!",
"follow_redirects": True,
"user_agent_secret": "definitely-not-a-bot",
"headers": [
{
"name": "X-Phare-Says",
"value": "Hello world!"
}
]
},
"regions": [],
"interval": 60,
"timeout": 20000,
"success_assertions": [
{
"type": "status_code",
"operator": "in",
"value": "2xx,30x,418"
}
],
"incident_confirmations": 1,
"recovery_confirmations": 1,
"region_threshold": 1,
"tags": ["environment:production"]
}
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({
name: 'Website',
request: {
url: 'https://docs.phare.io/introduction',
tls_skip_verify: false,
body: JSON.stringify('Hello, World!'),
follow_redirects: true,
user_agent_secret: 'definitely-not-a-bot',
headers: [{name: 'X-Phare-Says', value: 'Hello world!'}]
},
regions: [],
interval: 60,
timeout: 20000,
success_assertions: [{type: 'status_code', operator: 'in', value: '2xx,30x,418'}],
incident_confirmations: 1,
recovery_confirmations: 1,
region_threshold: 1,
tags: ['environment:production']
})
};
fetch('https://api.phare.io/uptime/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://api.phare.io/uptime/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([
'name' => 'Website',
'request' => [
'url' => 'https://docs.phare.io/introduction',
'tls_skip_verify' => false,
'body' => 'Hello, World!',
'follow_redirects' => true,
'user_agent_secret' => 'definitely-not-a-bot',
'headers' => [
[
'name' => 'X-Phare-Says',
'value' => 'Hello world!'
]
]
],
'regions' => [
],
'interval' => 60,
'timeout' => 20000,
'success_assertions' => [
[
'type' => 'status_code',
'operator' => 'in',
'value' => '2xx,30x,418'
]
],
'incident_confirmations' => 1,
'recovery_confirmations' => 1,
'region_threshold' => 1,
'tags' => [
'environment:production'
]
]),
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.phare.io/uptime/monitors"
payload := strings.NewReader("{\n \"name\": \"Website\",\n \"request\": {\n \"url\": \"https://docs.phare.io/introduction\",\n \"tls_skip_verify\": false,\n \"body\": \"Hello, World!\",\n \"follow_redirects\": true,\n \"user_agent_secret\": \"definitely-not-a-bot\",\n \"headers\": [\n {\n \"name\": \"X-Phare-Says\",\n \"value\": \"Hello world!\"\n }\n ]\n },\n \"regions\": [],\n \"interval\": 60,\n \"timeout\": 20000,\n \"success_assertions\": [\n {\n \"type\": \"status_code\",\n \"operator\": \"in\",\n \"value\": \"2xx,30x,418\"\n }\n ],\n \"incident_confirmations\": 1,\n \"recovery_confirmations\": 1,\n \"region_threshold\": 1,\n \"tags\": [\n \"environment:production\"\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.phare.io/uptime/monitors")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Website\",\n \"request\": {\n \"url\": \"https://docs.phare.io/introduction\",\n \"tls_skip_verify\": false,\n \"body\": \"Hello, World!\",\n \"follow_redirects\": true,\n \"user_agent_secret\": \"definitely-not-a-bot\",\n \"headers\": [\n {\n \"name\": \"X-Phare-Says\",\n \"value\": \"Hello world!\"\n }\n ]\n },\n \"regions\": [],\n \"interval\": 60,\n \"timeout\": 20000,\n \"success_assertions\": [\n {\n \"type\": \"status_code\",\n \"operator\": \"in\",\n \"value\": \"2xx,30x,418\"\n }\n ],\n \"incident_confirmations\": 1,\n \"recovery_confirmations\": 1,\n \"region_threshold\": 1,\n \"tags\": [\n \"environment:production\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phare.io/uptime/monitors")
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 \"name\": \"Website\",\n \"request\": {\n \"url\": \"https://docs.phare.io/introduction\",\n \"tls_skip_verify\": false,\n \"body\": \"Hello, World!\",\n \"follow_redirects\": true,\n \"user_agent_secret\": \"definitely-not-a-bot\",\n \"headers\": [\n {\n \"name\": \"X-Phare-Says\",\n \"value\": \"Hello world!\"\n }\n ]\n },\n \"regions\": [],\n \"interval\": 60,\n \"timeout\": 20000,\n \"success_assertions\": [\n {\n \"type\": \"status_code\",\n \"operator\": \"in\",\n \"value\": \"2xx,30x,418\"\n }\n ],\n \"incident_confirmations\": 1,\n \"recovery_confirmations\": 1,\n \"region_threshold\": 1,\n \"tags\": [\n \"environment:production\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"name": "Website",
"protocol": "http",
"request": {
"method": "HEAD",
"url": "https://docs.phare.io/introduction",
"tls_skip_verify": false,
"body": "Hello, World!",
"follow_redirects": true,
"user_agent_secret": "definitely-not-a-bot",
"headers": [
{
"name": "X-Phare-Says",
"value": "Hello world!"
}
]
},
"regions": [
"as-jpn-hnd"
],
"id": 1,
"project_id": 1,
"status": "fetching",
"paused": true,
"response_time": 123,
"interval": 60,
"timeout": 20000,
"success_assertions": [
{
"type": "status_code",
"operator": "in",
"value": "2xx,30x,418"
}
],
"incident_confirmations": 1,
"recovery_confirmations": 1,
"region_threshold": 1,
"tags": [
"environment:production"
],
"last_checked_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"message": "Unauthenticated."
}{
"message": "The platform:write permission is required to perform this action."
}{
"message": "<string>",
"errors": {
"key": [
"The key field is required"
]
}
}Authorizations
Use a user token to access authenticated routes. The token must be specified in the Authorization HTTP header with the following format 'Authorization: Bearer '.
Headers
A project header is required when using an organization-scoped API key.
1
A project header is required when using an organization-scoped API key.
"luminous-guiding-tower"
Body
Monitor request
Monitor name
2 - 45"Website"
Monitoring protocol
http, tcp, icmp Monitoring request, depends of the chosen protocol
- HTTP protocol
- TCP protocol
- ICMP protocol
Show child attributes
Show child attributes
List of regions where monitoring checks are performed
1 - 10 elementsas-jpn-hnd, as-sgp-sin, as-tha-bkk, eu-deu-fra, eu-fra-cdg, eu-gbr-lhr, eu-swe-arn, ng-nld-ams, na-mex-mex, na-usa-iad, na-usa-sea, oc-aus-syd, sa-bra-gru Monitoring interval in seconds
30, 60, 120, 180, 300, 600, 900, 1800, 3600 60
Monitoring timeout in milliseconds
1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 15000, 20000, 25000, 30000 20000
List of assertions that must be true for the check to be considered successful. At least one assertion is required for the HTTP protocol, assertions are ignored for the TCP and ICMP protocols.
- Status code assertion
- Response header assertion
- Response body assertion
Show child attributes
Show child attributes
Number of uninterrupted failed checks required to create an incident
1, 2, 3, 4, 5 1
Number of uninterrupted successful checks required to resolve an incident
1, 2, 3, 4, 5 1
Number of regions that must fail before an incident is confirmed, cannot exceed the number of selected regions
1 <= x <= 101
Resource tags, made of lowercase letters, numbers, ., _, : and -. An organization can have up to 200 tags.
201 - 100Response
Success, monitor created
Monitor name
2 - 45"Website"
Monitoring protocol
http, tcp, icmp Monitoring request, depends of the chosen protocol
- HTTP protocol
- TCP protocol
- ICMP protocol
Show child attributes
Show child attributes
List of regions where monitoring checks are performed
1 - 10 elementsas-jpn-hnd, as-sgp-sin, as-tha-bkk, eu-deu-fra, eu-fra-cdg, eu-gbr-lhr, eu-swe-arn, ng-nld-ams, na-mex-mex, na-usa-iad, na-usa-sea, oc-aus-syd, sa-bra-gru Monitor ID
1
Parent project ID
1
Monitor current status
fetching, online, offline, partial, paused Whether the monitor is currently paused
true
75th percentile (P75) response time of successful checks over the last 7 days, in milliseconds
123
Monitoring interval in seconds
30, 60, 120, 180, 300, 600, 900, 1800, 3600 60
Monitoring timeout in milliseconds
1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 15000, 20000, 25000, 30000 20000
List of assertions that must be true for the check to be considered successful. At least one assertion is required for the HTTP protocol, assertions are ignored for the TCP and ICMP protocols.
- Status code assertion
- Response header assertion
- Response body assertion
Show child attributes
Show child attributes
Number of uninterrupted failed checks required to create an incident
1, 2, 3, 4, 5 1
Number of uninterrupted successful checks required to resolve an incident
1, 2, 3, 4, 5 1
Number of regions that must fail before an incident is confirmed, cannot exceed the number of selected regions
1 <= x <= 101
Resource tags, made of lowercase letters, numbers, ., _, : and -. An organization can have up to 200 tags.
201 - 100Date of the last performed check with a 30s accuracy
Date of creation for the entity
Date of last update for the entity
Was this page helpful?