LegitUptime API Documentation

Overview

This documentation provides the details needed for developers to interact with the LegitUptime API. The API has three main sections: Monitors, Incidents, and Scheduled Maintenance.
Each section contains different functions, including request examples, response samples, and requirements for easier understanding.

To call the API, make sure to include the unique API key for your project in the request header as X-API-Key.
Create new monitor button Found under Project > Settings > LegitUptime API Key.
Click "Generate New API Key" to generate the API Key. A Key will show in the textbox, you can then click the "Copy" button.

All API endpoints use the base URL https://api.legituptime.com/v1/.

Monitors

Get monitors

Endpoint: GET /monitors

Endpoint: GET /monitors/{id}

Headers: X-API-Key: your-api-key

Request sample:

curl -X GET "https://api.legituptime.com/v1/monitors" -H "X-API-Key: your-api-key"
curl -X GET "https://api.legituptime.com/v1/monitors{id}" -H "X-API-Key: your-api-key"

Response sample:

[

{
"Id": 123,
"Name": "My monitor",
"Protocol": "h",
"TestURL": "https://example.com",
"PingLocations": "USE",
"CheckFrequency": "1m",
"Active": true,
"ResendFrequency": "n",
"SSLExpiringAlertFrequency": "7d",
"AllowRedirects": true,
"ExpectedStatusCodes": "",
"HttpRequestBody": "",
"HttpRequestHeader": "",
"ResponseExpectedBodyContains": "",
"PortNumber": 443

}
]

Create/Update a monitor

Endpoint: POST /monitors

Endpoint: PUT /monitors/{id}

Headers: X-API-Key: your-api-key

Request Body Params:

  • Name (string, max 200) - The name of the monitor. Required.
  • Protocol (string, 1 char, lowercase, h for http(s), p for port, i for ICMP) - The protocol used to monitor the URL. Required.
  • TestURL (string) - The URL to ping or connect to. Required.
  • PingLocations (string) - The locations to ping from. Options are USE (US East), USW (US West), USC (US Central), UK (United Kingdom), AU (Australia), CH (China), BR (Brazil), IT (Italy), IA (India). Required.
  • CheckFrequency (string, all lowercase) - The frequency of the check. Options are: 30s, 1m, 2m, 3m, 5m, 10m, 15m, 30m, 1h, 3h, 6h, 12h, 24h. Required.
  • Active (boolean) - Whether or not the monitor is active. Required.
  • ResendFrequency (string, lowercase) - The frequency to resend alerts. Options are: n (Never), 1m, 2m, 3m, 5m, 10m, 15m, 30m, 1h. Required.
  • SSLExpiringAlertFrequency (string) - The frequency to receive alerts for expiring SSL certificates. Options are: n (Never), 1d, 3d, 7d, 10d, 15d, 30d. Optional.
  • AllowRedirects (boolean) - Whether or not to follow redirects. Required if the protocol is "h".
  • ExpectedStatusCodes (string) - The expected status codes for the URL. Leave blank for Default 200-299. Options are: any valid HTTP status code (100, 101, 102, 103, 200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 421, 422, 423, 424, 425, 426, 428, 429, 431, 451, 500, 501, 502, 503, 504, 505, 506, 507, 508, 510, 511). Required if the protocol is "h".
  • HttpRequestBody (string) - The body of the HTTP request. Optional if the protocol is "h".
  • HttpRequestHeader (string) - The headers of the HTTP request. Optional if the protocol is "h".
  • ResponseExpectedBodyContains (string) - The expected response body for the URL. Optional if the protocol is "h".
  • PortNumber (integer) - The port number to monitor. Required if the protocol is "p".

Create Request sample:

curl -X POST "https://api.legituptime.com/v1/monitors" \
                -H "X-API-Key: your-api-key" \
                -H "Content-Type: application/json" \
                -d '{
                        "Name": "My new monitor",
                        "Protocol": "h",
                        "TestURL": "https://example.com",
                        "PingLocations": "USE",
                        "CheckFrequency": "1m",
                        "Active": true,
                        "ResendFrequency": "n",
                        "SSLExpiringAlertFrequency": "7d",
                        "AllowRedirects": true,
                        "ExpectedStatusCodes": "",
                        "HttpRequestBody": "",
                        "HttpRequestHeader": "",
                        "ResponseExpectedBodyContains": "",
                        "PortNumber": 443
                    }'

Update Request sample:

