POST
/
uptime
/
monitors
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",
  "protocol": "http",
  "request": {
    "method": "HEAD",
    "url": "https://docs.phare.io/introduction",
    "tls_skip_verify": false,
    "follow_redirects": true,
    "keyword": "pong",
    "user_agent_secret": "definitely-not-a-bot",
    "headers": [
      {
        "name": "X-Phare-Says",
        "value": "Hello world!"
      }
    ]
  },
  "interval": 60,
  "timeout": 7000,
  "success_assertions": [
    {
      "type": "status_code",
      "operator": "in",
      "value": "2xx,30x,418"
    }
  ],
  "incident_confirmations": 1,
  "recovery_confirmations": 1,
  "regions": [
    "as-jpn-hnd"
  ]
}'
{
  "id": 1,
  "project_id": 1,
  "status": "fetching",
  "paused": true,
  "response_time": 123,
  "one_day_availability": 99.9999,
  "seven_days_availability": 99.9999,
  "name": "Website",
  "protocol": "http",
  "request": {
    "method": "HEAD",
    "url": "https://docs.phare.io/introduction",
    "tls_skip_verify": false,
    "follow_redirects": true,
    "keyword": "pong",
    "user_agent_secret": "definitely-not-a-bot",
    "headers": [
      {
        "name": "X-Phare-Says",
        "value": "Hello world!"
      }
    ]
  },
  "interval": 60,
  "timeout": 7000,
  "success_assertions": [
    {
      "type": "status_code",
      "operator": "in",
      "value": "2xx,30x,418"
    }
  ],
  "incident_confirmations": 1,
  "recovery_confirmations": 1,
  "regions": [
    "as-jpn-hnd"
  ],
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z"
}
Please be aware that the Phare API is currently in beta and is subject to change.

Authorizations

Authorization
string
header
required

Use a user token to access authenticated routes. The token must be specified in the Authorization HTTP header with the following format 'Authorization: Bearer <token>'.

Body

application/json

Monitor request

name
string
required

Monitor name

Example:

"Website"

protocol
enum<string>
required
Available options:
http,
tcp
request
object
required

Monitoring request, depends of the chosen protocol

interval
enum<number>
required

Monitoring interval in seconds

Available options:
30,
60,
120,
180,
300,
600,
900,
1800,
3600
Example:

60

timeout
enum<number>
required

Monitoring timeout in milliseconds

Available options:
1000,
2000,
3000,
4000,
5000,
6000,
7000,
8000,
9000,
10000,
15000,
20000,
25000,
30000
Example:

7000

incident_confirmations
enum<number>
required

Number of uninterrupted failed checks required to create an incident

Available options:
1,
2,
3,
4,
5
Example:

1

recovery_confirmations
enum<number>
required

Number of uninterrupted successful checks required to resolve an incident

Available options:
1,
2,
3,
4,
5
Example:

1

regions
enum<string>[]
required

List of regions where monitoring checks are performed

Required array length: 1 - 6 elements
success_assertions
(Status code assertion · object | Response header assertion · object | Response body assertion · object)[]

List of assertions that must be true for the check to be considered successful

Response

201
application/json

Success, monitor created

name
string
required

Monitor name

Example:

"Website"

protocol
enum<string>
required
Available options:
http,
tcp
request
object
required

Monitoring request, depends of the chosen protocol

interval
enum<number>
required

Monitoring interval in seconds

Available options:
30,
60,
120,
180,
300,
600,
900,
1800,
3600
Example:

60

timeout
enum<number>
required

Monitoring timeout in milliseconds

Available options:
1000,
2000,
3000,
4000,
5000,
6000,
7000,
8000,
9000,
10000,
15000,
20000,
25000,
30000
Example:

7000

incident_confirmations
enum<number>
required

Number of uninterrupted failed checks required to create an incident

Available options:
1,
2,
3,
4,
5
Example:

1

recovery_confirmations
enum<number>
required

Number of uninterrupted successful checks required to resolve an incident

Available options:
1,
2,
3,
4,
5
Example:

1

regions
enum<string>[]
required

List of regions where monitoring checks are performed

Required array length: 1 - 6 elements
id
number

Monitor ID

Example:

1

project_id
number

Parent project ID

Example:

1

status
enum<string>
Available options:
fetching,
online,
offline,
partial
paused
boolean

Whether the monitor is currently paused

Example:

true

response_time
number | null

Rolling average response time of the last 10 requests, in milliseconds

Example:

123

one_day_availability
number | null

Availability percentage for the last 24 hours

Example:

99.9999

seven_days_availability
number | null

Availability percentage for the last 7 days

Example:

99.9999

success_assertions
(Status code assertion · object | Response header assertion · object | Response body assertion · object)[]

List of assertions that must be true for the check to be considered successful

created_at
string

Date of creation for the entity

updated_at
string

Date of last update for the entity