Monitors your websites every 5 minutes, totally free.
Add up to 50 websites. Get alerts by e-mail, SMS, Twitter, RSS or push notifications for iPhone/iPad.
API Shortcuts
API
Uptime Robot has a very easy-to-use API.
Responses are provided as either XML, JSON or JSON-P.
It lets you get the details of your monitors, logs and create/edit monitors (or remove existing ones).
That's all.
Authentication
HTTP Basic Access Authentication is used for verifying accounts.
There are 2 types of apiKeys for reaching the data:
- account-specific apiKey which allows using all the API methods on all the monitors of an account
- monitor-specific apiKeys which allows using only the
getMonitorsmethod for the givenmonitor
Which apiKey type to use?
account-specific apiKey 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 apiKeys are good for pulling data for a single monitor without revealing your main apiKey (account-specific apiKey). For ex: you can use monitor-specific apiKeys in client websites (so you'll still be able to pull data and the client will only be able to see the monitor-specific apiKey).
Where to find the apiKeys?
They are found under "My Settings" page.
While making a request, send the apiKey in your request just like:
apiKey=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
Once a JSON response is requested, the response comes with a callback function named jsonUptimeRobotApi by default, just like:
jsonUptimeRobotApi({...});
If you only need the raw JSON response without a function wrapper, send the noJsonCallback parameter with a value of 1, like:
noJsonCallback=1 will result in {...}
Methods
Methods are defined just after the API URL (for ex: http://api.uptimerobot.com/methodName). And, here they are:
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
- apiKey - 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) - customUptimeRatio - optional (defines the number of days to calculate the uptime ratio(s) for. Ex:
customUptimeRatio=7-30-45to get the uptime ratios for those periods) - logs - optional (defines if the logs of each monitor will be returned. Should be set to
1for getting the logs. Default is0) - alertContacts - optional (defines if the notified alert contacts of each notification will be returned. Should be set to
1for getting them. Default is0. Requires logs to be set to1) - showMonitorAlertContacts - optional (defines if the alert contacts set for the monitor to be returned. Default is
0. - showTimezone - optional (defines if the user's timezone should be returned. Should be set to
1for getting it. Default is0.
Example Request And Response
newMonitor
New monitors of any type can be created using this method.
Parameters
- apiKey - required
- monitorFriendlyName - required
- monitorURL - required
- monitorType - required
- monitorSubType - optional (required for port monitoring)
- monitorPort - optional (required for port monitoring)
- monitorKeywordType - optional (required for keyword monitoring)
- monitorKeywordValue - optional (required for keyword monitoring)
- monitorHTTPUsername - optional
- monitorHTTPPassword - optional
- monitorAlertContacts - optional (the alert contacts to be notified when the monitor goes up/down.Multiple
alertContactIDs can be sent likemonitorAlertContacts=457-373-8956)
Example Request And Response
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
- apiKey - required
- monitorID - required
- monitorStatus - optional
- monitorFriendlyName - optional
- monitorURL -optional
- monitorType -optional
- monitorSubType -optional (used only for port monitoring)
- monitorPort -optional (used onlyfor port monitoring)
- monitorKeywordType - optional (used only for keyword monitoring)
- monitorKeywordValue - optional (used only for keyword monitoring)
- monitorHTTPUsername - optional
- monitorHTTPPasswırd - optional
- monitorAlertContacts - optional (the alert contacts to be notified when the monitor goes up/down.Multiple
alertContactIDs can be sent likemonitorAlertContacts=457-373-8956)
Example Request And Response
deleteMonitor
Monitors can be deleted using this method.
Parameters
- apiKey - required
- monitorID - required
Example Request And Response
getAlertContacts
The list of alert contacts can be called with this method.
Parameters
- apiKey - required
- alertcontacts - 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:
alertcontacts=236-1782-4790)
Example Request And Response
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, tc.).
Parameters
- apiKey - required
- alertContactType - required
- alertContactValue - required
Example Request And Response
deleteAlertContact
Alert contacts can be deleted using this method.
Parameters
- apiKey - required
- alertContactID - required
Example Request And Response
Parameters
| Objects | Values | Extra Details |
|---|---|---|
| stat |
|
exists only for JSON responses to show if any records are returned or not. |
| monitor>id | integer | the ID of the monitor (can be used for monitor-specific requests). |
| monitor>friendlyname | text | the friendly name of the monitor. |
| monitor>url | URL or IP | the URL/IP of the monitor. |
| monitor>type |
|
the type of the monitor. |
| monitor>subtype |
|
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>keywordtype |
|
used only for "Keyword monitoring (monitor>type = 4)" and shows "if the monitor will be flagged as down when the keyword exists or not exists". |
| monitor>keywordvalue | text | the value of the keyword. |
| monitor>httpusername | text | used for password-protected web pages (HTTP Basic Auth). Available for HTTP and keyword monitoring. |
| monitor>httppassword | 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>status |
|
the status of the monitor. When used with the editMonitor method 0 (to pause) or 1 (to start) can be sent. |
| monitor>alltimeuptimeratio | rational number (with 2 decimals) |
the uptime ratio of the monitor calculated since the monitor is created. |
| monitor>customuptimeratio | rational number (with 2 decimals) |
the uptime ratio of the monitor for the given periods (if there are more than 1 periods, then the values are seperate with "-") |
| log>type |
|
the value of the keyword. |
| log>datetime | datetime | the date and time of the log (inherits the user's timezone setting). |
| alertcontact>id | integer | the ID of the alert contact. |
| alertcontact>type |
|
the type of the alert contact notified. |
| alertcontact>value | text | alert contact's address/phone. |
| alertcontact>status |
|
the status of the alert contact. |
Error Messages
Errors are displayed as:
| ID | Details |
|---|---|
| 100 | apiKey not mentioned or in a wrong format |
| 101 | apiKey is wrong |
| 102 | format is wrong (should be xml or json) |
| 103 | No such method exists |
| 200 | monitorID(s) should be integers |
| 201 | monitorUrl is invalid |
| 202 | monitorType is invalid |
| 203 | monitorSubType is invalid |
| 204 | monitorKeywordType is invalid |
| 205 | monitorPort is invalid |
| 206 | monitorFriendlyName is required |
| 207 | The monitor already exists |
| 208 | monitorSubType is required for this type of monitors |
| 209 | monitorKeyWordType and monitorKeyWordValue are required for this type of monitors |
| 210 | monitorID doesn't exist |
| 211 | monitorID is required |
| 212 | The account has no monitors |
| 213 | At least one of the parameters to be edited are required |
| 214 | monitorHTTPUsername and monitorHTTPPassword should both be empty or have values |
| 215 | monitor specific apiKeys can only use getMonitors method |
| 216 | A user with this e-mail already exists |
| 217 | userFirstLastName and userEmail are both required |
| 218 | userEmail is not in the right e-mail format |
| 219 | This account is not authorized to create users |
| 220 | monitorAlertContacts value is wrong |
| 221 | The account has no alert contacts |
| 222 | alertcontactID(s) should be integers |
| 223 | alertContactType and alertContactValue are both required |
| 224 | This alertContactType is not supported" |
| 225 | The alert contact already exists |
| 226 | The alert contact is not following @uptimerobot Twitter user. It is required so that the Twitter direct messages (DM) can be sent |
| 227 | The Boxcar user mentioned does not exist |
| 228 | The Boxcar alert contact couldn't be added, please try again later |
| 229 | alertContactID doesn't exist |
| 230 | alertContactValue should be a valid e-mail for this alertContactType |
Example PHP Code
For a quick start, here is a simple PHP code to retrieve the alltimeuptimeratio of a desired monitor:
<?php
/*Note: You'll need the ID of the monitor. For that, simply go to "http://api.uptimerobot.com/getMonitors?apiKey=yourApiKey" and get the ID of the monitor to be queried.*/
/*And, this code requires PHP 5+ or PHP 4 with SimpleXML enabled.*/
/*Variables - Start*/
$apiKey = "yourApiKey"; /*replace with your apiKey*/
$monitorID = 1111111; /*replace with your monitorID*/
$url = "http://api.uptimerobot.com/getMonitors?apiKey=" . $apiKey . "&monitors=" . $monitorID . "&format=xml";
/*Variables - End*/
/*Curl Request - Start*/
$c = curl_init($url);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
$responseXML = curl_exec($c);
curl_close($c);
/*Curl Request - End*/
/*XML Parsing - Start*/
$xml = simplexml_load_string($responseXML);
foreach($xml->monitor as $monitor) {
echo $monitor['alltimeuptimeratio'];
}
/*XML Parsing - End*/
?>
Unofficial API Resources
Here is a list of API-related resources created by Uptime Robot users:
- Upscuits - uptime widget (demo) (by @pixelbak )
- PHP wrapper for Uptime Robot API (by @CodingOurWeb)
- .NET Uptime Robot API Client (by GBSHouse.com)
- .NET wrapper for Uptime Robot API (by @cmaneu)
- Uptime Robot command-line utility (by @schirmacher)
- Classic ASP example for listing monitors (.zip) (by @coax)
- WordPress Dashboard Widget For Uptime Robot (by @CreativeBoulder & @CodeClarity)
- UptimeRobot for iPhone (paid)
- Uptime Robot For Android
- UptimeRobot Monitor For Android (by Mowd)
- Android App For Uptime Robot (.apk file) (by @and_n0b0dy)
- UptimeRobot for Windows Phone
Tighter Integration For Apps & Services
Do you have a web application/service with lots of users and websites to monitor? Do you need to integrate with Uptime Robot tighter (like creating users)? If so, please feel free to contact us from support(a-t)uptimerobot.com.