curl -X PUT "https://api.legituptime.com/v1/monitors/{id}" \
                -H "X-API-Key: your-api-key" \
                -H "Content-Type: application/json" \
                -d '{
                        "Name": "My new monitor",
                        "Protocol": "h",
                        "TestURL": "https://example.com",
                        "PingLocations": "USE",
                        "CheckFrequency": "1m",
                        "Active": true,
                        "ResendFrequency": "n",
                        "SSLExpiringAlertFrequency": "7d",
                        "AllowRedirects": true,
                        "ExpectedStatusCodes": "",
                        "HttpRequestBody": "",
                        "HttpRequestHeader": "",
                        "ResponseExpectedBodyContains": "",
                        "PortNumber": 443
                    }'

Response sample:


{
  "Id": 1,
  "Name": "Monitor 1",
  "Protocol": "https",
  "TestURL": "https://example.com",
  "PingLocations": "USE, USW",
  "CheckFrequency": "30s",
  "Active": true,
  "ResendFrequency": "1m",
  "SSLExpiringAlertFrequency": "7d",
  "AllowRedirects": true,
  "ExpectedStatusCodes": "",
  "HttpRequestBody": "",
  "HttpRequestHeader": "",
  "ResponseExpectedBodyContains": "",
  "PortNumber": 443
}
        

Delete monitor

Endpoint: DELETE /monitors/{id}

Headers: X-API-Key: your-api-key

Request sample:

curl -X DELETE "https://api.legituptime.com/v1/monitors/1" -H "X-API-Key: your-api-key"

Response sample:

{ "Success": true }

Incidents

Get incidents

Endpoint: GET /incidents/Active

Endpoint: GET /incidents/Inactive

Endpoint: GET /incidents/{id}

Headers: X-API-Key: your-api-key

Request sample:

curl -X GET "https://api.legituptime.com/v1/incidents/active" -H "X-API-Key: your-api-key"
curl -X GET "https://api.legituptime.com/v1/incidents/inactive" -H "X-API-Key: your-api-key"
curl -X GET "https://api.legituptime.com/v1/incidents/{id}" -H "X-API-Key: your-api-key"

Response sample:

[

{
"Id": 123,
"Name": "My Incident",
"Severity": "d",
"CurrentStatus": "iv",
"Message": "There is a degraded performance",
"Monitors": "1,2,3,4",
"ApplyToStatusPagesOfAffectedMonitors": true
}

]

Create/Update Incident

Endpoint: POST /incidents

Endpoint: PUT /incidents/{id}

Headers: X-API-Key: your-api-key

Request Body Params:

  • Name (string, max 200) - The name of the incident. Required.
  • Severity (string, 2 chars, lowercase) - The severity of the incident. Options are: o (outage), d (degraded performance). Required.
  • CurrentStatus (string, 2 chars, lowercase) - The current status of the incident. Options are: iv (investigating), id (identified), u (update), m (monitoring), r (resolved). Required.
  • Message (string, max 400) - The message for the incident. Required.
  • Monitors (string) - The comma-delimited monitor IDs for the incident. Example: "1,2,3". Required.
  • ApplyToStatusPagesOfAffectedMonitors (boolean) - Whether or not to apply the incident to the status pages of affected monitors. Required.

Post Request sample:

curl -X POST "https://api.legituptime.com/v1/incidents" \
                    -H "X-API-Key: your-api-key" \
                    -H "Content-Type: application/json" \
                    -d '{
                        "Name": "My Incident",
                        "Severity": "d",
                        "CurrentStatus": "iv",
                        "Message": "There is a degraded performance",
                        "Monitors": "1,2,3,4",
                        "ApplyToStatusPagesOfAffectedMonitors": true
                    }'

Update Request sample:

curl -X PUT "https://api.legituptime.com/v1/incidents/{id}" \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
  "Name": "My updated incident",
  "Severity": "o",
  "CurrentStatus": "iv",
  "Message": "This is an updated message.",
  "Monitors": "1,2",
  "ApplyToStatusPagesOfAffectedMonitors": true
}'

Response sample:

{
    "Id": 123,
    "Name": "My Incident",
    "Severity": "d",
    "CurrentStatus": "iv",
    "Message": "There is a degraded performance",
    "Monitors": "1,2,3,4",
    "ApplyToStatusPagesOfAffectedMonitors": true
}

Delete an Incident

Endpoint: DELETE /incidents/{id}

Headers: X-API-Key: your-api-key

Request sample:

curl -X DELETE "https://api.legituptime.com/v1/incidents/{id}" -H "X-API-Key: your-api-key"

Response sample:

{ "Success": true }

Scheduled Maintenance

Get scheduled maintenance

Endpoint: GET /scheduledmaintenance

Endpoint: GET /scheduledmaintenance/{id}

Headers: X-API-Key: your-api-key

