APIv2 (beta)

Integrate Uptime Robot into your sites and apps...

Info: The documentation for the older API (APIv1) is still available.

Uptime Robot has a very easy-to-use API.

Responses are provided as XML, JSON or JSON-P.

It lets you get the details of your monitors, logs, create/edit/delete monitors, alert contacts and maintenance windows.

That's all.

Authentication

HTTP Basic Access Authentication is used for verifying accounts.

There are 2 types of api_keys for reaching the data:
  • account-specific api_key which allows using all the API methods on all the monitors of an account
  • monitor-specific api_keys which allows using only the getMonitors method for the given monitor

Which api_key type to use?

account-specific api_key is good for pulling data for more than 1 monitors (like listing the stats of all monitors) and/or adding-editing-deleting monitors.

monitor-specific api_keys are good for pulling data for a single monitor without revealing your main api_key (account-specific api_key). For ex: you can use monitor-specific api_keys in client websites (so you'll still be able to pull data and the client will only be able to see the monitor-specific api_key).

Where to find the api_keys?

They are found under "My Settings" page.

While making a request, send the api_key in your request just like:

api_key=u956-afus321g565fghr519 (check example requests below).

Formats

Responses can either be XML or JSON. Just mention the preferred format as:

format=xml or format=json

In order to get a JSON-P response, the requests need to be sent with a parameter named callback like callback=jsonpUptimeRobot and the response will return as:

jsonpUptimeRobot({...});

Methods

Methods are defined just after the API URL (for ex: https://api.uptimerobot.com/v2/methodName). And, here they are:

POST getAccountDetails

Account details (max number of monitors that can be added and number of up/down/paused monitors) can be grabbed using this method.

Parameters
  • api_key - required

The URL for the request would be:

https://api.uptimerobot.com/v2/getAccountDetails

										curl -X POST -H "Cache-Control: no-cache" -H "Content-Type: application/x-www-form-urlencoded" -d 'api_key=enterYourAPIKeyHere&format=json' "https://api.uptimerobot.com/v2/getAccountDetails"
									
										$curl = curl_init();

										curl_setopt_array($curl, array(
										  CURLOPT_URL => "https://api.uptimerobot.com/v2/getAccountDetails",
										  CURLOPT_RETURNTRANSFER => true,
										  CURLOPT_ENCODING => "",
										  CURLOPT_MAXREDIRS => 10,
										  CURLOPT_TIMEOUT => 30,
										  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
										  CURLOPT_CUSTOMREQUEST => "POST",
										  CURLOPT_POSTFIELDS => "api_key=enterYourAPIKeyHere&format=json",
										  CURLOPT_HTTPHEADER => array(
										    "cache-control: no-cache",
										    "content-type: application/x-www-form-urlencoded"
										  ),
										));

										$response = curl_exec($curl);
										$err = curl_error($curl);

										curl_close($curl);

										if ($err) {
										  echo "cURL Error #:" . $err;
										} else {
										  echo $response;
										}
									
										$request = new HttpRequest();
										$request->setUrl('https://api.uptimerobot.com/v2/getAccountDetails');
										$request->setMethod(HTTP_METH_POST);

										$request->setHeaders(array(
										  'content-type' => 'application/x-www-form-urlencoded',
										  'cache-control' => 'no-cache'
										));

										$request->setContentType('application/x-www-form-urlencoded');
										$request->setPostFields(array(
										  'api_key' => 'enterYourAPIKeyHere',
										  'format' => 'json'
										));

										try {
										  $response = $request->send();

										  echo $response->getBody();
										} catch (HttpException $ex) {
										  echo $ex;
										}
									
										import http.client

										conn = http.client.HTTPSConnection("api.uptimerobot.com")

										payload = "api_key=enterYourAPIKeyHere&format=json"

										headers = {
										    'cache-control': "no-cache",
										    'content-type': "application/x-www-form-urlencoded"
										    }

										conn.request("POST", "/v2/getAccountDetails", payload, headers)

										res = conn.getresponse()
										data = res.read()

										print(data.decode("utf-8"))
									
										import requests

										url = "https://api.uptimerobot.com/v2/getAccountDetails"

										payload = "api_key=enterYourAPIKeyHere&format=json"
										headers = {
										    'cache-control': "no-cache",
										    'content-type': "application/x-www-form-urlencoded"
										    }

										response = requests.request("POST", url, data=payload, headers=headers)

										print(response.text)
									
										var qs = require("querystring");
										var http = require("https");

										var options = {
										  "method": "POST",
										  "hostname": "api.uptimerobot.com",
										  "port": null,
										  "path": "/v2/getAccountDetails",
										  "headers": {
										    "cache-control": "no-cache",
										    "content-type": "application/x-www-form-urlencoded"
										  }
										};

										var req = http.request(options, function (res) {
										  var chunks = [];

										  res.on("data", function (chunk) {
										    chunks.push(chunk);
										  });

										  res.on("end", function () {
										    var body = Buffer.concat(chunks);
										    console.log(body.toString());
										  });
										});

										req.write(qs.stringify({ api_key: 'enterYourAPIKeyHere', format: 'json' }));
										req.end();
									
										var request = require("request");

										var options = { method: 'POST',
										  url: 'https://api.uptimerobot.com/v2/getAccountDetails',
										  headers:
										   { 'content-type': 'application/x-www-form-urlencoded',
										     'cache-control': 'no-cache' },
										  form: { api_key: 'enterYourAPIKeyHere', format: 'json' } };

										request(options, function (error, response, body) {
										  if (error) throw new Error(error);

										  console.log(body);
										});
									
										package main

										import (
											"fmt"
											"strings"
											"net/http"
											"io/ioutil"
										)

										func main() {

											url := "https://api.uptimerobot.com/v2/getAccountDetails"

											payload := strings.NewReader("api_key=enterYourAPIKeyHere&format=json")

											req, _ := http.NewRequest("POST", url, payload)

											req.Header.Add("cache-control", "no-cache")
											req.Header.Add("content-type", "application/x-www-form-urlencoded")

											res, _ := http.DefaultClient.Do(req)

											defer res.Body.Close()
											body, _ := ioutil.ReadAll(res.Body)

											fmt.Println(res)
											fmt.Println(string(body))

										}
									
										var client = new RestClient("https://api.uptimerobot.com/v2/getAccountDetails");
										var request = new RestRequest(Method.POST);
										request.AddHeader("content-type", "application/x-www-form-urlencoded");
										request.AddHeader("cache-control", "no-cache");
										request.AddParameter("application/x-www-form-urlencoded", "api_key=enterYourAPIKeyHere&format=json", ParameterType.RequestBody);
										IRestResponse response = client.Execute(request);
									
										require 'uri'
										require 'net/http'

										url = URI("https://api.uptimerobot.com/v2/getAccountDetails")

										http = Net::HTTP.new(url.host, url.port)
										http.use_ssl = true
										http.verify_mode = OpenSSL::SSL::VERIFY_NONE

										request = Net::HTTP::Post.new(url)
										request["cache-control"] = 'no-cache'
										request["content-type"] = 'application/x-www-form-urlencoded'
										request.body = "api_key=enterYourAPIKeyHere&format=json"

										response = http.request(request)
										puts response.read_body
									
										OkHttpClient client = new OkHttpClient();

										MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
										RequestBody body = RequestBody.create(mediaType, "api_key=enterYourAPIKeyHere&format=json");
										Request request = new Request.Builder()
										  .url("https://api.uptimerobot.com/v2/getAccountDetails")
										  .post(body)
										  .addHeader("cache-control", "no-cache")
										  .addHeader("content-type", "application/x-www-form-urlencoded")
										  .build();

										Response response = client.newCall(request).execute();
									

The responses would be:

XML

									
								

JSON

										{
										  "stat": "ok",
										  "account": {
										    "id": 1,
										    "email": "test@domain.com",
										    "monitor_limit": 50,
										    "monitor_interval": 1,
										    "up_monitors": 1,
										    "down_monitors": 0,
										    "paused_monitors": 2
										  }
										}
									

POST getMonitors

This is a Swiss-Army knife type of a method for getting any information on monitors.

By default, it lists all the monitors in a user's account, their friendly names, types (http, keyword, port, etc.), statuses (up, down, etc.) and uptime ratios.

There are optional parameters which lets the getMonitors method to output information on any given monitors rather than all of them.

And also, parameters exist for getting the notification logs (alerts) for each monitor and even which alert contacts were alerted on each notification.

Parameters:
  • api_key - required
  • monitors - optional (if not used, will return all monitors in an account. Else, it is possible to define any number of monitors with their IDs like: monitors=15830-32696-83920)
  • types - optional (if not used, will return all monitors types (HTTP, keyword, ping..) in an account. Else, it is possible to define any number of monitor types like: types=1-3-4)
  • statuses - optional (if not used, will return all monitors statuses (up, down, paused) in an account. Else, it is possible to define any number of monitor statuses like: statuses=2-9)
  • custom_uptime_ratios - optional (defines the number of days to calculate the uptime ratio(s) for. Ex: custom_uptime_ratios=7-30-45 to get the uptime ratios for those periods)
  • custom_uptime_ranges - optional (defines the ranges to calculate the uptime ratio(s) for. Ex: custom_uptime_ranges=1465440758_1466304758 to get the uptime ratios for those periods. It is possible to send multiple ranges like 1465440758_1466304758-1434682358_1434855158)
  • all_time_uptime_ratio - optional (returns the "all time uptime ratio". It will slow down the response a bit and, if not really necessary, suggest not using it. Default is 0)
  • all_time_uptime_durations - optional (returns the "all time durations of up-down-paused events". It will slow down the response a bit and, if not really necessary, suggest not using it. Default is 0)
  • logs - optional (defines if the logs of each monitor will be returned. Should be set to 1 for getting the logs. Default is 0)
  • logs_start_date - optional and works only for the Pro Plan as 24 hour+ logs are kept only in the Pro Plan (starting date of the response times, formatted as Unix time and must be used with response_times_end_date) (can only be used if monitors parameter is used with a single id and response_times_end_date - response_times_start_date can't be more than 7 days)
  • logs_end_date - optional and works only for the Pro Plan as 24 hour+ logs are kept only in the Pro Plan (ending date of the response times, formatted as Unix time and must be used with response_times_start_date) (can only be used if monitors parameter is used with a single id and response_times_end_date - response_times_start_date can't be more than 7 days)
  • logs_limit - optional (the number of logs to be returned (descending order). If empty, all logs are returned.
  • response_times - optional (defines if the response time data of each monitor will be returned. Should be set to 1 for getting them. Default is 0)
  • response_times_limit - optional (the number of response time logs to be returned (descending order). If empty, last 24 hours of logs are returned (if response_times_start_date and response_times_end_date are not used).
  • response_times_average - optional (by default, response time value of each check is returned. The API can return average values in given minutes. Default is 0. For ex: the Uptime Robot dashboard displays the data averaged/grouped in 30 minutes)
  • response_times_start_date - optional (starting date of the logs, formatted as Unix time and must be used with logs_end_date) (can only be used if monitors parameter is used with a single id)
  • response_times_end_date - optional (ending date of the logs, formatted as Unix time and must be used with logs_start_date) (can only be used if monitors parameter is used with a single id)
  • alert_contacts - optional (defines if the alert contacts set for the monitor to be returned. Default is 0)
  • mwindows - optional (the maintenance windows for the monitor which can be mentioned with their IDs like 345-2986-71)
  • timezone - optional (defines if the user's timezone should be returned. Should be set to 1 for getting it. Default is 0)
  • offset - optional (used for pagination. Defines the record to start paginating. Default is 0)
  • limit - optional (used for pagination. Defines the max number of records to return for the response. Default and max. is 50)
  • search - optional (a keyword of your choice to search within url and friendly_name and get filtered results)

The URL for the request would be:

https://api.uptimerobot.com/v2/getMonitors

										curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -H "Cache-Control: no-cache" -d 'api_key=enterYourAPIKeyHere&format=json&logs=1' "https://api.uptimerobot.com/v2/getMonitors"
									
										$curl = curl_init();

										curl_setopt_array($curl, array(
										  CURLOPT_URL => "https://api.uptimerobot.com/v2/getMonitors",
										  CURLOPT_RETURNTRANSFER => true,
										  CURLOPT_ENCODING => "",
										  CURLOPT_MAXREDIRS => 10,
										  CURLOPT_TIMEOUT => 30,
										  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
										  CURLOPT_CUSTOMREQUEST => "POST",
										  CURLOPT_POSTFIELDS => "api_key=enterYourAPIKeyHere&format=json&logs=1",
										  CURLOPT_HTTPHEADER => array(
										    "cache-control: no-cache",
										    "content-type: application/x-www-form-urlencoded"
										  ),
										));

										$response = curl_exec($curl);
										$err = curl_error($curl);

										curl_close($curl);

										if ($err) {
										  echo "cURL Error #:" . $err;
										} else {
										  echo $response;
										}
									
										$request = new HttpRequest();
										$request->setUrl('https://api.uptimerobot.com/v2/getMonitors');
										$request->setMethod(HTTP_METH_POST);

										$request->setHeaders(array(
										  'cache-control' => 'no-cache',
										  'content-type' => 'application/x-www-form-urlencoded'
										));

										$request->setContentType('application/x-www-form-urlencoded');
										$request->setPostFields(array(
										  'api_key' => 'enterYourAPIKeyHere',
										  'format' => 'json',
										  'logs' => '1'
										));

										try {
										  $response = $request->send();

										  echo $response->getBody();
										} catch (HttpException $ex) {
										  echo $ex;
										}
									
										import http.client

										conn = http.client.HTTPSConnection("api.uptimerobot.com")

										payload = "api_key=enterYourAPIKeyHere&format=json&logs=1"

										headers = {
										    'content-type': "application/x-www-form-urlencoded",
										    'cache-control': "no-cache"
										    }

										conn.request("POST", "/v2/getMonitors", payload, headers)

										res = conn.getresponse()
										data = res.read()

										print(data.decode("utf-8"))
									
										import requests

										url = "https://api.uptimerobot.com/v2/getMonitors"

										payload = "api_key=enterYourAPIKeyHere&format=json&logs=1"
										headers = {
										    'content-type': "application/x-www-form-urlencoded",
										    'cache-control': "no-cache"
										    }

										response = requests.request("POST", url, data=payload, headers=headers)

										print(response.text)
									
										var qs = require("querystring");
										var http = require("https");

										var options = {
										  "method": "POST",
										  "hostname": "api.uptimerobot.com",
										  "port": null,
										  "path": "/v2/getMonitors",
										  "headers": {
										    "content-type": "application/x-www-form-urlencoded",
										    "cache-control": "no-cache"
										  }
										};

										var req = http.request(options, function (res) {
										  var chunks = [];

										  res.on("data", function (chunk) {
										    chunks.push(chunk);
										  });

										  res.on("end", function () {
										    var body = Buffer.concat(chunks);
										    console.log(body.toString());
										  });
										});

										req.write(qs.stringify({ api_key: 'enterYourAPIKeyHere', format: 'json', logs: '1' }));
										req.end();
									
										var request = require("request");

										var options = { method: 'POST',
										  url: 'https://api.uptimerobot.com/v2/getMonitors',
										  headers:
										   { 'cache-control': 'no-cache',
										     'content-type': 'application/x-www-form-urlencoded' },
										  form: { api_key: 'enterYourAPIKeyHere', format: 'json', logs: '1' } };

										request(options, function (error, response, body) {
										  if (error) throw new Error(error);

										  console.log(body);
										});
									
										package main

										import (
											"fmt"
											"strings"
											"net/http"
											"io/ioutil"
										)

										func main() {

											url := "https://api.uptimerobot.com/v2/getMonitors"

											payload := strings.NewReader("api_key=enterYourAPIKeyHere&format=json&logs=1")

											req, _ := http.NewRequest("POST", url, payload)

											req.Header.Add("content-type", "application/x-www-form-urlencoded")
											req.Header.Add("cache-control", "no-cache")

											res, _ := http.DefaultClient.Do(req)

											defer res.Body.Close()
											body, _ := ioutil.ReadAll(res.Body)

											fmt.Println(res)
											fmt.Println(string(body))

										}
									
										var client = new RestClient("https://api.uptimerobot.com/v2/getMonitors");
										var request = new RestRequest(Method.POST);
										request.AddHeader("cache-control", "no-cache");
										request.AddHeader("content-type", "application/x-www-form-urlencoded");
										request.AddParameter("application/x-www-form-urlencoded", "api_key=enterYourAPIKeyHere&format=json&logs=1", ParameterType.RequestBody);
										IRestResponse response = client.Execute(request);
									
										require 'uri'
										require 'net/http'

										url = URI("https://api.uptimerobot.com/v2/getMonitors")

										http = Net::HTTP.new(url.host, url.port)
										http.use_ssl = true
										http.verify_mode = OpenSSL::SSL::VERIFY_NONE

										request = Net::HTTP::Post.new(url)
										request["content-type"] = 'application/x-www-form-urlencoded'
										request["cache-control"] = 'no-cache'
										request.body = "api_key=enterYourAPIKeyHere&format=json&logs=1"

										response = http.request(request)
										puts response.read_body
									
										OkHttpClient client = new OkHttpClient();

										MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
										RequestBody body = RequestBody.create(mediaType, "api_key=enterYourAPIKeyHere&format=json&logs=1");
										Request request = new Request.Builder()
										  .url("https://api.uptimerobot.com/v2/getMonitors")
										  .post(body)
										  .addHeader("content-type", "application/x-www-form-urlencoded")
										  .addHeader("cache-control", "no-cache")
										  .build();

										Response response = client.newCall(request).execute();
									

The responses would be:

XML

									
									
									    
									    
									        
									            
									        
									    
									    
									        
									            
									            
									            
									            
									            
									        
									    
									
								

JSON

									{
								  "stat": "ok",
								  "pagination": {
								    "offset": 0,
								    "limit": 50,
								    "total": 2
								  },
								  "monitors": [
								    {
								      "id": 777749809,
								      "friendly_name": "Google",
								      "url": "http://www.google.com",
								      "type": 1,
								      "sub_type": "",
								      "keyword_type": "",
								      "keyword_value": "",
								      "http_username": "",
								      "http_password": "",
								      "port": "",
								      "interval": 900,
								      "status": 1,
											"create_datetime": 1462565497,
								      "monitor_group": 0,
								      "is_group_main": 0,
								      "logs": [
								        {
								          "type": 98,
								          "datetime": 1463540297,
								          "duration": 1054134
								        }
								      ]
								    },
								    {
								      "id": 777712827,
								      "friendly_name": "My Web Page",
								      "url": "http://mywebpage.com/",
								      "type": 1,
								      "sub_type": "",
								      "keyword_type": "",
								      "keyword_value": "",
								      "http_username": "",
								      "http_password": "",
								      "port": "",
								      "interval": 60,
								      "status": 2,
											"create_datetime": 1462465496,
								      "monitor_group": 0,
								      "is_group_main": 0,
								      "logs": [
								        {
								          "type": 98,
								          "datetime": 1462465202,
								          "duration": 32
								        },
								        {
								          "type": 1,
								          "datetime": 1462465234,
								          "duration": 490140
								        },
								        {
								          "type": 2,
								          "datetime": 1462955374,
								          "duration": 85
								        },
								        {
								          "type": 99,
								          "datetime": 1462955588,
								          "duration": 12
								        },
								        {
								          "type": 98,
								          "datetime": 1462955600,
								          "duration": 22
								        }
								      ]
								    }
								  ]
								}
								

POST newMonitor

New monitors of any type can be created using this method.

Parameters
  • api_key - required
  • friendly_name - required
  • url - required
  • type - required
  • sub_type - optional (required for port monitoring)
  • port - optional (required for port monitoring)
  • keyword_type - optional (required for keyword monitoring)
  • keyword_value - optional (required for keyword monitoring)
  • interval - optional (in seconds)
  • http_username - optional
  • http_password - optional
  • alert_contacts - optional (the alert contacts to be notified when the monitor goes up/down.Multiple alert_contact>ids can be sent like alert_contacts=457_0_0-373_5_0-8956_2_3 where alert_contact>ids are seperated with - and threshold + recurrence are seperated with _. For ex: alert_contacts=457_5_0 refers to 457 being the alert_contact>id, 5 being the threshold and 0 being the recurrence. As the threshold and recurrence is only available in the Pro Plan, they are always 0 in the Free Plan)
  • mwindows - optional (the maintenance windows for the monitor which can be mentioned with their IDs like 345-2986-71)

The URL for the request would be:

https://api.uptimerobot.com/v2/newMonitor

										curl -X POST -H "Cache-Control: no-cache" -H "Content-Type: application/x-www-form-urlencoded" -d 'api_key=enterYourAPIKeyHere&format=json&type=1&url=http://myMonitorURL.com&friendly_name=My Monitor' "https://api.uptimerobot.com/v2/newMonitor"								
										$curl = curl_init();

										curl_setopt_array($curl, array(
										  CURLOPT_URL => "https://api.uptimerobot.com/v2/newMonitor",
										  CURLOPT_RETURNTRANSFER => true,
										  CURLOPT_ENCODING => "",
										  CURLOPT_MAXREDIRS => 10,
										  CURLOPT_TIMEOUT => 30,
										  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
										  CURLOPT_CUSTOMREQUEST => "POST",
										  CURLOPT_POSTFIELDS => "api_key=enterYourAPIKeyHere&format=json&type=1&url=http%3A%2F%2FmyMonitorURL.com&friendly_name=My%20Monitor",
										  CURLOPT_HTTPHEADER => array(
										    "cache-control: no-cache",
										    "content-type: application/x-www-form-urlencoded"
										  ),
										));

										$response = curl_exec($curl);
										$err = curl_error($curl);

										curl_close($curl);

										if ($err) {
										  echo "cURL Error #:" . $err;
										} else {
										  echo $response;
										}
									
										$request = new HttpRequest();
										$request->setUrl('https://api.uptimerobot.com/v2/newMonitor');
										$request->setMethod(HTTP_METH_POST);

										$request->setHeaders(array(
										  'content-type' => 'application/x-www-form-urlencoded',
										  'cache-control' => 'no-cache'
										));

										$request->setContentType('application/x-www-form-urlencoded');
										$request->setPostFields(array(
										  'api_key' => 'enterYourAPIKeyHere',
										  'format' => 'json',
										  'type' => '1',
										  'url' => 'http://myMonitorURL.com',
										  'friendly_name' => 'My Monitor'
										));

										try {
										  $response = $request->send();

										  echo $response->getBody();
										} catch (HttpException $ex) {
										  echo $ex;
										}
									
										import http.client

										conn = http.client.HTTPSConnection("api.uptimerobot.com")

										payload = "api_key=enterYourAPIKeyHere&format=json&type=1&url=http%3A%2F%2FmyMonitorURL.com&friendly_name=My%20Monitor"

										headers = {
										    'cache-control': "no-cache",
										    'content-type': "application/x-www-form-urlencoded"
										    }

										conn.request("POST", "/v2/newMonitor", payload, headers)

										res = conn.getresponse()
										data = res.read()

										print(data.decode("utf-8"))
									
										import requests

										url = "https://api.uptimerobot.com/v2/newMonitor"

										payload = "api_key=enterYourAPIKeyHere&format=json&type=1&url=http%3A%2F%2FmyMonitorURL.com&friendly_name=My%20Monitor"
										headers = {
										    'cache-control': "no-cache",
										    'content-type': "application/x-www-form-urlencoded"
										    }

										response = requests.request("POST", url, data=payload, headers=headers)

										print(response.text)
									
										var qs = require("querystring");
										var http = require("https");

										var options = {
										  "method": "POST",
										  "hostname": "api.uptimerobot.com",
										  "port": null,
										  "path": "/v2/newMonitor",
										  "headers": {
										    "cache-control": "no-cache",
										    "content-type": "application/x-www-form-urlencoded"
										  }
										};

										var req = http.request(options, function (res) {
										  var chunks = [];

										  res.on("data", function (chunk) {
										    chunks.push(chunk);
										  });

										  res.on("end", function () {
										    var body = Buffer.concat(chunks);
										    console.log(body.toString());
										  });
										});

										req.write(qs.stringify({ api_key: 'enterYourAPIKeyHere',
										  format: 'json',
										  type: '1',
										  url: 'http://myMonitorURL.com',
										  friendly_name: 'My Monitor' }));
										req.end();
									
										var request = require("request");

										var options = { method: 'POST',
										  url: 'https://api.uptimerobot.com/v2/newMonitor',
										  headers:
										   { 'content-type': 'application/x-www-form-urlencoded',
										     'cache-control': 'no-cache' },
										  form:
										   { api_key: 'enterYourAPIKeyHere',
										     format: 'json',
										     type: '1',
										     url: 'http://myMonitorURL.com',
										     friendly_name: 'My Monitor' } };

										request(options, function (error, response, body) {
										  if (error) throw new Error(error);

										  console.log(body);
										});
									
										package main

										import (
											"fmt"
											"strings"
											"net/http"
											"io/ioutil"
										)

										func main() {

											url := "https://api.uptimerobot.com/v2/newMonitor"

											payload := strings.NewReader("api_key=enterYourAPIKeyHere&format=json&type=1&url=http%3A%2F%2FmyMonitorURL.com&friendly_name=My%20Monitor")

											req, _ := http.NewRequest("POST", url, payload)

											req.Header.Add("cache-control", "no-cache")
											req.Header.Add("content-type", "application/x-www-form-urlencoded")

											res, _ := http.DefaultClient.Do(req)

											defer res.Body.Close()
											body, _ := ioutil.ReadAll(res.Body)

											fmt.Println(res)
											fmt.Println(string(body))

										}
									
										var client = new RestClient("https://api.uptimerobot.com/v2/newMonitor");
										var request = new RestRequest(Method.POST);
										request.AddHeader("content-type", "application/x-www-form-urlencoded");
										request.AddHeader("cache-control", "no-cache");
										request.AddParameter("application/x-www-form-urlencoded", "api_key=enterYourAPIKeyHere&format=json&type=1&url=http%3A%2F%2FmyMonitorURL.com&friendly_name=My%20Monitor", ParameterType.RequestBody);
										IRestResponse response = client.Execute(request);
									
										require 'uri'
										require 'net/http'

										url = URI("https://api.uptimerobot.com/v2/newMonitor")

										http = Net::HTTP.new(url.host, url.port)
										http.use_ssl = true
										http.verify_mode = OpenSSL::SSL::VERIFY_NONE

										request = Net::HTTP::Post.new(url)
										request["cache-control"] = 'no-cache'
										request["content-type"] = 'application/x-www-form-urlencoded'
										request.body = "api_key=enterYourAPIKeyHere&format=json&type=1&url=http%3A%2F%2FmyMonitorURL.com&friendly_name=My%20Monitor"

										response = http.request(request)
										puts response.read_body
									
										OkHttpClient client = new OkHttpClient();

										MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
										RequestBody body = RequestBody.create(mediaType, "api_key=enterYourAPIKeyHere&format=json&type=1&url=http%3A%2F%2FmyMonitorURL.com&friendly_name=My%20Monitor");
										Request request = new Request.Builder()
										  .url("https://api.uptimerobot.com/v2/newMonitor")
										  .post(body)
										  .addHeader("cache-control", "no-cache")
										  .addHeader("content-type", "application/x-www-form-urlencoded")
										  .build();

										Response response = client.newCall(request).execute();
									

The responses would be:

XML

									
								

JSON

									{
									  "stat": "ok",
									  "monitor": {
									    "id": 777810874,
									    "status": 1
									  }
									}
								

POST editMonitor

Monitors can be edited using this method.

Important: The type of a monitor can not be edited (like changing a HTTP monitor into a Port monitor). For such cases, deleting the monitor and re-creating a new one is adviced.

Parameters
  • api_key - required
  • id - required (the ID of the monitor to be edited)
  • friendly_name - optional
  • url - optional
  • sub_type - optional
  • port - optional
  • keyword_type - optional
  • keyword_value - optional
  • interval - optional (in seconds)
  • status - optional (0 for pause, 1 for resume) (in seconds)
  • http_username - optional
  • http_password - optional
  • alert_contacts - optional (the alert contacts to be notified when the monitor goes up/down.Multiple alert_contact>ids can be sent like alert_contacts=457_0_0-373_5_0-8956_2_3 where alert_contact>ids are seperated with - and threshold + recurrence are seperated with _. For ex: alert_contacts=457_5_0 refers to 457 being the alert_contact>id, 0 being the threshold and 0 being the recurrence. As the threshold and recurrence is only available in the Pro Plan, they are always 0 in the Free Plan)
  • mwindows - optional (the maintenance windows for the monitor which can be mentioned with their IDs like 345-2986-71)

The URL for the request would be:

https://api.uptimerobot.com/v2/editMonitor

										curl -X POST -H "Cache-Control: no-cache" -H "Content-Type: application/x-www-form-urlencoded" -d 'api_key=enterYourAPIKeyHere&format=json&id=777712827&friendly_name=newFriendlyName' "https://api.uptimerobot.com/v2/editMonitor"								
										$curl = curl_init();

										curl_setopt_array($curl, array(
										  CURLOPT_URL => "https://api.uptimerobot.com/v2/editMonitor",
										  CURLOPT_RETURNTRANSFER => true,
										  CURLOPT_ENCODING => "",
										  CURLOPT_MAXREDIRS => 10,
										  CURLOPT_TIMEOUT => 30,
										  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
										  CURLOPT_CUSTOMREQUEST => "POST",
										  CURLOPT_POSTFIELDS => "api_key=enterYourAPIKeyHere&format=json&id=777712827&friendly_name=newFriendlyName",
										  CURLOPT_HTTPHEADER => array(
										    "cache-control: no-cache",
										    "content-type: application/x-www-form-urlencoded"
										  ),
										));

										$response = curl_exec($curl);
										$err = curl_error($curl);

										curl_close($curl);

										if ($err) {
										  echo "cURL Error #:" . $err;
										} else {
										  echo $response;
										}
									
										$request = new HttpRequest();
										$request->setUrl('https://api.uptimerobot.com/v2/editMonitor');
										$request->setMethod(HTTP_METH_POST);

										$request->setHeaders(array(
										  'content-type' => 'application/x-www-form-urlencoded',
										  'cache-control' => 'no-cache'
										));

										$request->setContentType('application/x-www-form-urlencoded');
										$request->setPostFields(array(
										  'api_key' => 'enterYourAPIKeyHere',
										  'format' => 'json',
										  'id' => '777712827',
										  'friendly_name' => 'newFriendlyName'
										));

										try {
										  $response = $request->send();

										  echo $response->getBody();
										} catch (HttpException $ex) {
										  echo $ex;
										}
									
										import http.client

										conn = http.client.HTTPSConnection("api.uptimerobot.com")

										payload = "api_key=enterYourAPIKeyHere&format=json&id=777712827&friendly_name=newFriendlyName"

										headers = {
										    'cache-control': "no-cache",
										    'content-type': "application/x-www-form-urlencoded"
										    }

										conn.request("POST", "/v2/editMonitor", payload, headers)

										res = conn.getresponse()
										data = res.read()

										print(data.decode("utf-8"))
									
										import requests

										url = "https://api.uptimerobot.com/v2/editMonitor"

										payload = "api_key=enterYourAPIKeyHere&format=json&id=777712827&friendly_name=newFriendlyName"
										headers = {
										    'cache-control': "no-cache",
										    'content-type': "application/x-www-form-urlencoded"
										    }

										response = requests.request("POST", url, data=payload, headers=headers)

										print(response.text)
									
										var qs = require("querystring");
										var http = require("https");

										var options = {
										  "method": "POST",
										  "hostname": "api.uptimerobot.com",
										  "port": null,
										  "path": "/v2/editMonitor",
										  "headers": {
										    "cache-control": "no-cache",
										    "content-type": "application/x-www-form-urlencoded"
										  }
										};

										var req = http.request(options, function (res) {
										  var chunks = [];

										  res.on("data", function (chunk) {
										    chunks.push(chunk);
										  });

										  res.on("end", function () {
										    var body = Buffer.concat(chunks);
										    console.log(body.toString());
										  });
										});

										req.write(qs.stringify({ api_key: 'enterYourAPIKeyHere',
										  format: 'json',
										  id: '777712827',
										  friendly_name: 'newFriendlyName' }));
										req.end();
									
										var request = require("request");

										var options = { method: 'POST',
										  url: 'https://api.uptimerobot.com/v2/editMonitor',
										  headers:
										   { 'content-type': 'application/x-www-form-urlencoded',
										     'cache-control': 'no-cache' },
										  form:
										   { api_key: 'enterYourAPIKeyHere',
										     format: 'json',
										     id: '777712827',
										     friendly_name: 'newFriendlyName' } };

										request(options, function (error, response, body) {
										  if (error) throw new Error(error);

										  console.log(body);
										});
									
										package main

										import (
											"fmt"
											"strings"
											"net/http"
											"io/ioutil"
										)

										func main() {

											url := "https://api.uptimerobot.com/v2/editMonitor"

											payload := strings.NewReader("api_key=enterYourAPIKeyHere&format=json&id=777712827&friendly_name=newFriendlyName")

											req, _ := http.NewRequest("POST", url, payload)

											req.Header.Add("cache-control", "no-cache")
											req.Header.Add("content-type", "application/x-www-form-urlencoded")

											res, _ := http.DefaultClient.Do(req)

											defer res.Body.Close()
											body, _ := ioutil.ReadAll(res.Body)

											fmt.Println(res)
											fmt.Println(string(body))

										}
									
										var client = new RestClient("https://api.uptimerobot.com/v2/editMonitor");
										var request = new RestRequest(Method.POST);
										request.AddHeader("content-type", "application/x-www-form-urlencoded");
										request.AddHeader("cache-control", "no-cache");
										request.AddParameter("application/x-www-form-urlencoded", "api_key=enterYourAPIKeyHere&format=json&id=777712827&friendly_name=newFriendlyName", ParameterType.RequestBody);
										IRestResponse response = client.Execute(request);
									
										require 'uri'
										require 'net/http'

										url = URI("https://api.uptimerobot.com/v2/editMonitor")

										http = Net::HTTP.new(url.host, url.port)
										http.use_ssl = true
										http.verify_mode = OpenSSL::SSL::VERIFY_NONE

										request = Net::HTTP::Post.new(url)
										request["cache-control"] = 'no-cache'
										request["content-type"] = 'application/x-www-form-urlencoded'
										request.body = "api_key=enterYourAPIKeyHere&format=json&id=777712827&friendly_name=newFriendlyName"

										response = http.request(request)
										puts response.read_body
									
										OkHttpClient client = new OkHttpClient();

										MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
										RequestBody body = RequestBody.create(mediaType, "api_key=enterYourAPIKeyHere&format=json&id=777712827&friendly_name=newFriendlyName");
										Request request = new Request.Builder()
										  .url("https://api.uptimerobot.com/v2/editMonitor")
										  .post(body)
										  .addHeader("cache-control", "no-cache")
										  .addHeader("content-type", "application/x-www-form-urlencoded")
										  .build();

										Response response = client.newCall(request).execute();
									

The responses would be:

XML

									
								

JSON

									{"stat":"ok","monitor":{"id":777712827}}
								

POST deleteMonitor

Monitors can be deleted using this method.

Parameters:
  • api_key - required
  • id - required (the ID of the monitor to be deleted)

The URL for the request would be:

https://api.uptimerobot.com/v2/deleteMonitor

										curl -X POST -H "Cache-Control: no-cache" -H "Content-Type: application/x-www-form-urlencoded" -d 'api_key=enterYourAPIKeyHere&format=json&id=777712827' "https://api.uptimerobot.com/v2/deleteMonitor"							
										$curl = curl_init();

										curl_setopt_array($curl, array(
										  CURLOPT_URL => "https://api.uptimerobot.com/v2/deleteMonitor",
										  CURLOPT_RETURNTRANSFER => true,
										  CURLOPT_ENCODING => "",
										  CURLOPT_MAXREDIRS => 10,
										  CURLOPT_TIMEOUT => 30,
										  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
										  CURLOPT_CUSTOMREQUEST => "POST",
										  CURLOPT_POSTFIELDS => "api_key=enterYourAPIKeyHere&format=json&id=777712827",
										  CURLOPT_HTTPHEADER => array(
										    "cache-control: no-cache",
										    "content-type: application/x-www-form-urlencoded"
										  ),
										));

										$response = curl_exec($curl);
										$err = curl_error($curl);

										curl_close($curl);

										if ($err) {
										  echo "cURL Error #:" . $err;
										} else {
										  echo $response;
										}
									
										$request = new HttpRequest();
										$request->setUrl('https://api.uptimerobot.com/v2/deleteMonitor');
										$request->setMethod(HTTP_METH_POST);

										$request->setHeaders(array(
										  'content-type' => 'application/x-www-form-urlencoded',
										  'cache-control' => 'no-cache'
										));

										$request->setContentType('application/x-www-form-urlencoded');
										$request->setPostFields(array(
										  'api_key' => 'enterYourAPIKeyHere',
										  'format' => 'json',
										  'id' => '777712827'
										));

										try {
										  $response = $request->send();

										  echo $response->getBody();
										} catch (HttpException $ex) {
										  echo $ex;
										}
									
										import http.client

										conn = http.client.HTTPSConnection("api.uptimerobot.com")

										payload = "api_key=enterYourAPIKeyHere&format=json&id=777712827"

										headers = {
										    'cache-control': "no-cache",
										    'content-type': "application/x-www-form-urlencoded"
										    }

										conn.request("POST", "/v2/deleteMonitor", payload, headers)

										res = conn.getresponse()
										data = res.read()

										print(data.decode("utf-8"))
									
										import requests

										url = "https://api.uptimerobot.com/v2/deleteMonitor"

										payload = "api_key=enterYourAPIKeyHere&format=json&id=777712827"
										headers = {
										    'cache-control': "no-cache",
										    'content-type': "application/x-www-form-urlencoded"
										    }

										response = requests.request("POST", url, data=payload, headers=headers)

										print(response.text)
									
										var qs = require("querystring");
										var http = require("https");

										var options = {
										  "method": "POST",
										  "hostname": "api.uptimerobot.com",
										  "port": null,
										  "path": "/v2/deleteMonitor",
										  "headers": {
										    "cache-control": "no-cache",
										    "content-type": "application/x-www-form-urlencoded"
										  }
										};

										var req = http.request(options, function (res) {
										  var chunks = [];

										  res.on("data", function (chunk) {
										    chunks.push(chunk);
										  });

										  res.on("end", function () {
										    var body = Buffer.concat(chunks);
										    console.log(body.toString());
										  });
										});

										req.write(qs.stringify({ api_key: 'enterYourAPIKeyHere',
										  format: 'json',
										  id: '777712827' }));
										req.end();
									
										var request = require("request");

										var options = { method: 'POST',
										  url: 'https://api.uptimerobot.com/v2/deleteMonitor',
										  headers:
										   { 'content-type': 'application/x-www-form-urlencoded',
										     'cache-control': 'no-cache' },
										  form:
										   { api_key: 'enterYourAPIKeyHere',
										     format: 'json',
										     id: '777712827' } };

										request(options, function (error, response, body) {
										  if (error) throw new Error(error);

										  console.log(body);
										});
									
										package main

										import (
											"fmt"
											"strings"
											"net/http"
											"io/ioutil"
										)

										func main() {

											url := "https://api.uptimerobot.com/v2/deleteMonitor"

											payload := strings.NewReader("api_key=enterYourAPIKeyHere&format=json&id=777712827")

											req, _ := http.NewRequest("POST", url, payload)

											req.Header.Add("cache-control", "no-cache")
											req.Header.Add("content-type", "application/x-www-form-urlencoded")

											res, _ := http.DefaultClient.Do(req)

											defer res.Body.Close()
											body, _ := ioutil.ReadAll(res.Body)

											fmt.Println(res)
											fmt.Println(string(body))

										}
									
										var client = new RestClient("https://api.uptimerobot.com/v2/deleteMonitor");
										var request = new RestRequest(Method.POST);
										request.AddHeader("content-type", "application/x-www-form-urlencoded");
										request.AddHeader("cache-control", "no-cache");
										request.AddParameter("application/x-www-form-urlencoded", "api_key=enterYourAPIKeyHere&format=json&id=777712827", ParameterType.RequestBody);
										IRestResponse response = client.Execute(request);
									
										require 'uri'
										require 'net/http'

										url = URI("https://api.uptimerobot.com/v2/deleteMonitor")

										http = Net::HTTP.new(url.host, url.port)
										http.use_ssl = true
										http.verify_mode = OpenSSL::SSL::VERIFY_NONE

										request = Net::HTTP::Post.new(url)
										request["cache-control"] = 'no-cache'
										request["content-type"] = 'application/x-www-form-urlencoded'
										request.body = "api_key=enterYourAPIKeyHere&format=json&id=777712827"

										response = http.request(request)
										puts response.read_body
									
										OkHttpClient client = new OkHttpClient();

										MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
										RequestBody body = RequestBody.create(mediaType, "api_key=enterYourAPIKeyHere&format=json&id=777712827");
										Request request = new Request.Builder()
										  .url("https://api.uptimerobot.com/v2/deleteMonitor")
										  .post(body)
										  .addHeader("cache-control", "no-cache")
										  .addHeader("content-type", "application/x-www-form-urlencoded")
										  .build();

										Response response = client.newCall(request).execute();
									

The responses would be:

XML

									
								

JSON

									{"stat":"ok","monitor":{"id":777712827}}
								

POST resetMonitor

Monitors can be reset (deleting all stats and response time data) using this method.

Parameters:
  • api_key - required
  • id - required (the ID of the monitor to be reset)

The URL for the request would be:

https://api.uptimerobot.com/v2/resetMonitor

										curl -X POST -H "Cache-Control: no-cache" -H "Content-Type: application/x-www-form-urlencoded" -d 'api_key=enterYourAPIKeyHere&format=json&id=777712827' "https://api.uptimerobot.com/v2/resetMonitor"							
										$curl = curl_init();

										curl_setopt_array($curl, array(
											CURLOPT_URL => "https://api.uptimerobot.com/v2/resetMonitor",
											CURLOPT_RETURNTRANSFER => true,
											CURLOPT_ENCODING => "",
											CURLOPT_MAXREDIRS => 10,
											CURLOPT_TIMEOUT => 30,
											CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
											CURLOPT_CUSTOMREQUEST => "POST",
											CURLOPT_POSTFIELDS => "api_key=enterYourAPIKeyHere&format=json&id=777712827",
											CURLOPT_HTTPHEADER => array(
												"cache-control: no-cache",
												"content-type: application/x-www-form-urlencoded"
											),
										));

										$response = curl_exec($curl);
										$err = curl_error($curl);

										curl_close($curl);

										if ($err) {
											echo "cURL Error #:" . $err;
										} else {
											echo $response;
										}
									
										$request = new HttpRequest();
										$request->setUrl('https://api.uptimerobot.com/v2/resetMonitor');
										$request->setMethod(HTTP_METH_POST);

										$request->setHeaders(array(
											'content-type' => 'application/x-www-form-urlencoded',
											'cache-control' => 'no-cache'
										));

										$request->setContentType('application/x-www-form-urlencoded');
										$request->setPostFields(array(
											'api_key' => 'enterYourAPIKeyHere',
											'format' => 'json',
											'id' => '777712827'
										));

										try {
											$response = $request->send();

											echo $response->getBody();
										} catch (HttpException $ex) {
											echo $ex;
										}
									
										import http.client

										conn = http.client.HTTPSConnection("api.uptimerobot.com")

										payload = "api_key=enterYourAPIKeyHere&format=json&id=777712827"

										headers = {
												'cache-control': "no-cache",
												'content-type': "application/x-www-form-urlencoded"
												}

										conn.request("POST", "/v2/resetMonitor", payload, headers)

										res = conn.getresponse()
										data = res.read()

										print(data.decode("utf-8"))
									
										import requests

										url = "https://api.uptimerobot.com/v2/resetMonitor"

										payload = "api_key=enterYourAPIKeyHere&format=json&id=777712827"
										headers = {
												'cache-control': "no-cache",
												'content-type': "application/x-www-form-urlencoded"
												}

										response = requests.request("POST", url, data=payload, headers=headers)

										print(response.text)
									
										var qs = require("querystring");
										var http = require("https");

										var options = {
											"method": "POST",
											"hostname": "api.uptimerobot.com",
											"port": null,
											"path": "/v2/resetMonitor",
											"headers": {
												"cache-control": "no-cache",
												"content-type": "application/x-www-form-urlencoded"
											}
										};

										var req = http.request(options, function (res) {
											var chunks = [];

											res.on("data", function (chunk) {
												chunks.push(chunk);
											});

											res.on("end", function () {
												var body = Buffer.concat(chunks);
												console.log(body.toString());
											});
										});

										req.write(qs.stringify({ api_key: 'enterYourAPIKeyHere',
											format: 'json',
											id: '777712827' }));
										req.end();
									
										var request = require("request");

										var options = { method: 'POST',
											url: 'https://api.uptimerobot.com/v2/resetMonitor',
											headers:
											 { 'content-type': 'application/x-www-form-urlencoded',
												 'cache-control': 'no-cache' },
											form:
											 { api_key: 'enterYourAPIKeyHere',
												 format: 'json',
												 id: '777712827' } };

										request(options, function (error, response, body) {
											if (error) throw new Error(error);

											console.log(body);
										});
									
										package main

										import (
											"fmt"
											"strings"
											"net/http"
											"io/ioutil"
										)

										func main() {

											url := "https://api.uptimerobot.com/v2/resetMonitor"

											payload := strings.NewReader("api_key=enterYourAPIKeyHere&format=json&id=777712827")

											req, _ := http.NewRequest("POST", url, payload)

											req.Header.Add("cache-control", "no-cache")
											req.Header.Add("content-type", "application/x-www-form-urlencoded")

											res, _ := http.DefaultClient.Do(req)

											defer res.Body.Close()
											body, _ := ioutil.ReadAll(res.Body)

											fmt.Println(res)
											fmt.Println(string(body))

										}
									
										var client = new RestClient("https://api.uptimerobot.com/v2/resetMonitor");
										var request = new RestRequest(Method.POST);
										request.AddHeader("content-type", "application/x-www-form-urlencoded");
										request.AddHeader("cache-control", "no-cache");
										request.AddParameter("application/x-www-form-urlencoded", "api_key=enterYourAPIKeyHere&format=json&id=777712827", ParameterType.RequestBody);
										IRestResponse response = client.Execute(request);
									
										require 'uri'
										require 'net/http'

										url = URI("https://api.uptimerobot.com/v2/resetMonitor")

										http = Net::HTTP.new(url.host, url.port)
										http.use_ssl = true
										http.verify_mode = OpenSSL::SSL::VERIFY_NONE

										request = Net::HTTP::Post.new(url)
										request["cache-control"] = 'no-cache'
										request["content-type"] = 'application/x-www-form-urlencoded'
										request.body = "api_key=enterYourAPIKeyHere&format=json&id=777712827"

										response = http.request(request)
										puts response.read_body
									
										OkHttpClient client = new OkHttpClient();

										MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
										RequestBody body = RequestBody.create(mediaType, "api_key=enterYourAPIKeyHere&format=json&id=777712827");
										Request request = new Request.Builder()
											.url("https://api.uptimerobot.com/v2/resetMonitor")
											.post(body)
											.addHeader("cache-control", "no-cache")
											.addHeader("content-type", "application/x-www-form-urlencoded")
											.build();

										Response response = client.newCall(request).execute();
									

The responses would be:

XML

									
								

JSON

									{"stat":"ok","monitor":{"id":777712827}}
								

POST getAlertContacts

The list of alert contacts can be called with this method.

Parameters
  • api_key - required
  • alert_contacts - optional (if not used, will return all alert contacts in an account. Else, it is possible to define any number of alert contacts with their IDs like: alert_contacts=236-1782-4790)
  • offset - optional (used for pagination. Defines the record to start paginating. Default is 0)
  • limit - optional (used for pagination. Defines the max number of records to return for the response. Default and max. is 50)

The URL for the request would be:

https://api.uptimerobot.com/v2/getAlertContacts

										curl -X POST -H "Cache-Control: no-cache" -H "Content-Type: application/x-www-form-urlencoded" -d 'api_key=enterYourAPIKeyHere&format=json' "https://api.uptimerobot.com/v2/getAlertContacts"
									
										$curl = curl_init();

										curl_setopt_array($curl, array(
											CURLOPT_URL => "https://api.uptimerobot.com/v2/getAlertContacts",
											CURLOPT_RETURNTRANSFER => true,
											CURLOPT_ENCODING => "",
											CURLOPT_MAXREDIRS => 10,
											CURLOPT_TIMEOUT => 30,
											CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
											CURLOPT_CUSTOMREQUEST => "POST",
											CURLOPT_POSTFIELDS => "api_key=enterYourAPIKeyHere&format=json",
											CURLOPT_HTTPHEADER => array(
												"cache-control: no-cache",
												"content-type: application/x-www-form-urlencoded"
											),
										));

										$response = curl_exec($curl);
										$err = curl_error($curl);

										curl_close($curl);

										if ($err) {
											echo "cURL Error #:" . $err;
										} else {
											echo $response;
										}
									
										$request = new HttpRequest();
										$request->setUrl('https://api.uptimerobot.com/v2/getAlertContacts');
										$request->setMethod(HTTP_METH_POST);

										$request->setHeaders(array(
										  'content-type' => 'application/x-www-form-urlencoded',
										  'cache-control' => 'no-cache'
										));

										$request->setContentType('application/x-www-form-urlencoded');
										$request->setPostFields(array(
										  'api_key' => 'enterYourAPIKeyHere',
										  'format' => 'json'
										));

										try {
										  $response = $request->send();

										  echo $response->getBody();
										} catch (HttpException $ex) {
										  echo $ex;
										}
									
										import http.client

										conn = http.client.HTTPSConnection("api.uptimerobot.com")

										payload = "api_key=enterYourAPIKeyHere&format=json"

										headers = {
										    'cache-control': "no-cache",
										    'content-type': "application/x-www-form-urlencoded"
										    }

										conn.request("POST", "/v2/getAlertContacts", payload, headers)

										res = conn.getresponse()
										data = res.read()

										print(data.decode("utf-8"))
									
										import requests

										url = "https://api.uptimerobot.com/v2/getAlertContacts"

										payload = "api_key=enterYourAPIKeyHere&format=json"
										headers = {
										    'cache-control': "no-cache",
										    'content-type': "application/x-www-form-urlencoded"
										    }

										response = requests.request("POST", url, data=payload, headers=headers)

										print(response.text)
									
										var qs = require("querystring");
										var http = require("https");

										var options = {
										  "method": "POST",
										  "hostname": "api.uptimerobot.com",
										  "port": null,
										  "path": "/v2/getAlertContacts",
										  "headers": {
										    "cache-control": "no-cache",
										    "content-type": "application/x-www-form-urlencoded"
										  }
										};

										var req = http.request(options, function (res) {
										  var chunks = [];

										  res.on("data", function (chunk) {
										    chunks.push(chunk);
										  });

										  res.on("end", function () {
										    var body = Buffer.concat(chunks);
										    console.log(body.toString());
										  });
										});

										req.write(qs.stringify({ api_key: 'enterYourAPIKeyHere', format: 'json' }));
										req.end();
									
										var request = require("request");

										var options = { method: 'POST',
										  url: 'https://api.uptimerobot.com/v2/getAlertContacts',
										  headers:
										   { 'content-type': 'application/x-www-form-urlencoded',
										     'cache-control': 'no-cache' },
										  form: { api_key: 'enterYourAPIKeyHere', format: 'json' } };

										request(options, function (error, response, body) {
										  if (error) throw new Error(error);

										  console.log(body);
										});
									
										package main

										import (
											"fmt"
											"strings"
											"net/http"
											"io/ioutil"
										)

										func main() {

											url := "https://api.uptimerobot.com/v2/getAlertContacts"

											payload := strings.NewReader("api_key=enterYourAPIKeyHere&format=json")

											req, _ := http.NewRequest("POST", url, payload)

											req.Header.Add("cache-control", "no-cache")
											req.Header.Add("content-type", "application/x-www-form-urlencoded")

											res, _ := http.DefaultClient.Do(req)

											defer res.Body.Close()
											body, _ := ioutil.ReadAll(res.Body)

											fmt.Println(res)
											fmt.Println(string(body))

										}
									
										var client = new RestClient("https://api.uptimerobot.com/v2/getAlertContacts");
										var request = new RestRequest(Method.POST);
										request.AddHeader("content-type", "application/x-www-form-urlencoded");
										request.AddHeader("cache-control", "no-cache");
										request.AddParameter("application/x-www-form-urlencoded", "api_key=enterYourAPIKeyHere&format=json", ParameterType.RequestBody);
										IRestResponse response = client.Execute(request);
									
										require 'uri'
										require 'net/http'

										url = URI("https://api.uptimerobot.com/v2/getAlertContacts")

										http = Net::HTTP.new(url.host, url.port)
										http.use_ssl = true
										http.verify_mode = OpenSSL::SSL::VERIFY_NONE

										request = Net::HTTP::Post.new(url)
										request["cache-control"] = 'no-cache'
										request["content-type"] = 'application/x-www-form-urlencoded'
										request.body = "api_key=enterYourAPIKeyHere&format=json"

										response = http.request(request)
										puts response.read_body
									
										OkHttpClient client = new OkHttpClient();

										MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
										RequestBody body = RequestBody.create(mediaType, "api_key=enterYourAPIKeyHere&format=json");
										Request request = new Request.Builder()
										  .url("https://api.uptimerobot.com/v2/getAlertContacts")
										  .post(body)
										  .addHeader("cache-control", "no-cache")
										  .addHeader("content-type", "application/x-www-form-urlencoded")
										  .build();

										Response response = client.newCall(request).execute();
									

The responses would be:

XML

									
									
									    
									    
									
								

JSON

									{
									  "stat": "ok",
									  "limit": 50,
									  "offset": 0,
									  "total": 2,
									  "alert_contacts": [
									    {
									      "id": "0993765",
									      "friendly_name": "John Doe",
									      "type": 2,
									      "status": 1,
									      "value": "johndoe@gmail.com"
									    },
									    {
									      "id": "2403924",
									      "friendly_name": "My Twitter",
									      "type": 3,
									      "status": 0,
									      "value": "sampleTwitterAccount"
									    }
									  ]
									}
								

POST newAlertContact

New alert contacts of any type (mobile/SMS alert contacts are not supported yet) can be created using this method.

The alert contacts created using the API are validated with the same way as they were created from uptimerobot.com (activation link for e-mails, etc.).

Parameters:
  • api_key - required
  • type - required
  • value - required
  • friendly_name - optional

The URL for the request would be:

https://api.uptimerobot.com/v2/newAlertContact

										curl -X POST -H "Cache-Control: no-cache" -H "Content-Type: application/x-www-form-urlencoded" -d 'api_key=enterYourAPIKeyHere&format=json&type=1&friendly_name=My Alert Contact&value=test@mydomain.com' "https://api.uptimerobot.com/v2/newAlertContact"
									
										$curl = curl_init();

										curl_setopt_array($curl, array(
										  CURLOPT_URL => "https://api.uptimerobot.com/v2/newAlertContact",
										  CURLOPT_RETURNTRANSFER => true,
										  CURLOPT_ENCODING => "",
										  CURLOPT_MAXREDIRS => 10,
										  CURLOPT_TIMEOUT => 30,
										  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
										  CURLOPT_CUSTOMREQUEST => "POST",
										  CURLOPT_POSTFIELDS => "api_key=enterYourAPIKeyHere&format=json&type=1&friendly_name=My%20Alert%20Contact&value=test%40mydomain.com",
										  CURLOPT_HTTPHEADER => array(
										    "cache-control: no-cache",
										    "content-type: application/x-www-form-urlencoded"
										  ),
										));

										$response = curl_exec($curl);
										$err = curl_error($curl);

										curl_close($curl);

										if ($err) {
										  echo "cURL Error #:" . $err;
										} else {
										  echo $response;
										}
									
										$request = new HttpRequest();
										$request->setUrl('https://api.uptimerobot.com/v2/newAlertContact');
										$request->setMethod(HTTP_METH_POST);

										$request->setHeaders(array(
										  'content-type' => 'application/x-www-form-urlencoded',
										  'cache-control' => 'no-cache'
										));

										$request->setContentType('application/x-www-form-urlencoded');
										$request->setPostFields(array(
										  'api_key' => 'enterYourAPIKeyHere',
										  'format' => 'json',
										  'type' => '1',
										  'friendly_name' => 'My Alert Contact',
										  'value' => 'test@mydomain.com'
										));

										try {
										  $response = $request->send();

										  echo $response->getBody();
										} catch (HttpException $ex) {
										  echo $ex;
										}
									
										import http.client

										conn = http.client.HTTPSConnection("api.uptimerobot.com")

										payload = "api_key=enterYourAPIKeyHere&format=json&type=1&friendly_name=My%20Alert%20Contact&value=test%40mydomain.com"

										headers = {
										    'cache-control': "no-cache",
										    'content-type': "application/x-www-form-urlencoded"
										    }

										conn.request("POST", "/v2/newAlertContact", payload, headers)

										res = conn.getresponse()
										data = res.read()

										print(data.decode("utf-8"))
									
										import requests

										url = "https://api.uptimerobot.com/v2/newAlertContact"

										payload = "api_key=enterYourAPIKeyHere&format=json&type=1&friendly_name=My%20Alert%20Contact&value=test%40mydomain.com"
										headers = {
										    'cache-control': "no-cache",
										    'content-type': "application/x-www-form-urlencoded"
										    }

										response = requests.request("POST", url, data=payload, headers=headers)

										print(response.text)
									
										var qs = require("querystring");
										var http = require("https");

										var options = {
										  "method": "POST",
										  "hostname": "api.uptimerobot.com",
										  "port": null,
										  "path": "/v2/newAlertContact",
										  "headers": {
										    "cache-control": "no-cache",
										    "content-type": "application/x-www-form-urlencoded"
										  }
										};

										var req = http.request(options, function (res) {
										  var chunks = [];

										  res.on("data", function (chunk) {
										    chunks.push(chunk);
										  });

										  res.on("end", function () {
										    var body = Buffer.concat(chunks);
										    console.log(body.toString());
										  });
										});

										req.write(qs.stringify({ api_key: 'enterYourAPIKeyHere',
										  format: 'json',
										  type: '1',
										  friendly_name: 'My Alert Contact',
										  value: 'test@mydomain.com' }));
										req.end();
									
										var request = require("request");

										var options = { method: 'POST',
										  url: 'https://api.uptimerobot.com/v2/newAlertContact',
										  headers:
										   { 'content-type': 'application/x-www-form-urlencoded',
										     'cache-control': 'no-cache' },
										  form:
										   { api_key: 'enterYourAPIKeyHere',
										     format: 'json',
										     type: '1',
										     friendly_name: 'My Alert Contact',
										     value: 'test@mydomain.com' } };

										request(options, function (error, response, body) {
										  if (error) throw new Error(error);

										  console.log(body);
										});
									
										package main

										import (
											"fmt"
											"strings"
											"net/http"
											"io/ioutil"
										)

										func main() {

											url := "https://api.uptimerobot.com/v2/newAlertContact"

											payload := strings.NewReader("api_key=enterYourAPIKeyHere&format=json&type=1&friendly_name=My%20Alert%20Contact&value=test%40mydomain.com")

											req, _ := http.NewRequest("POST", url, payload)

											req.Header.Add("cache-control", "no-cache")
											req.Header.Add("content-type", "application/x-www-form-urlencoded")

											res, _ := http.DefaultClient.Do(req)

											defer res.Body.Close()
											body, _ := ioutil.ReadAll(res.Body)

											fmt.Println(res)
											fmt.Println(string(body))

										}
									
										var client = new RestClient("https://api.uptimerobot.com/v2/newAlertContact");
										var request = new RestRequest(Method.POST);
										request.AddHeader("content-type", "application/x-www-form-urlencoded");
										request.AddHeader("cache-control", "no-cache");
										request.AddParameter("application/x-www-form-urlencoded", "api_key=enterYourAPIKeyHere&format=json&type=1&friendly_name=My%20Alert%20Contact&value=test%40mydomain.com", ParameterType.RequestBody);
										IRestResponse response = client.Execute(request);
									
										require 'uri'
										require 'net/http'

										url = URI("https://api.uptimerobot.com/v2/newAlertContact")

										http = Net::HTTP.new(url.host, url.port)
										http.use_ssl = true
										http.verify_mode = OpenSSL::SSL::VERIFY_NONE

										request = Net::HTTP::Post.new(url)
										request["cache-control"] = 'no-cache'
										request["content-type"] = 'application/x-www-form-urlencoded'
										request.body = "api_key=enterYourAPIKeyHere&format=json&type=1&friendly_name=My%20Alert%20Contact&value=test%40mydomain.com"

										response = http.request(request)
										puts response.read_body
									
										OkHttpClient client = new OkHttpClient();

										MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
										RequestBody body = RequestBody.create(mediaType, "api_key=enterYourAPIKeyHere&format=json&type=1&friendly_name=My%20Alert%20Contact&value=test%40mydomain.com");
										Request request = new Request.Builder()
										  .url("https://api.uptimerobot.com/v2/newAlertContact")
										  .post(body)
										  .addHeader("cache-control", "no-cache")
										  .addHeader("content-type", "application/x-www-form-urlencoded")
										  .build();

										Response response = client.newCall(request).execute();
									

The responses would be:

XML

									
								

JSON

A sample request which gets all the data about alert contacts with specified IDs:

https://api.uptimerobot.com/newAlertContact?api_key=u956-afus321g565fghr519&alertContactType=2&alertContactValue=uptime@domain.com&format=json

The response would be:
									jsonUptimeRobotApi({
										"stat": "ok",
										"alertcontact": {
											"id": "4561",
											"status": "0"
										}
									})
								

POST editAlertContact

Alert contacts can be edited using this method.

Parameters:
  • api_key - required
  • id - required
  • friendly_name - optional
  • value - optional (can only be used if it is a web-hook alert contact)

The URL for the request would be:

https://api.uptimerobot.com/v2/editAlertContact

											curl -X POST -H "Cache-Control: no-cache" -H "Content-Type: application/x-www-form-urlencoded" -d 'api_key=enterYourAPIKeyHere&format=json&friendly_name=New Name For Alert Contact&id=236&=' "https://api.uptimerobot.com/v2/editAlertContact"
										
											$curl = curl_init();

											curl_setopt_array($curl, array(
											  CURLOPT_URL => "https://api.uptimerobot.com/v2/editAlertContact",
											  CURLOPT_RETURNTRANSFER => true,
											  CURLOPT_ENCODING => "",
											  CURLOPT_MAXREDIRS => 10,
											  CURLOPT_TIMEOUT => 30,
											  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
											  CURLOPT_CUSTOMREQUEST => "POST",
											  CURLOPT_POSTFIELDS => "api_key=enterYourAPIKeyHere&format=json&friendly_name=New%20Name%20For%20Alert%20Contact&id=236&=",
											  CURLOPT_HTTPHEADER => array(
											    "cache-control: no-cache",
											    "content-type: application/x-www-form-urlencoded"
											  ),
											));

											$response = curl_exec($curl);
											$err = curl_error($curl);

											curl_close($curl);

											if ($err) {
											  echo "cURL Error #:" . $err;
											} else {
											  echo $response;
											}
										
											$request = new HttpRequest();
											$request->setUrl('https://api.uptimerobot.com/v2/editAlertContact');
											$request->setMethod(HTTP_METH_POST);

											$request->setHeaders(array(
											  'content-type' => 'application/x-www-form-urlencoded',
											  'cache-control' => 'no-cache'
											));

											$request->setContentType('application/x-www-form-urlencoded');
											$request->setPostFields(array(
											  'api_key' => 'enterYourAPIKeyHere',
											  'format' => 'json',
											  'friendly_name' => 'New Name For Alert Contact',
											  'id' => '236',
											  '' => ''
											));

											try {
											  $response = $request->send();

											  echo $response->getBody();
											} catch (HttpException $ex) {
											  echo $ex;
											}
										
											import http.client

											conn = http.client.HTTPSConnection("api.uptimerobot.com")

											payload = "api_key=enterYourAPIKeyHere&format=json&friendly_name=New%20Name%20For%20Alert%20Contact&id=236&="

											headers = {
											    'cache-control': "no-cache",
											    'content-type': "application/x-www-form-urlencoded"
											    }

											conn.request("POST", "/v2/editAlertContact", payload, headers)

											res = conn.getresponse()
											data = res.read()

											print(data.decode("utf-8"))
										
											import requests

											url = "https://api.uptimerobot.com/v2/editAlertContact"

											payload = "api_key=enterYourAPIKeyHere&format=json&friendly_name=New%20Name%20For%20Alert%20Contact&id=236&="
											headers = {
											    'cache-control': "no-cache",
											    'content-type': "application/x-www-form-urlencoded"
											    }

											response = requests.request("POST", url, data=payload, headers=headers)

											print(response.text)
										
											var qs = require("querystring");
											var http = require("https");

											var options = {
											  "method": "POST",
											  "hostname": "api.uptimerobot.com",
											  "port": null,
											  "path": "/v2/editAlertContact",
											  "headers": {
											    "cache-control": "no-cache",
											    "content-type": "application/x-www-form-urlencoded"
											  }
											};

											var req = http.request(options, function (res) {
											  var chunks = [];

											  res.on("data", function (chunk) {
											    chunks.push(chunk);
											  });

											  res.on("end", function () {
											    var body = Buffer.concat(chunks);
											    console.log(body.toString());
											  });
											});

											req.write(qs.stringify({ api_key: 'enterYourAPIKeyHere',
											  format: 'json',
											  friendly_name: 'New Name For Alert Contact',
											  id: '236',
											  '': '' }));
											req.end();
										
											var request = require("request");

											var options = { method: 'POST',
											  url: 'https://api.uptimerobot.com/v2/editAlertContact',
											  headers:
											   { 'content-type': 'application/x-www-form-urlencoded',
											     'cache-control': 'no-cache' },
											  form:
											   { api_key: 'enterYourAPIKeyHere',
											     format: 'json',
											     friendly_name: 'New Name For Alert Contact',
											     id: '236',
											     '': '' } };

											request(options, function (error, response, body) {
											  if (error) throw new Error(error);

											  console.log(body);
											});
										
											package main

											import (
												"fmt"
												"strings"
												"net/http"
												"io/ioutil"
											)

											func main() {

												url := "https://api.uptimerobot.com/v2/editAlertContact"

												payload := strings.NewReader("api_key=enterYourAPIKeyHere&format=json&friendly_name=New%20Name%20For%20Alert%20Contact&id=236&=")

												req, _ := http.NewRequest("POST", url, payload)

												req.Header.Add("cache-control", "no-cache")
												req.Header.Add("content-type", "application/x-www-form-urlencoded")

												res, _ := http.DefaultClient.Do(req)

												defer res.Body.Close()
												body, _ := ioutil.ReadAll(res.Body)

												fmt.Println(res)
												fmt.Println(string(body))

											}
										
											var client = new RestClient("https://api.uptimerobot.com/v2/editAlertContact");
											var request = new RestRequest(Method.POST);
											request.AddHeader("content-type", "application/x-www-form-urlencoded");
											request.AddHeader("cache-control", "no-cache");
											request.AddParameter("application/x-www-form-urlencoded", "api_key=enterYourAPIKeyHere&format=json&friendly_name=New%20Name%20For%20Alert%20Contact&id=236&=", ParameterType.RequestBody);
											IRestResponse response = client.Execute(request);
										
											require 'uri'
											require 'net/http'

											url = URI("https://api.uptimerobot.com/v2/editAlertContact")

											http = Net::HTTP.new(url.host, url.port)
											http.use_ssl = true
											http.verify_mode = OpenSSL::SSL::VERIFY_NONE

											request = Net::HTTP::Post.new(url)
											request["cache-control"] = 'no-cache'
											request["content-type"] = 'application/x-www-form-urlencoded'
											request.body = "api_key=enterYourAPIKeyHere&format=json&friendly_name=New%20Name%20For%20Alert%20Contact&id=236&="

											response = http.request(request)
											puts response.read_body
										
											OkHttpClient client = new OkHttpClient();

											MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
											RequestBody body = RequestBody.create(mediaType, "api_key=enterYourAPIKeyHere&format=json&friendly_name=New%20Name%20For%20Alert%20Contact&id=236&=");
											Request request = new Request.Builder()
											  .url("https://api.uptimerobot.com/v2/editAlertContact")
											  .post(body)
											  .addHeader("cache-control", "no-cache")
											  .addHeader("content-type", "application/x-www-form-urlencoded")
											  .build();

											Response response = client.newCall(request).execute();
										

The responses would be:

XML

										
									

JSON

										jsonUptimeRobotApi({
											"stat": "ok",
											"alertcontact": {
												"id": "236"
											}
										})
									

POST deleteAlertContact

Alert contacts can be deleted using this method.

Parameters:
  • api_key - required
  • id - required

The URL for the request would be:

https://api.uptimerobot.com/v2/deleteAlertContact

										curl -X POST -H "Cache-Control: no-cache" -H "Content-Type: application/x-www-form-urlencoded" -d 'api_key=enterYourAPIKeyHere&format=json&id=2414745' "https://api.uptimerobot.com/v2/deleteAlertContact"
									
										$curl = curl_init();

										curl_setopt_array($curl, array(
										  CURLOPT_URL => "https://api.uptimerobot.com/v2/deleteAlertContact",
										  CURLOPT_RETURNTRANSFER => true,
										  CURLOPT_ENCODING => "",
										  CURLOPT_MAXREDIRS => 10,
										  CURLOPT_TIMEOUT => 30,
										  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
										  CURLOPT_CUSTOMREQUEST => "POST",
										  CURLOPT_POSTFIELDS => "api_key=enterYourAPIKeyHere&format=json&id=2414745",
										  CURLOPT_HTTPHEADER => array(
										    "cache-control: no-cache",
										    "content-type: application/x-www-form-urlencoded"
										  ),
										));

										$response = curl_exec($curl);
										$err = curl_error($curl);

										curl_close($curl);

										if ($err) {
										  echo "cURL Error #:" . $err;
										} else {
										  echo $response;
										}
									
										$request = new HttpRequest();
										$request->setUrl('https://api.uptimerobot.com/v2/deleteAlertContact');
										$request->setMethod(HTTP_METH_POST);

										$request->setHeaders(array(
										  'content-type' => 'application/x-www-form-urlencoded',
										  'cache-control' => 'no-cache'
										));

										$request->setContentType('application/x-www-form-urlencoded');
										$request->setPostFields(array(
										  'api_key' => 'enterYourAPIKeyHere',
										  'format' => 'json',
										  'id' => '2414745'
										));

										try {
										  $response = $request->send();

										  echo $response->getBody();
										} catch (HttpException $ex) {
										  echo $ex;
										}
									
										import http.client

										conn = http.client.HTTPSConnection("api.uptimerobot.com")

										payload = "api_key=enterYourAPIKeyHere&format=json&id=2414745"

										headers = {
										    'cache-control': "no-cache",
										    'content-type': "application/x-www-form-urlencoded"
										    }

										conn.request("POST", "/v2/deleteAlertContact", payload, headers)

										res = conn.getresponse()
										data = res.read()

										print(data.decode("utf-8"))
									
										import requests

										url = "https://api.uptimerobot.com/v2/deleteAlertContact"

										payload = "api_key=enterYourAPIKeyHere&format=json&id=2414745"
										headers = {
										    'cache-control': "no-cache",
										    'content-type': "application/x-www-form-urlencoded"
										    }

										response = requests.request("POST", url, data=payload, headers=headers)

										print(response.text)
									
										var qs = require("querystring");
										var http = require("https");

										var options = {
										  "method": "POST",
										  "hostname": "api.uptimerobot.com",
										  "port": null,
										  "path": "/v2/deleteAlertContact",
										  "headers": {
										    "cache-control": "no-cache",
										    "content-type": "application/x-www-form-urlencoded"
										  }
										};

										var req = http.request(options, function (res) {
										  var chunks = [];

										  res.on("data", function (chunk) {
										    chunks.push(chunk);
										  });

										  res.on("end", function () {
										    var body = Buffer.concat(chunks);
										    console.log(body.toString());
										  });
										});

										req.write(qs.stringify({ api_key: 'enterYourAPIKeyHere', format: 'json', id: '2414745' }));
										req.end();
									
										var request = require("request");

										var options = { method: 'POST',
										  url: 'https://api.uptimerobot.com/v2/deleteAlertContact',
										  headers:
										   { 'content-type': 'application/x-www-form-urlencoded',
										     'cache-control': 'no-cache' },
										  form: { api_key: 'enterYourAPIKeyHere', format: 'json', id: '2414745' } };

										request(options, function (error, response, body) {
										  if (error) throw new Error(error);

										  console.log(body);
										});
									
										var request = require("request");

										var options = { method: 'POST',
										  url: 'https://api.uptimerobot.com/v2/deleteAlertContact',
										  headers:
										   { 'content-type': 'application/x-www-form-urlencoded',
										     'cache-control': 'no-cache' },
										  form: { api_key: 'enterYourAPIKeyHere', format: 'json', id: '2414745' } };

										request(options, function (error, response, body) {
										  if (error) throw new Error(error);

										  console.log(body);
										});
									
										var client = new RestClient("https://api.uptimerobot.com/v2/deleteAlertContact");
										var request = new RestRequest(Method.POST);
										request.AddHeader("content-type", "application/x-www-form-urlencoded");
										request.AddHeader("cache-control", "no-cache");
										request.AddParameter("application/x-www-form-urlencoded", "api_key=enterYourAPIKeyHere&format=json&id=2414745", ParameterType.RequestBody);
										IRestResponse response = client.Execute(request);
									
										require 'uri'
										require 'net/http'

										url = URI("https://api.uptimerobot.com/v2/deleteAlertContact")

										http = Net::HTTP.new(url.host, url.port)
										http.use_ssl = true
										http.verify_mode = OpenSSL::SSL::VERIFY_NONE

										request = Net::HTTP::Post.new(url)
										request["cache-control"] = 'no-cache'
										request["content-type"] = 'application/x-www-form-urlencoded'
										request.body = "api_key=enterYourAPIKeyHere&format=json&id=2414745"

										response = http.request(request)
										puts response.read_body
									
										OkHttpClient client = new OkHttpClient();

										MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
										RequestBody body = RequestBody.create(mediaType, "api_key=enterYourAPIKeyHere&format=json&id=2414745");
										Request request = new Request.Builder()
										  .url("https://api.uptimerobot.com/v2/deleteAlertContact")
										  .post(body)
										  .addHeader("cache-control", "no-cache")
										  .addHeader("content-type", "application/x-www-form-urlencoded")
										  .build();

										Response response = client.newCall(request).execute();
									

The responses would be:

XML

									
								

JSON

									jsonUptimeRobotApi({
										"stat": "ok",
										"alertcontact": {
											"id": "236"
										}
									})
								

POST getMWindows

The list of maintenance windows can be called with this method.

Parameters
  • api_key - required
  • mwindows - optional (if not used, will return all mwindows in an account. Else, it is possible to define any number of mwindows with their IDs like: mwindows=236-1782-4790)
  • offset - optional (used for pagination. Defines the record to start paginating. Default is 0)
  • limit - optional (used for pagination. Defines the max number of records to return for the response. Default and max. is 50)

The URL for the request would be:

https://api.uptimerobot.com/v2/getMWindows

									curl -X POST -H "Cache-Control: no-cache" -H "Content-Type: application/x-www-form-urlencoded" -d 'api_key=enterYourAPIKeyHere&format=json' "https://api.uptimerobot.com/v2/getMWindows"								
									$curl = curl_init();

									curl_setopt_array($curl, array(
									  CURLOPT_URL => "https://api.uptimerobot.com/v2/getMWindows",
									  CURLOPT_RETURNTRANSFER => true,
									  CURLOPT_ENCODING => "",
									  CURLOPT_MAXREDIRS => 10,
									  CURLOPT_TIMEOUT => 30,
									  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
									  CURLOPT_CUSTOMREQUEST => "POST",
									  CURLOPT_POSTFIELDS => "api_key=enterYourAPIKeyHere&format=json",
									  CURLOPT_HTTPHEADER => array(
									    "cache-control: no-cache",
									    "content-type: application/x-www-form-urlencoded"
									  ),
									));

									$response = curl_exec($curl);
									$err = curl_error($curl);

									curl_close($curl);

									if ($err) {
									  echo "cURL Error #:" . $err;
									} else {
									  echo $response;
									}
								
									$request = new HttpRequest();
									$request->setUrl('https://api.uptimerobot.com/v2/getMWindows');
									$request->setMethod(HTTP_METH_POST);

									$request->setHeaders(array(
									  'content-type' => 'application/x-www-form-urlencoded',
									  'cache-control' => 'no-cache'
									));

									$request->setContentType('application/x-www-form-urlencoded');
									$request->setPostFields(array(
									  'api_key' => 'enterYourAPIKeyHere',
									  'format' => 'json'
									));

									try {
									  $response = $request->send();

									  echo $response->getBody();
									} catch (HttpException $ex) {
									  echo $ex;
									}
								
									import http.client

									conn = http.client.HTTPSConnection("api.uptimerobot.com")

									payload = "api_key=enterYourAPIKeyHere&format=json"

									headers = {
									    'cache-control': "no-cache",
									    'content-type': "application/x-www-form-urlencoded"
									    }

									conn.request("POST", "/v2/getMWindows", payload, headers)

									res = conn.getresponse()
									data = res.read()

									print(data.decode("utf-8"))
								
									import requests

									url = "https://api.uptimerobot.com/v2/getMWindows"

									payload = "api_key=enterYourAPIKeyHere&format=json"
									headers = {
									    'cache-control': "no-cache",
									    'content-type': "application/x-www-form-urlencoded"
									    }

									response = requests.request("POST", url, data=payload, headers=headers)

									print(response.text)
								
									var qs = require("querystring");
									var http = require("https");

									var options = {
									  "method": "POST",
									  "hostname": "api.uptimerobot.com",
									  "port": null,
									  "path": "/v2/getMWindows",
									  "headers": {
									    "cache-control": "no-cache",
									    "content-type": "application/x-www-form-urlencoded"
									  }
									};

									var req = http.request(options, function (res) {
									  var chunks = [];

									  res.on("data", function (chunk) {
									    chunks.push(chunk);
									  });

									  res.on("end", function () {
									    var body = Buffer.concat(chunks);
									    console.log(body.toString());
									  });
									});

									req.write(qs.stringify({ api_key: 'enterYourAPIKeyHere', format: 'json' }));
									req.end();
								
									var request = require("request");

									var options = { method: 'POST',
									  url: 'https://api.uptimerobot.com/v2/getMWindows',
									  headers:
									   { 'content-type': 'application/x-www-form-urlencoded',
									     'cache-control': 'no-cache' },
									  form: { api_key: 'enterYourAPIKeyHere', format: 'json' } };

									request(options, function (error, response, body) {
									  if (error) throw new Error(error);

									  console.log(body);
									});
								
									package main

									import (
										"fmt"
										"strings"
										"net/http"
										"io/ioutil"
									)

									func main() {

										url := "https://api.uptimerobot.com/v2/getMWindows"

										payload := strings.NewReader("api_key=enterYourAPIKeyHere&format=json")

										req, _ := http.NewRequest("POST", url, payload)

										req.Header.Add("cache-control", "no-cache")
										req.Header.Add("content-type", "application/x-www-form-urlencoded")

										res, _ := http.DefaultClient.Do(req)

										defer res.Body.Close()
										body, _ := ioutil.ReadAll(res.Body)

										fmt.Println(res)
										fmt.Println(string(body))

									}
								
									var client = new RestClient("https://api.uptimerobot.com/v2/getMWindows");
									var request = new RestRequest(Method.POST);
									request.AddHeader("content-type", "application/x-www-form-urlencoded");
									request.AddHeader("cache-control", "no-cache");
									request.AddParameter("application/x-www-form-urlencoded", "api_key=enterYourAPIKeyHere&format=json", ParameterType.RequestBody);
									IRestResponse response = client.Execute(request);
								
									require 'uri'
									require 'net/http'

									url = URI("https://api.uptimerobot.com/v2/getMWindows")

									http = Net::HTTP.new(url.host, url.port)
									http.use_ssl = true
									http.verify_mode = OpenSSL::SSL::VERIFY_NONE

									request = Net::HTTP::Post.new(url)
									request["cache-control"] = 'no-cache'
									request["content-type"] = 'application/x-www-form-urlencoded'
									request.body = "api_key=enterYourAPIKeyHere&format=json"

									response = http.request(request)
									puts response.read_body
								
									OkHttpClient client = new OkHttpClient();

									MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
									RequestBody body = RequestBody.create(mediaType, "api_key=enterYourAPIKeyHere&format=json");
									Request request = new Request.Builder()
									  .url("https://api.uptimerobot.com/v2/getMWindows")
									  .post(body)
									  .addHeader("cache-control", "no-cache")
									  .addHeader("content-type", "application/x-www-form-urlencoded")
									  .build();

									Response response = client.newCall(request).execute();
								

The responses would be:

XML

								
								
								    
								        10
								        0
								        3
								    
								    
								        
								            581
								            1
								            1
								            Once Backup
								            1461024000
								            12
								            
								            1
								        
								        
								            582
								            1
								            2
								            Daily Reboot
								            06:37
								            2
								            
								            1
								        
								    
								
							

JSON

								{
								  "stat": "ok",
								  "pagination": {
								    "limit": 10,
								    "offset": 0,
								    "total": 3
								  },
								  "mwindows": [
								    {
								      "id": 581,
								      "user": 1,
								      "type": 1,
								      "friendly_name": "Once Backup",
								      "start_time": 1461024000,
								      "duration": 12,
								      "value": "",
								      "status": 1
								    },
								    {
								      "id": 582,
								      "user": 1,
								      "type": 2,
								      "friendly_name": "Daily Reboot",
								      "start_time": "06:37",
								      "duration": 2,
								      "value": "",
								      "status": 1
								    }
								  ]
								}
							

POST newMWindow

New maintenance windows can be created using this method.

Parameters
  • api_key - required
  • friendly_name - required
  • type - required
  • value - required (only needed for weekly and monthly maintenance windows and must be sent like 2-4-5 for Tuesday-Thursday-Friday or 10-17-26 for the days of the month)
  • start_time - required (the start datetime)
  • duration - required (how many minutes the maintenance window will be active for)

The URL for the request would be:

https://api.uptimerobot.com/v2/newMWindow

										curl -X POST -H "Cache-Control: no-cache" -H "Content-Type: application/x-www-form-urlencoded" -d 'api_key=enterYourAPIKeyHere&format=json&friendly_name=My Maintenance Window&type=1&start_time=1612083323&duration=30' "https://api.uptimerobot.com/v2/newMWindow"
									
										$curl = curl_init();

										curl_setopt_array($curl, array(
										  CURLOPT_URL => "https://api.uptimerobot.com/v2/newMWindow",
										  CURLOPT_RETURNTRANSFER => true,
										  CURLOPT_ENCODING => "",
										  CURLOPT_MAXREDIRS => 10,
										  CURLOPT_TIMEOUT => 30,
										  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
										  CURLOPT_CUSTOMREQUEST => "POST",
										  CURLOPT_POSTFIELDS => "api_key=enterYourAPIKeyHere&format=json&friendly_name=My%20Maintenance%20Window&type=1&start_time=1612083323&duration=30",
										  CURLOPT_HTTPHEADER => array(
										    "cache-control: no-cache",
										    "content-type: application/x-www-form-urlencoded"
										  ),
										));

										$response = curl_exec($curl);
										$err = curl_error($curl);

										curl_close($curl);

										if ($err) {
										  echo "cURL Error #:" . $err;
										} else {
										  echo $response;
										}
									
										$request = new HttpRequest();
										$request->setUrl('https://api.uptimerobot.com/v2/newMWindow');
										$request->setMethod(HTTP_METH_POST);

										$request->setHeaders(array(
										  'content-type' => 'application/x-www-form-urlencoded',
										  'cache-control' => 'no-cache'
										));

										$request->setContentType('application/x-www-form-urlencoded');
										$request->setPostFields(array(
										  'api_key' => 'enterYourAPIKeyHere',
										  'format' => 'json',
										  'friendly_name' => 'My Maintenance Window',
										  'type' => '1',
										  'start_time' => '1612083323',
										  'duration' => '30'
										));

										try {
										  $response = $request->send();

										  echo $response->getBody();
										} catch (HttpException $ex) {
										  echo $ex;
										}
									
										import http.client

										conn = http.client.HTTPSConnection("api.uptimerobot.com")

										payload = "api_key=enterYourAPIKeyHere&format=json&friendly_name=My%20Maintenance%20Window&type=1&start_time=1612083323&duration=30"

										headers = {
										    'cache-control': "no-cache",
										    'content-type': "application/x-www-form-urlencoded"
										    }

										conn.request("POST", "/v2/newMWindow", payload, headers)

										res = conn.getresponse()
										data = res.read()

										print(data.decode("utf-8"))
									
										import requests

										url = "https://api.uptimerobot.com/v2/newMWindow"

										payload = "api_key=enterYourAPIKeyHere&format=json&friendly_name=My%20Maintenance%20Window&type=1&start_time=1612083323&duration=30"
										headers = {
										    'cache-control': "no-cache",
										    'content-type': "application/x-www-form-urlencoded"
										    }

										response = requests.request("POST", url, data=payload, headers=headers)

										print(response.text)
									
										var qs = require("querystring");
										var http = require("https");

										var options = {
										  "method": "POST",
										  "hostname": "api.uptimerobot.com",
										  "port": null,
										  "path": "/v2/newMWindow",
										  "headers": {
										    "cache-control": "no-cache",
										    "content-type": "application/x-www-form-urlencoded"
										  }
										};

										var req = http.request(options, function (res) {
										  var chunks = [];

										  res.on("data", function (chunk) {
										    chunks.push(chunk);
										  });

										  res.on("end", function () {
										    var body = Buffer.concat(chunks);
										    console.log(body.toString());
										  });
										});

										req.write(qs.stringify({ api_key: 'enterYourAPIKeyHere',
										  format: 'json',
										  friendly_name: 'My Maintenance Window',
										  type: '1',
										  start_time: '1612083323',
										  duration: '30' }));
										req.end();
									
										var request = require("request");

										var options = { method: 'POST',
										  url: 'https://api.uptimerobot.com/v2/newMWindow',
										  headers:
										   { 'content-type': 'application/x-www-form-urlencoded',
										     'cache-control': 'no-cache' },
										  form:
										   { api_key: 'enterYourAPIKeyHere',
										     format: 'json',
										     friendly_name: 'My Maintenance Window',
										     type: '1',
										     start_time: '1612083323',
										     duration: '30' } };

										request(options, function (error, response, body) {
										  if (error) throw new Error(error);

										  console.log(body);
										});
									
										package main

										import (
											"fmt"
											"strings"
											"net/http"
											"io/ioutil"
										)

										func main() {

											url := "https://api.uptimerobot.com/v2/newMWindow"

											payload := strings.NewReader("api_key=enterYourAPIKeyHere&format=json&friendly_name=My%20Maintenance%20Window&type=1&start_time=1612083323&duration=30")

											req, _ := http.NewRequest("POST", url, payload)

											req.Header.Add("cache-control", "no-cache")
											req.Header.Add("content-type", "application/x-www-form-urlencoded")

											res, _ := http.DefaultClient.Do(req)

											defer res.Body.Close()
											body, _ := ioutil.ReadAll(res.Body)

											fmt.Println(res)
											fmt.Println(string(body))

										}
									
										var client = new RestClient("https://api.uptimerobot.com/v2/newMWindow");
										var request = new RestRequest(Method.POST);
										request.AddHeader("content-type", "application/x-www-form-urlencoded");
										request.AddHeader("cache-control", "no-cache");
										request.AddParameter("application/x-www-form-urlencoded", "api_key=enterYourAPIKeyHere&format=json&friendly_name=My%20Maintenance%20Window&type=1&start_time=1612083323&duration=30", ParameterType.RequestBody);
										IRestResponse response = client.Execute(request);
									
										require 'uri'
										require 'net/http'

										url = URI("https://api.uptimerobot.com/v2/newMWindow")

										http = Net::HTTP.new(url.host, url.port)
										http.use_ssl = true
										http.verify_mode = OpenSSL::SSL::VERIFY_NONE

										request = Net::HTTP::Post.new(url)
										request["cache-control"] = 'no-cache'
										request["content-type"] = 'application/x-www-form-urlencoded'
										request.body = "api_key=enterYourAPIKeyHere&format=json&friendly_name=My%20Maintenance%20Window&type=1&start_time=1612083323&duration=30"

										response = http.request(request)
										puts response.read_body
									
										OkHttpClient client = new OkHttpClient();

										MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
										RequestBody body = RequestBody.create(mediaType, "api_key=enterYourAPIKeyHere&format=json&friendly_name=My%20Maintenance%20Window&type=1&start_time=1612083323&duration=30");
										Request request = new Request.Builder()
										  .url("https://api.uptimerobot.com/v2/newMWindow")
										  .post(body)
										  .addHeader("cache-control", "no-cache")
										  .addHeader("content-type", "application/x-www-form-urlencoded")
										  .build();

										Response response = client.newCall(request).execute();
									

The responses would be:

XML

									
									
									    
									        10
									        0
									        3
									    
									    
									        
									            581
									            1
									            1
									            Once Backup
									            1461024000
									            12
									            
									            1
									        
									        
									            582
									            1
									            2
									            Daily Reboot
									            06:37
									            2
									            
									            1
									        
									    
									
								

JSON

									{
									  "stat": "ok",
									  "pagination": {
									    "limit": 10,
									    "offset": 0,
									    "total": 3
									  },
									  "mwindows": [
									    {
									      "id": 581,
									      "user": 1,
									      "type": 1,
									      "friendly_name": "Once Backup",
									      "start_time": 1461024000,
									      "duration": 12,
									      "value": "",
									      "status": 1
									    },
									    {
									      "id": 582,
									      "user": 1,
									      "type": 2,
									      "friendly_name": "Daily Reboot",
									      "start_time": "06:37",
									      "duration": 2,
									      "value": "",
									      "status": 1
									    }
									  ]
									}
								

POST editMWindow

Maintenance windows can be edited using this method.

Parameters
  • api_key - required
  • id - required
  • friendly_name - required
  • value - required (only needed for weekly and monthly maintenance windows and must be sent like 2-4-5 for Tuesday-Thursday-Friday)
  • start_time - required (required the start datetime)
  • duration - required (required how many minutes the maintenance window will be active for)

The URL for the request would be:

https://api.uptimerobot.com/v2/editMWindow

										curl -X POST -H "Cache-Control: no-cache" -H "Content-Type: application/x-www-form-urlencoded" -d 'api_key=enterYourAPIKeyHere&id=256&format=json&friendly_name=New Name For mWindow&start_time=1613093323&duration=22' "https://api.uptimerobot.com/v2/editMWindow"
									
										$curl = curl_init();

										curl_setopt_array($curl, array(
										  CURLOPT_URL => "https://api.uptimerobot.com/v2/editMWindow",
										  CURLOPT_RETURNTRANSFER => true,
										  CURLOPT_ENCODING => "",
										  CURLOPT_MAXREDIRS => 10,
										  CURLOPT_TIMEOUT => 30,
										  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
										  CURLOPT_CUSTOMREQUEST => "POST",
										  CURLOPT_POSTFIELDS => "api_key=enterYourAPIKeyHere&id=256&format=json&friendly_name=New%20Name%20For%20mWindow&start_time=1613093323&duration=22",
										  CURLOPT_HTTPHEADER => array(
										    "cache-control: no-cache",
										    "content-type: application/x-www-form-urlencoded"
										  ),
										));

										$response = curl_exec($curl);
										$err = curl_error($curl);

										curl_close($curl);

										if ($err) {
										  echo "cURL Error #:" . $err;
										} else {
										  echo $response;
										}
									
										$request = new HttpRequest();
										$request->setUrl('https://api.uptimerobot.com/v2/editMWindow');
										$request->setMethod(HTTP_METH_POST);

										$request->setHeaders(array(
										  'content-type' => 'application/x-www-form-urlencoded',
										  'cache-control' => 'no-cache'
										));

										$request->setContentType('application/x-www-form-urlencoded');
										$request->setPostFields(array(
										  'api_key' => 'enterYourAPIKeyHere',
										  'id' => '256',
										  'format' => 'json',
										  'friendly_name' => 'New Name For mWindow',
										  'start_time' => '1613093323',
										  'duration' => '22'
										));

										try {
										  $response = $request->send();

										  echo $response->getBody();
										} catch (HttpException $ex) {
										  echo $ex;
										}
									
										import http.client

										conn = http.client.HTTPSConnection("api.uptimerobot.com")

										payload = "api_key=enterYourAPIKeyHere&id=256&format=json&friendly_name=New%20Name%20For%20mWindow&start_time=1613093323&duration=22"

										headers = {
										    'cache-control': "no-cache",
										    'content-type': "application/x-www-form-urlencoded"
										    }

										conn.request("POST", "/v2/editMWindow", payload, headers)

										res = conn.getresponse()
										data = res.read()

										print(data.decode("utf-8"))
									
										import requests

										url = "https://api.uptimerobot.com/v2/editMWindow"

										payload = "api_key=enterYourAPIKeyHere&id=256&format=json&friendly_name=New%20Name%20For%20mWindow&start_time=1613093323&duration=22"
										headers = {
										    'cache-control': "no-cache",
										    'content-type': "application/x-www-form-urlencoded"
										    }

										response = requests.request("POST", url, data=payload, headers=headers)

										print(response.text)
									
										var qs = require("querystring");
										var http = require("https");

										var options = {
										  "method": "POST",
										  "hostname": "api.uptimerobot.com",
										  "port": null,
										  "path": "/v2/editMWindow",
										  "headers": {
										    "cache-control": "no-cache",
										    "content-type": "application/x-www-form-urlencoded"
										  }
										};

										var req = http.request(options, function (res) {
										  var chunks = [];

										  res.on("data", function (chunk) {
										    chunks.push(chunk);
										  });

										  res.on("end", function () {
										    var body = Buffer.concat(chunks);
										    console.log(body.toString());
										  });
										});

										req.write(qs.stringify({ api_key: 'enterYourAPIKeyHere',
										  id: '256',
										  format: 'json',
										  friendly_name: 'New Name For mWindow',
										  start_time: '1613093323',
										  duration: '22' }));
										req.end();
									
										var request = require("request");

										var options = { method: 'POST',
										  url: 'https://api.uptimerobot.com/v2/editMWindow',
										  headers:
										   { 'content-type': 'application/x-www-form-urlencoded',
										     'cache-control': 'no-cache' },
										  form:
										   { api_key: 'enterYourAPIKeyHere',
										     id: '256',
										     format: 'json',
										     friendly_name: 'New Name For mWindow',
										     start_time: '1613093323',
										     duration: '22' } };

										request(options, function (error, response, body) {
										  if (error) throw new Error(error);

										  console.log(body);
										});
									
										package main

										import (
											"fmt"
											"strings"
											"net/http"
											"io/ioutil"
										)

										func main() {

											url := "https://api.uptimerobot.com/v2/editMWindow"

											payload := strings.NewReader("api_key=enterYourAPIKeyHere&id=256&format=json&friendly_name=New%20Name%20For%20mWindow&start_time=1613093323&duration=22")

											req, _ := http.NewRequest("POST", url, payload)

											req.Header.Add("cache-control", "no-cache")
											req.Header.Add("content-type", "application/x-www-form-urlencoded")

											res, _ := http.DefaultClient.Do(req)

											defer res.Body.Close()
											body, _ := ioutil.ReadAll(res.Body)

											fmt.Println(res)
											fmt.Println(string(body))

										}
									
										var client = new RestClient("https://api.uptimerobot.com/v2/editMWindow");
										var request = new RestRequest(Method.POST);
										request.AddHeader("content-type", "application/x-www-form-urlencoded");
										request.AddHeader("cache-control", "no-cache");
										request.AddParameter("application/x-www-form-urlencoded", "api_key=enterYourAPIKeyHere&id=256&format=json&friendly_name=New%20Name%20For%20mWindow&start_time=1613093323&duration=22", ParameterType.RequestBody);
										IRestResponse response = client.Execute(request);
									
										require 'uri'
										require 'net/http'

										url = URI("https://api.uptimerobot.com/v2/editMWindow")

										http = Net::HTTP.new(url.host, url.port)
										http.use_ssl = true
										http.verify_mode = OpenSSL::SSL::VERIFY_NONE

										request = Net::HTTP::Post.new(url)
										request["cache-control"] = 'no-cache'
										request["content-type"] = 'application/x-www-form-urlencoded'
										request.body = "api_key=enterYourAPIKeyHere&id=256&format=json&friendly_name=New%20Name%20For%20mWindow&start_time=1613093323&duration=22"

										response = http.request(request)
										puts response.read_body
									
										OkHttpClient client = new OkHttpClient();

										MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
										RequestBody body = RequestBody.create(mediaType, "api_key=enterYourAPIKeyHere&id=256&format=json&friendly_name=New%20Name%20For%20mWindow&start_time=1613093323&duration=22");
										Request request = new Request.Builder()
										  .url("https://api.uptimerobot.com/v2/editMWindow")
										  .post(body)
										  .addHeader("cache-control", "no-cache")
										  .addHeader("content-type", "application/x-www-form-urlencoded")
										  .build();

										Response response = client.newCall(request).execute();
									

The responses would be:

XML

									
								

JSON

									{
									  "stat": "ok",
									  "mwindow": {
									    "id": 256,
									    "status": 1
									  }
									}
								

POST deleteMWindow

Maintenance windows can be deleted using this method.

Parameters:
  • api_key - required
  • id - required

The URL for the request would be:

https://api.uptimerobot.com/v2/deleteMWindow

											curl -X POST -H "Cache-Control: no-cache" -H "Content-Type: application/x-www-form-urlencoded" -d 'api_key=enterYourAPIKeyHere&format=json&id=2414745' "https://api.uptimerobot.com/v2/deleteMWindow"
										
											$curl = curl_init();

											curl_setopt_array($curl, array(
											  CURLOPT_URL => "https://api.uptimerobot.com/v2/deleteMWindow",
											  CURLOPT_RETURNTRANSFER => true,
											  CURLOPT_ENCODING => "",
											  CURLOPT_MAXREDIRS => 10,
											  CURLOPT_TIMEOUT => 30,
											  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
											  CURLOPT_CUSTOMREQUEST => "POST",
											  CURLOPT_POSTFIELDS => "api_key=enterYourAPIKeyHere&format=json&id=2414745",
											  CURLOPT_HTTPHEADER => array(
											    "cache-control: no-cache",
											    "content-type: application/x-www-form-urlencoded"
											  ),
											));

											$response = curl_exec($curl);
											$err = curl_error($curl);

											curl_close($curl);

											if ($err) {
											  echo "cURL Error #:" . $err;
											} else {
											  echo $response;
											}
										
											$request = new HttpRequest();
											$request->setUrl('https://api.uptimerobot.com/v2/deleteMWindow');
											$request->setMethod(HTTP_METH_POST);

											$request->setHeaders(array(
											  'content-type' => 'application/x-www-form-urlencoded',
											  'cache-control' => 'no-cache'
											));

											$request->setContentType('application/x-www-form-urlencoded');
											$request->setPostFields(array(
											  'api_key' => 'enterYourAPIKeyHere',
											  'format' => 'json',
											  'id' => '2414745'
											));

											try {
											  $response = $request->send();

											  echo $response->getBody();
											} catch (HttpException $ex) {
											  echo $ex;
											}
										
											import http.client

											conn = http.client.HTTPSConnection("api.uptimerobot.com")

											payload = "api_key=enterYourAPIKeyHere&format=json&id=2414745"

											headers = {
											    'cache-control': "no-cache",
											    'content-type': "application/x-www-form-urlencoded"
											    }

											conn.request("POST", "/v2/deleteMWindow", payload, headers)

											res = conn.getresponse()
											data = res.read()

											print(data.decode("utf-8"))
										
											import requests

											url = "https://api.uptimerobot.com/v2/deleteMWindow"

											payload = "api_key=enterYourAPIKeyHere&format=json&id=2414745"
											headers = {
											    'cache-control': "no-cache",
											    'content-type': "application/x-www-form-urlencoded"
											    }

											response = requests.request("POST", url, data=payload, headers=headers)

											print(response.text)
										
											var qs = require("querystring");
											var http = require("https");

											var options = {
											  "method": "POST",
											  "hostname": "api.uptimerobot.com",
											  "port": null,
											  "path": "/v2/deleteMWindow",
											  "headers": {
											    "cache-control": "no-cache",
											    "content-type": "application/x-www-form-urlencoded"
											  }
											};

											var req = http.request(options, function (res) {
											  var chunks = [];

											  res.on("data", function (chunk) {
											    chunks.push(chunk);
											  });

											  res.on("end", function () {
											    var body = Buffer.concat(chunks);
											    console.log(body.toString());
											  });
											});

											req.write(qs.stringify({ api_key: 'enterYourAPIKeyHere', format: 'json', id: '2414745' }));
											req.end();
										
											var request = require("request");

											var options = { method: 'POST',
											  url: 'https://api.uptimerobot.com/v2/deleteMWindow',
											  headers:
											   { 'content-type': 'application/x-www-form-urlencoded',
											     'cache-control': 'no-cache' },
											  form: { api_key: 'enterYourAPIKeyHere', format: 'json', id: '2414745' } };

											request(options, function (error, response, body) {
											  if (error) throw new Error(error);

											  console.log(body);
											});
										
											package main

											import (
												"fmt"
												"strings"
												"net/http"
												"io/ioutil"
											)

											func main() {

												url := "https://api.uptimerobot.com/v2/deleteMWindow"

												payload := strings.NewReader("api_key=enterYourAPIKeyHere&format=json&id=2414745")

												req, _ := http.NewRequest("POST", url, payload)

												req.Header.Add("cache-control", "no-cache")
												req.Header.Add("content-type", "application/x-www-form-urlencoded")

												res, _ := http.DefaultClient.Do(req)

												defer res.Body.Close()
												body, _ := ioutil.ReadAll(res.Body)

												fmt.Println(res)
												fmt.Println(string(body))

											}
										
											var client = new RestClient("https://api.uptimerobot.com/v2/deleteMWindow");
											var request = new RestRequest(Method.POST);
											request.AddHeader("content-type", "application/x-www-form-urlencoded");
											request.AddHeader("cache-control", "no-cache");
											request.AddParameter("application/x-www-form-urlencoded", "api_key=enterYourAPIKeyHere&format=json&id=2414745", ParameterType.RequestBody);
											IRestResponse response = client.Execute(request);
										
											require 'uri'
											require 'net/http'

											url = URI("https://api.uptimerobot.com/v2/deleteMWindow")

											http = Net::HTTP.new(url.host, url.port)
											http.use_ssl = true
											http.verify_mode = OpenSSL::SSL::VERIFY_NONE

											request = Net::HTTP::Post.new(url)
											request["cache-control"] = 'no-cache'
											request["content-type"] = 'application/x-www-form-urlencoded'
											request.body = "api_key=enterYourAPIKeyHere&format=json&id=2414745"

											response = http.request(request)
											puts response.read_body
										
											OkHttpClient client = new OkHttpClient();

											MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
											RequestBody body = RequestBody.create(mediaType, "api_key=enterYourAPIKeyHere&format=json&id=2414745");
											Request request = new Request.Builder()
											  .url("https://api.uptimerobot.com/v2/deleteMWindow")
											  .post(body)
											  .addHeader("cache-control", "no-cache")
											  .addHeader("content-type", "application/x-www-form-urlencoded")
											  .build();

											Response response = client.newCall(request).execute();
										

The responses would be:

XML

										
									

JSON

										jsonUptimeRobotApi({
											"stat": "ok",
											"mwindow": {
												"id": "2414745"
											}
										})
									

Parameters

Objects Values Extra Details
stat
  • ok
  • fail
exists only for JSON responses to show if any records are returned or not.
pagination>offset integer the starting record for getMonitors and getAlertContacts methods
pagination>limit integer the number of records to be returned for getMonitors and getAlertContacts methods
pagination>total integer the total number of records for getMonitors and getAlertContacts methods
account>email text the account e-mail.
account>monitor_limit integer the max number of monitors that can be created for the account
account>monitor_interval integer the min monitoring interval (in seconds) supported by the account
account>up_monitors integer the number of "up" monitors
account>down_monitors integer the number of "down" monitors
account>pause_monitors integer the number of "paused" monitors
monitor>id integer the ID of the monitor (can be used for monitor-specific requests).
monitor>friendly_name text the friendly name of the monitor.
monitor>url URL or IP the URL/IP of the monitor.
monitor>type
  • 1 - HTTP(s)
  • 2 - Keyword
  • 3 - Ping
  • 4 - Port
the type of the monitor.
monitor>sub_type
  • 1 - HTTP (80)
  • 2 - HTTPS (443)
  • 3 - FTP (21)
  • 4 - SMTP (25)
  • 5 - POP3 (110)
  • 6 - IMAP (143)
  • 99 - Custom Port
used only for "Port monitoring (monitor>type = 4)" and shows which pre-defined port/service is monitored or if a custom port is monitored.
monitor>keyword_type
  • 1 - exists
  • 2 - not exists
used only for "Keyword monitoring (monitor>type = 2)" and shows "if the monitor will be flagged as down when the keyword exists or not exists".
monitor>keyword_value text the value of the keyword.
monitor>http_username text used for password-protected web pages (HTTP Basic Auth). Available for HTTP and keyword monitoring.
monitor>http_password text used for password-protected web pages (HTTP Basic Auth). Available for HTTP and keyword monitoring.
monitor>port integer used only for "Port monitoring (monitor>type = 4)" and shows the port monitored.
monitor>interval integer the interval for the monitoring check (300 seconds by default).
monitor>status
  • 0 - paused
  • 1 - not checked yet
  • 2 - up
  • 8 - seems down
  • 9 - down
the status of the monitor. When used with the editMonitor method 0 (to pause) or 1 (to start) can be sent.
monitor>all_time_uptime_ratio

formatted as up-down-paused

the uptime ratio of the monitor calculated since the monitor is created.
monitor>all_time_uptime_durations

rational number (with 3 decimals)

the durations of all time up-down-paused events in seconds.
monitor>custom_uptime_ratios

rational number (with 3 decimals)

the uptime ratio of the monitor for the given periods (if there is more than 1 period, then the values are seperated with "-")
monitor>custom_uptime_ranges

rational number (with 3 decimals)

the uptime ratio of the monitor for the given ranges (if there is more than 1 range, then the values are seperated with "-")
monitor>average_response_time

rational number (with 3 decimals)

the average value of the response times (requires response_times=1)
log>type
  • 1 - down
  • 2 - up
  • 99 - paused
  • 98 - started
the value of the keyword.
log>datetime Unix time the date and time of the log (inherits the user's timezone setting).
log>duration seconds (integer) the duration of the downtime in seconds.
log>reason text the reason of the downtime (if exists).
response_time>datetime Unix time the date and time of the log (inherits the user's timezone setting).
response_time>value Integer the time to first-byte in milliseconds.
alertcontact>id integer the ID of the alert contact.
alertcontact>type
  • 1 - SMS
  • 2 - E-mail
  • 3 - Twitter DM
  • 4 - Boxcar
  • 5 - Web-Hook
  • 6 - Pushbullet
  • 7 - Zapier
  • 9 - Pushover
  • 10 - HipChat
  • 11 - Slack
the type of the alert contact notified (Zapier, HipChat and Slack are not supported in the newAlertContact method yet).
alertcontact>friendly_name text friendly name of the alert contact (for making it easier to distinguish from others).
alertcontact>value text alert contact's address/phone.
alertcontact>status
  • 0 - not activated
  • 1 - paused
  • 2 - active
the status of the alert contact.
alertcontact>threshold 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,20,30,35,40,45,50,55,60,70,80,90,100,110,120,150,180,210,240,270,300,360,420,480,540,600,660,720 the x value that is set to define "if down for x minutes, alert every y minutes.
alertcontact>recurrence 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,20,30,35,40,45,50,55,60 the y value that is set to define "if down for x minutes, alert every y minutes.
mwindow>id integer the ID of the maintenance window.
mwindow>type
  • 1 - Once
  • 2 - Daily
  • 3 - Weekly
  • 4 - Monthly
the type of the maintenance window.
mwindow>friendly_name text friendly name of the maintenance window (for making it easier to distinguish from others).
mwindow>value text seperated with "-" and used only for weekly and monthly maintenance windows.
mwindow>start_time Unix time start time of the maintenance windows.
mwindow>duration Integer duration of the maintenance windows in minutes.
mwindow>status
  • 0 - paused
  • 1 - active
the status of the maintenance window.
Start Monitoring (in 30 secs)

SUPPORT

DEVELOPERS