Uptime monitors
GET https://2uptime.com/api/monitors/
curl --request GET \
--url 'https://2uptime.com/api/monitors/' \
--header 'Authorization: Bearer {api_key}' \
--url 'https://2uptime.com/api/monitors/' \
--header 'Authorization: Bearer {api_key}' \
Parameters | Details | Description |
---|---|---|
page | Optional Integer | The page number that you want results from. Defaults to 1 . |
results_per_page | Optional Integer | How many results you want per page. Allowed values are: 10 , 25 , 50 , 100 , 250 , 500 , 1000 . Defaults to 25 . |
{
"data": [
{
"id": 1,
"project_id": 0,
"name": "Example",
"type": "website",
"target": "https://example.com/",
"port": 0,
"settings": {
"check_interval_seconds": 3600,
"timeout_seconds": 1,
"request_method": "GET",
"request_body": "",
"request_basic_auth_username": "",
"request_basic_auth_password": "",
"request_headers": [],
"response_status_code": 200,
"response_body": "",
"response_headers": []
},
"ping_servers_ids": [1],
"is_ok": 1,
"uptime": 95.5,
"downtime": 4.5,
"average_response_time": 500,
"total_checks": 500,
"total_ok_checks": 450,
"total_not_ok_checks": 50,
"last_check_datetime": "2021-03-25 08:27:07",
"notifications": {
"email_is_enabled": 0,
"webhook":"",
"slack":"",
"twilio":""
},
"is_enabled": false,
"datetime": "2021-02-12 21:54:29"
}
],
"meta": {
"page": 1,
"results_per_page": 25,
"total": 1,
"total_pages": 1
},
"links": {
"first": "https://2uptime.com/api/monitors?&page=1",
"last": "https://2uptime.com/api/monitors?&page=1",
"next": null,
"prev": null,
"self": "https://2uptime.com/api/monitors?&page=1"
}
}
GET https://2uptime.com/api/monitors/{monitor_id}
curl --request GET \
--url 'https://2uptime.com/api/monitors/{monitor_id}' \
--header 'Authorization: Bearer {api_key}' \
--url 'https://2uptime.com/api/monitors/{monitor_id}' \
--header 'Authorization: Bearer {api_key}' \
{
"data": {
"id": 1,
"project_id": 0,
"name": "Example",
"type": "website",
"target": "https://example.com/",
"port": 0,
"settings": {
"check_interval_seconds": 3600,
"timeout_seconds": 1,
"request_method": "GET",
"request_body": "",
"request_basic_auth_username": "",
"request_basic_auth_password": "",
"request_headers": [],
"response_status_code": 200,
"response_body": "",
"response_headers": []
},
"ping_servers_ids": [1],
"is_ok": 1,
"uptime": 95.5,
"downtime": 4.5,
"average_response_time": 500,
"total_checks": 500,
"total_ok_checks": 450,
"total_not_ok_checks": 50,
"last_check_datetime": "2021-03-25 08:27:07",
"notifications": {
"email_is_enabled": 0,
"webhook":"",
"slack":"",
"twilio":""
},
"is_enabled": false,
"datetime": "2021-02-12 21:54:29"
}
}
POST https://2uptime.com/api/monitors
Parameters | Details | Description |
---|---|---|
name | Required String | - |
target | Required String | - |
port | Optional String | - |
type | Optional String | Allowed values: website , ping , port |
project_id | Optional Integer | - |
ping_servers_ids | Optional Array | Allowed values: 1 |
check_interval_seconds | Optional Integer | Allowed values: 60 , 180 , 300 , 600 , 1800 , 3600 , 21600 , 43200 , 86400 (seconds) |
timeout_seconds | Optional Integer | Allowed values: 1 , 2 , 3 , 5 , 10 , 25 (seconds) |
ping_ipv | Optional String |
Available when: type = ping Allowed values: ipv4 , ipv6 |
request_method | Optional String | Allowed values: HEAD , GET , POST , PUT , PATCH |
request_body | Optional String | - |
request_basic_auth_username | Optional String | - |
request_basic_auth_password | Optional String | - |
request_header_name | Optional Array | - |
request_header_value | Optional Array | - |
response_status_code | Optional Integer | - |
response_body | Optional String | - |
response_header_name | Optional String | - |
response_header_value | Optional String | - |
is_ok_notifications | Optional Array | Notification handler ids |
email_reports_is_enabled | Optional Boolean | - |
cache_buster_is_enabled | Optional Boolean | - |
is_enabled | Optional Boolean | - |
curl --request POST \
--url 'https://2uptime.com/api/monitors' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--form 'target=https://example.com/' \
--url 'https://2uptime.com/api/monitors' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--form 'target=https://example.com/' \
{
"data": {
"id": 1
}
}
POST https://2uptime.com/api/monitors/{monitor_id}
Parameters | Details | Description |
---|---|---|
name | Optional String | - |
target | Optional String | - |
port | Optional String | - |
type | Optional String | Allowed values: website , ping , port |
project_id | Optional Integer | - |
ping_servers_ids | Optional Array | Allowed values: 1 |
check_interval_seconds | Optional Integer | Allowed values: 60 , 180 , 300 , 600 , 1800 , 3600 , 21600 , 43200 , 86400 (seconds) |
timeout_seconds | Optional Integer | Allowed values: 1 , 2 , 3 , 5 , 10 , 25 (seconds) |
ping_ipv | Optional String |
Available when: type = ping Allowed values: ipv4 , ipv6 |
request_method | Optional String | Allowed values: HEAD , GET , POST , PUT , PATCH |
request_body | Optional String | - |
request_basic_auth_username | Optional String | - |
request_basic_auth_password | Optional String | - |
request_header_name | Optional Array | - |
request_header_value | Optional Array | - |
response_status_code | Optional Integer | - |
response_body | Optional String | - |
response_header_name | Optional String | - |
response_header_value | Optional String | - |
is_ok_notifications | Optional Array | Notification handler ids |
email_reports_is_enabled | Optional Boolean | - |
cache_buster_is_enabled | Optional Boolean | - |
is_enabled | Optional Boolean | - |
curl --request POST \
--url 'https://2uptime.com/api/monitors/{monitor_id}' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--url 'https://2uptime.com/api/monitors/{monitor_id}' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
{
"data": {
"id": 1
}
}
DELETE https://2uptime.com/api/monitors/{monitor_id}
curl --request DELETE \
--url 'https://2uptime.com/api/monitors/{monitor_id}' \
--header 'Authorization: Bearer {api_key}' \
--url 'https://2uptime.com/api/monitors/{monitor_id}' \
--header 'Authorization: Bearer {api_key}' \