Request sample:

curl -X GET "https://api.legituptime.com/v1/scheduledmaintenance" -H "X-API-Key: your-api-key"
curl -X GET "https://api.legituptime.com/v1/scheduledmaintenance/{id}" -H "X-API-Key: your-api-key"

Response sample:

[
    {
        "Id": 123,
        "Name": "Scheduled maintenance 1",
        "StartDateTime": "2023-03-30T09:00:00Z",
        "DownTimeHours": 3,
        "DownTimeMinutes": 30,
        "Message": "System update.",
        "Recurring": true,
        "RecurEvery": 2,
        "RecurEndDateTime": "2024-03-30T09:00:00Z",
        "RecurEveryNum": "m",
        "Monitors": "1,2,3"
    },
    {
        "Id": 456,
        "Name": "Scheduled maintenance 2",
        "StartDateTime": "2023-04-01T12:00:00Z",
        "DownTimeHours": 1,
        "DownTimeMinutes": 0,
        "Message": "Database maintenance.",
        "Recurring": false,
        "RecurEvery": null,
        "RecurEndDateTime": null,
        "RecurEveryNum": null,
        "Monitors": "4,5,6"
    }
]

Create/Update Scheduled Maintenance

Endpoint: POST /maintenance

Endpoint: PUT /maintenance/{id}

Headers: X-API-Key: your-api-key

Request Body Params:

  • Name (string, max 200) - The name of the scheduled maintenance. Required.
  • StartDateTime (datetime) - The start date and time of the scheduled maintenance. Required.
  • DownTimeHours (integer) - The number of hours the scheduled maintenance will last.Required.
  • DownTimeMinutes (integer) - The number of minutes the scheduled maintenance will last. Max value is 59. Required.
  • Message (string, max 4000) - The message to display during the scheduled maintenance. Optional.
  • Recurring (boolean) - Whether or not the scheduled maintenance is recurring. Optional.
  • RecurEveryNum (integer) - The number of units of time between recurring scheduled maintenances. Required if recurring is true.
  • RecurEndDateTime (datetime) - The end date and time for the recurring scheduled maintenance. Required if recurring is true.
  • RecurEvery (string) - The unit of time between recurring scheduled maintenances. Options are: d (days), w (weeks), m (months). Required if recurring is true.
  • Monitors (string) - Comma delimited monitor IDs to apply the scheduled maintenance to. Required.

Create Request sample:

curl -X POST "https://api.legituptime.com/v1/scheduledmaintenance" \
                  -H "X-API-Key: your-api-key" \
                  -H "Content-Type: application/json" \
                  -d '{
                        "Name": "Scheduled Maintenance 1",
                        "StartDateTime": "2023-04-01T00:00:00Z",
                        "DownTimeHours": 2,
                        "DownTimeMinutes": 30,
                        "Message": "Performing server maintenance.",
                        "Recurring": true,
                        "RecurEvery": 1,
                        "RecurEndDateTime": "2023-05-01T00:00:00Z",
                        "RecurEveryNum": "w",
                        "Monitors": "1,2,3"
                     }'

Update Request sample:

curl -X PUT "https://api.legituptime.com/v1/scheduledmaintenance/{id}" \
                  -H "X-API-Key: your-api-key" \
                  -H "Content-Type: application/json" \
                  -d '  {
                      "Name": "Scheduled Maintenance 12222",
                        "StartDateTime": "2023-04-01T00:00:00Z",
                        "DownTimeHours": 2,
                        "DownTimeMinutes": 30,
                        "Message": "Performing server maintenance.",
                        "Recurring": true,
                        "RecurEvery": "w",
                        "RecurEndDateTime": "2023-05-01T00:00:00Z",
                        "RecurEveryNum": 1,
                        "Monitors": "1,2,3"
                    }'

Response sample:

{
                      "Name": "Scheduled Maintenance 12222",
                        "StartDateTime": "2023-04-01T00:00:00Z",
                        "DownTimeHours": 2,
                        "DownTimeMinutes": 30,
                        "Message": "Performing server maintenance.",
                        "Recurring": true,
                        "RecurEvery": "w",
                        "RecurEndDateTime": "2023-05-01T00:00:00Z",
                        "RecurEveryNum": 1,
                        "Monitors": "1,2,3"
                }

Delete scheduled maintenance

Endpoint: DELETE /scheduledmaintenance/{id}

Headers: X-API-Key: your-api-key

Request sample:

curl -X DELETE "https://api.legituptime.com/v1/scheduledmaintenance/{id}" -H "X-API-Key: your-api-key"

Response sample:

{ "Success": true }