### GET /v1/ssl Source: https://developers.statuscake.com/api/index Retrieves a list of SSL checks with optional pagination parameters. ```APIDOC ## GET /v1/ssl ### Description Retrieves a list of SSL checks with optional pagination parameters. ### Method GET ### Endpoint https://api.statuscake.com/v1/ssl ### Parameters #### Query Parameters - **page** (integer) - Optional - Default: 1 - Page of results. - **limit** (integer) - Optional - Default: 25 - The number of SSL checks to return per page. Must be between 1 and 100. ### Request Example ```bash curl https://api.statuscake.com/v1/ssl?page=1&limit=25 \ -H "Authorization: Bearer ${API_TOKEN}" ``` ### Response #### Success Response (200) - **data** (Array of objects) - List of SSL checks. - **metadata** (object) - Pagination information. #### Response Example ```json { "data": [ { "id": "123", "website_url": "https://www.example.com", "check_rate": 1800, "alert_at": [ 1, 7, 30 ], "alert_broken": true, "alert_expiry": true, "alert_mixed": true, "alert_reminder": true, "certificate_score": 55, "certificate_status": "CERT_OK", "cipher": "TLS_RSA_WITH_AES_128_GCM_SHA256", "cipher_score": 70, "contact_groups": [ "1", "2", "3" ], "issuer_common_name": "Let's Encrypt Authority X3", "flags": { "follow_redirects": true, "has_mixed": true, "has_pfs": true, "is_broken": false, "is_expired": false, "is_extended": true, "is_missing": false, "is_revoked": false }, "follow_redirects": true, "hostname": "svc.example.com", "last_reminder": 0, "mixed_content": [ { "src": "http://www.example.com/public/images/teapot.png", "type": "img" }, { "src": "http://www.example.com/public/css/style.css", "type": "link" } ], "paused": false, "updated_at": "2017-10-24T09:02:25+00:00", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36 Edg/86.0.622.51 mycustomstring", "valid_from": "2017-10-10T14:06:00+00:00", "valid_until": "2017-12-29T00:00:00+00:00" } ], "metadata": { "page": 1, "per_page": 25, "page_count": 10, "total_count": 230 } } ``` ``` -------------------------------- ### Get all maintenance windows Source: https://developers.statuscake.com/api/index Returns a list of maintenance windows for an account. Supports pagination and filtering by state. ```APIDOC ## GET /v1/maintenance-windows ### Description Returns a list of maintenance windows for an account. ### Method GET ### Endpoint https://api.statuscake.com/v1/maintenance-windows ### Parameters #### Query Parameters - **page** (integer) - Optional - Default: 1 - Page of results. - **limit** (integer) - Optional - Default: 25 - The number of maintenance windows to return per page. Must be between 1 and 100. - **state** (string) - Optional - Enum: "active", "paused", "pending" - Maintenance window state. ### Response #### Success Response (200) - **data** (array of objects) - List of maintenance windows. - **metadata** (object) - Pagination details. #### Response Example ```json { "data": [ { "id": "123", "name": "Weekends", "end_at": "2020-10-25T23:59:59+00:00", "repeat_interval": "1w", "start_at": "2020-10-24T00:00:00+00:00", "state": "active", "tags": [ "tag1", "tag2" ], "tests": [ "1", "2", "3", "4" ], "timezone": "UTC" } ], "metadata": { "page": 1, "per_page": 25, "page_count": 10, "total_count": 230 } } ``` ``` -------------------------------- ### Get All Pagespeed Checks Request Sample (cURL) Source: https://developers.statuscake.com/api/index This cURL command retrieves a list of all pagespeed checks associated with an account. It sends a GET request to the pagespeed endpoint, requiring an authorization token. ```curl curl https://api.statuscake.com/v1/pagespeed \ -H "Authorization: Bearer ${API_TOKEN}" ``` -------------------------------- ### JSON Response Sample - Get All Maintenance Windows (200 OK) Source: https://developers.statuscake.com/api/index A sample JSON response for a successful retrieval of all maintenance windows. It contains a 'data' array with maintenance window objects and a 'metadata' object for pagination information. ```json { "data": [ { "id": "123", "name": "Weekends", "end_at": "2020-10-25T23:59:59+00:00", "repeat_interval": "1w", "start_at": "2020-10-24T00:00:00+00:00", "state": "active", "tags": [ "tag1", "tag2" ], "tests": [ "1", "2", "3", "4" ], "timezone": "UTC" } ], "metadata": { "page": 1, "per_page": 25, "page_count": 10, "total_count": 230 } } ``` -------------------------------- ### GET /v1/uptime Source: https://developers.statuscake.com/api/index Retrieves a list of all uptime checks for an account, with options to filter by status, pagination, tags, and more. ```APIDOC ## GET /v1/uptime ### Description Retrieves a list of uptime checks associated with the account. Supports filtering by status, pagination, and tags. ### Method GET ### Endpoint /v1/uptime ### Parameters #### Query Parameters - **status** (string) - Optional - Enum: "down" "up" - Filters checks by their current status. - **page** (integer) - Optional - >= 1 - The page number of results to retrieve. Defaults to 1. - **limit** (integer) - Optional - [1 .. 100] - The number of uptime checks to return per page. Defaults to 25. - **tags** (string) - Optional - Comma-separated list of tags to filter checks by. - **matchany** (boolean) - Optional - If present, returns checks matching any of the specified tags; otherwise, matches all tags. This parameter does not take a value; its presence indicates `true`. - **nouptime** (boolean) - Optional - If present, uptime percentages are not calculated for the results. This parameter does not take a value; its presence indicates `true`. ### Response #### Success Response (200) - **data** (array of objects) - Required - A list of uptime check objects. - **id** (string) - The ID of the uptime check. - **name** (string) - The name of the uptime check. - **website_url** (string) - The URL being checked. - **test_type** (string) - The type of test (e.g., "HTTP"). - **check_rate** (integer) - The interval in seconds for checks. - **contact_groups** (array of strings) - List of contact group IDs. - **paused** (boolean) - Indicates if the check is paused. - **status** (string) - The current status of the check ("up" or "down"). - **tags** (array of strings) - List of tags associated with the check. - **uptime** (number) - The calculated uptime percentage. - **metadata** (object) - Required - Pagination information. - **page** (integer) - The current page number. - **per_page** (integer) - The number of items per page. - **page_count** (integer) - The total number of pages. - **total_count** (integer) - The total number of uptime checks. #### Error Response (default) - **message** (string) - Description of the error. - **errors** (object) - Object containing field-specific errors. - **field_name** (array of strings) - List of error messages for a specific field. ``` -------------------------------- ### Get All Maintenance Windows (cURL) Source: https://developers.statuscake.com/api/index Retrieves a list of all maintenance windows for an account using a cURL request. It includes an Authorization header for authentication. ```bash curl https://api.statuscake.com/v1/maintenance-windows \ -H "Authorization: Bearer ${API_TOKEN}" ``` -------------------------------- ### Get Uptime Check History (cURL) Source: https://developers.statuscake.com/api/index This snippet illustrates how to retrieve the historical performance data for a specific uptime check using cURL. It includes the GET request, the endpoint with the test ID, and the authorization header. Optional query parameters for limiting results and filtering by time are also supported. ```bash curl https://api.statuscake.com/v1/uptime/123/history \ -H "Authorization: Bearer ${API_TOKEN}" ``` -------------------------------- ### GET /contact-groups Source: https://developers.statuscake.com/api/index Retrieves a list of all contact groups configured for an account. The results are paginated. ```APIDOC ## GET /contact-groups ### Description Returns a list of contact groups for an account. The returned results are a paginated series. ### Method GET ### Endpoint `/v1/contact-groups` ### Parameters #### Query Parameters - **page** (integer) - Optional - Page of results. Default: 1. Must be >= 1. - **limit** (integer) - Optional - The number of contact groups to return per page. Default: 25. Range: [1 .. 100] ### Response #### Success Response (200) - **data** (Array of objects) - Required - List of contact groups. - **metadata** (object) - Required - Pagination details. #### Response Example ```json { "data": [ { "id": "1", "name": "Default", "alert_ids": [1, 2, 3] } ], "metadata": { "pagination": { "total_pages": 1, "current_page": 1, "per_page": 25, "total_items": 1 } } } ``` ``` -------------------------------- ### Get Maintenance Window by ID (cURL) Source: https://developers.statuscake.com/api/index Retrieves a specific maintenance window by its ID using a cURL GET request. The window_id is included as a path parameter in the URL. ```bash curl https://api.statuscake.com/v1/maintenance-windows/{window_id} ``` -------------------------------- ### GET /v1/uptime-locations Source: https://developers.statuscake.com/api/index Retrieves a list of all uptime monitoring locations, including server details. ```APIDOC ## GET /v1/uptime-locations ### Description Retrieves a list of all uptime monitoring locations, including server details. This information can be used to create further checks using the API. ### Method GET ### Endpoint /v1/uptime-locations ### Parameters #### Query Parameters - **region_code** (string) - Optional - Filters locations by a specific server region code. ### Request Example ```curl curl https://api.statuscake.com/v1/uptime-locations \ -H "Authorization: Bearer ${API_TOKEN}" ``` ### Response #### Success Response (200) - **data** (array of objects) - A list of monitoring locations. - **description** (string) - A description of the server location. - **ipv4** (string) - The IPv4 address of the server. - **ipv6** (string) - The IPv6 address of the server. - **region** (string) - The region of the server. - **region_code** (string) - The code for the server region. - **status** (string) - The status of the server (Enum: "down", "up"). #### Response Example ```json { "data": [ { "description": "United Kingdom, London - 5", "ipv4": "178.62.78.199", "ipv6": "2a03:b0c0:1:d0::5e:f001", "region": "United Kingdom / London", "region_code": "london", "status": "up" } ] } ``` ``` -------------------------------- ### Get All Uptime Monitoring Locations (cURL, Go) Source: https://developers.statuscake.com/api/index Retrieves a list of all available uptime monitoring locations. This data includes server descriptions, IPv4/IPv6 addresses, region information, and status. An API token is necessary for access. ```curl curl https://api.statuscake.com/v1/uptime-locations \ -H "Authorization: Bearer ${API_TOKEN}" ``` -------------------------------- ### Get Maintenance Window Details (cURL, Go) Source: https://developers.statuscake.com/api/index Retrieves the details of a specific maintenance window using its ID. Requires an API token for authorization. The response includes the maintenance window's configuration. ```curl curl https://api.statuscake.com/v1/maintenance-windows/123 \ -H "Authorization: Bearer ${API_TOKEN}" ``` -------------------------------- ### GET /v1/maintenance-windows/{window_id} Source: https://developers.statuscake.com/api/index Retrieves details of a specific maintenance window by its ID. ```APIDOC ## GET /v1/maintenance-windows/{window_id} ### Description Retrieves details of a specific maintenance window by its ID. ### Method GET ### Endpoint /v1/maintenance-windows/{window_id} ### Parameters #### Path Parameters - **window_id** (string) - Required - The ID of the maintenance window to retrieve. ### Request Example ```curl curl https://api.statuscake.com/v1/maintenance-windows/123 \ -H "Authorization: Bearer ${API_TOKEN}" ``` ### Response #### Success Response (200) - **data** (object) - Contains the maintenance window details. - **id** (string) - The ID of the maintenance window. - **name** (string) - The name of the maintenance window. - **end_at** (string) - The end date and time of the maintenance window (RFC3339 format). - **repeat_interval** (string) - How often the maintenance window should occur (e.g., "1w"). - **start_at** (string) - The start date and time of the maintenance window (RFC3339 format). - **state** (string) - The current state of the maintenance window (e.g., "active"). - **tags** (array of strings) - List of tags associated with the maintenance window. - **tests** (array of strings) - List of uptime check IDs included in the maintenance window. - **timezone** (string) - The timezone associated with the maintenance window. #### Response Example ```json { "data": { "id": "123", "name": "Weekends", "end_at": "2020-10-25T23:59:59+00:00", "repeat_interval": "1w", "start_at": "2020-10-24T00:00:00+00:00", "state": "active", "tags": [ "tag1", "tag2" ], "tests": [ "1", "2", "3", "4" ], "timezone": "UTC" } } ``` ``` -------------------------------- ### GET /v1/pagespeed-locations Source: https://developers.statuscake.com/api/index Retrieves a list of all pagespeed monitoring locations. ```APIDOC ## GET /v1/pagespeed-locations ### Description Retrieves a list of locations detailing server information for pagespeed monitoring servers. This information can be used to create further checks using the API. ### Method GET ### Endpoint /v1/pagespeed-locations ### Parameters #### Query Parameters - **location** (string) - Optional - Filters locations by a 2-letter ISO 3166-1 country code. ### Response #### Success Response (200) OK #### Response Example (No specific example provided in the source text for this endpoint's success response body.) ``` -------------------------------- ### Create Maintenance Window (cURL) Source: https://developers.statuscake.com/api/index Creates a new maintenance window using a cURL POST request. The request body includes parameters such as name, start and end times, repeat interval, tags, and timezone. ```bash curl -X POST https://api.statuscake.com/v1/maintenance-windows \ -H "Authorization: Bearer ${API_TOKEN}" \ -d "name=Weekends&start_at=2021-12-06T01:30:00Z&end_at=2021-07-11T06:00:00Z&repeat_interval=1w&tags[]=production&timezone=UTC" ``` -------------------------------- ### GET /v1/ssl/{test_id} Source: https://developers.statuscake.com/api/index Retrieves a specific SSL check by its ID. ```APIDOC ## GET /v1/ssl/{test_id} ### Description Returns an SSL check with the given ID. ### Method GET ### Endpoint https://api.statuscake.com/v1/ssl/{test_id} ### Parameters #### Path Parameters - **test_id** (string) - Required - SSL check ID. ### Request Example ```bash curl https://api.statuscake.com/v1/ssl/123 \ -H "Authorization: Bearer ${API_TOKEN}" ``` ### Response #### Success Response (200) - **data** (object) - Details of the requested SSL check. #### Response Example ```json { "data": { "id": "123", "website_url": "https://www.example.com", "check_rate": 1800, "alert_at": [ 1, 7, 30 ], "alert_broken": true, "alert_expiry": true, "alert_mixed": true, "alert_reminder": true, "certificate_score": 55, "certificate_status": "CERT_OK", "cipher": "TLS_RSA_WITH_AES_128_GCM_SHA256", "cipher_score": 70, "contact_groups": [ "1", "2", "3" ], "issuer_common_name": "Let's Encrypt Authority X3", "flags": { "follow_redirects": true, "has_mixed": true, "has_pfs": true, "is_broken": false, "is_expired": false, "is_extended": true, "is_missing": false, "is_revoked": false }, "follow_redirects": true, "hostname": "svc.example.com", "last_reminder": 0, "mixed_content": [ { "src": "http://www.example.com/public/images/teapot.png", "type": "img" }, { "src": "http://www.example.com/public/css/style.css", "type": "link" } ], "paused": false, "updated_at": "2017-10-24T09:02:25+00:00", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36 Edg/86.0.622.51 mycustomstring", "valid_from": "2017-10-10T14:06:00+00:00", "valid_until": "2017-12-29T00:00:00+00:00" } } ``` ``` -------------------------------- ### Get SSL Check Details Source: https://developers.statuscake.com/api/index Retrieves the details of a specific SSL check using its ID. ```APIDOC ## GET /v1/ssl/{test_id} ### Description Retrieves the details of a specific SSL check. ### Method GET ### Endpoint /v1/ssl/{test_id} #### Path Parameters - **test_id** (string) - Required - SSL check ID ### Request Example ```bash curl https://api.statuscake.com/v1/ssl/123 \ -H "Authorization: Bearer ${API_TOKEN}" ``` ### Response #### Success Response (200) - **data** (object) - Contains the SSL check details. - **id** (string) - SSL check ID - **website_url** (string) - URL of the server under test - **check_rate** (integer) - Number of seconds between checks - **alert_at** (array of integers) - List representing when alerts should be sent (days) - **alert_broken** (boolean) - Whether to enable alerts for SSL certificate issues - **alert_expiry** (boolean) - Whether to enable alerts for SSL certificate expiry - **alert_mixed** (boolean) - Whether to enable alerts for mixed content - **alert_reminder** (boolean) - Whether to enable alert reminders - **certificate_score** (integer) - SSL certificate score (%) - **certificate_status** (string) - SSL certificate status - **cipher** (string) - SSL/TLS cipher suite - **cipher_score** (integer) - SSL certificate cipher strength (%) - **contact_groups** (array of strings) - List of contact group IDs - **issuer_common_name** (string) - Issuer of the SSL certificate - **flags** (object) - Flags related to the SSL check - **follow_redirects** (boolean) - Whether to follow redirects - **hostname** (string) - Hostname of the server under test - **last_reminder** (integer) - The last reminder sent (days) - **mixed_content** (array of objects) - List of mixed content resources - **paused** (boolean) - Whether the check is paused - **updated_at** (string) - When the SSL certificate was last updated (RFC3339 format) - **user_agent** (string) - Custom user agent string - **valid_from** (string) - SSL certificate validity start (RFC3339 format) - **valid_until** (string) - SSL certificate validity end (RFC3339 format) #### Response Example ```json { "data": { "id": "123", "website_url": "https://www.example.com", "check_rate": 1800, "alert_at": [ 1, 7, 30 ], "alert_broken": true, "alert_expiry": true, "alert_mixed": true, "alert_reminder": true, "certificate_score": 55, "certificate_status": "CERT_OK", "cipher": "TLS_RSA_WITH_AES_128_GCM_SHA256", "cipher_score": 70, "contact_groups": [ "1", "2", "3" ], "issuer_common_name": "Let's Encrypt Authority X3", "flags": { "follow_redirects": true, "has_mixed": true, "has_pfs": true, "is_broken": false, "is_expired": false, "is_extended": true, "is_missing": false, "is_revoked": false }, "follow_redirects": true, "hostname": "svc.example.com", "last_reminder": 0, "mixed_content": [ { "src": "http://www.example.com/public/images/teapot.png", "type": "img" }, { "src": "http://www.example.com/public/css/style.css", "type": "link" } ], "paused": false, "updated_at": "2017-10-24T09:02:25+00:00", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36 Edg/86.0.622.51 mycustomstring", "valid_from": "2017-10-10T14:06:00+00:00", "valid_until": "2017-12-29T00:00:00+00:00" } } ``` ``` -------------------------------- ### Get all pagespeed checks Source: https://developers.statuscake.com/api/index Retrieves a list of all pagespeed checks associated with the account. Supports pagination to manage large result sets. ```APIDOC ## GET /pagespeed ### Description Returns a list of pagespeed checks for an account. ### Method GET ### Endpoint https://api.statuscake.com/v1/pagespeed ### Parameters #### Query Parameters - **page** (integer) - Optional - Page of results. Must be greater than or equal to 1. Defaults to 1. - **limit** (integer) - Optional - The number of pagespeed checks to return per page. Must be between 1 and 100. Defaults to 25. ### Response #### Success Response (200) - **data** (Array of objects) - List of pagespeed checks. - **id** (string) - The unique identifier for the pagespeed check. - **name** (string) - The name of the pagespeed check. - **website_url** (string) - The URL being checked. - **check_rate** (integer) - The interval in seconds at which the check is performed. - **alert_bigger** (integer) - Threshold for alert when a metric is bigger than this value. - **alert_slower** (integer) - Threshold for alert when a metric is slower than this value. - **alert_smaller** (integer) - Threshold for alert when a metric is smaller than this value. - **contact_groups** (Array of strings) - List of contact group IDs associated with the check. - **latest_stats** (object) - Contains the latest statistics for the check. - **loadtime** (integer) - The time it took to load the page in milliseconds. - **filesize** (number) - The size of the page in KB. - **requests** (integer) - The number of requests made to load the page. - **has_issue** (boolean) - Indicates if there was an issue with the latest check. - **latest_issue** (string) - A description of the latest issue encountered. - **location** (string) - The location from which the check was performed. - **paused** (boolean) - Indicates if the check is currently paused. - **metadata** (object) - Pagination information. - **page** (integer) - The current page number. - **per_page** (integer) - The number of items per page. - **page_count** (integer) - The total number of pages. - **total_count** (integer) - The total number of items. #### Error Response (default) - **message** (string) - Description of the error - **errors** (object) - Object containing field-specific errors - **field_name** (Array of strings) - List of error messages for the field ### Request Example ```curl curl https://api.statuscake.com/v1/pagespeed \ -H "Authorization: Bearer ${API_TOKEN}" ``` ``` -------------------------------- ### Get All Contact Groups (cURL) Source: https://developers.statuscake.com/api/index Retrieves a list of contact groups configured for an account. Supports pagination with 'page' and 'limit' query parameters. The response includes a list of contact groups and pagination metadata. ```bash curl https://api.statuscake.com/v1/contact-groups \ -H "Authorization: Bearer ${API_TOKEN}" ``` -------------------------------- ### Pagespeed Check History Response (JSON) Source: https://developers.statuscake.com/api/index Example JSON response for retrieving Pagespeed check history. It includes 'data' with historical run details, 'links' for pagination, and 'metadata' with aggregated statistics like min, max, and average filesize and loadtime. ```json { "data": [ { "created_at": "2017-11-04T11:58:23+00:00", "filesize": 169.342, "har_location": "https://16a0fd6b5b5bece1d29a-7aa19249e604542958e6a694f67d0bbf.ssl.cf5.rackcdn.com/b8f1cc4f-d6f0-495b-a478-7577d174f9fe.json", "loadtime": 361, "requests": 9, "throttling": "4G" } ], "links": { "self": "https://api.statuscake.com/v1/pagespeed/1/history?before=1509796803", "next": "https://api.statuscake/com/v1/pagespeed/1/history?before=1509796703" }, "metadata": { "aggregates": { "filesize": { "min": 8, "max": 9, "avg": 8.129 }, "loadtime": { "min": 162, "max": 3344, "avg": 410.292 }, "requests": { "min": 160, "max": 169, "avg": 161.654 } } } ``` -------------------------------- ### Get All Uptime Checks (cURL) Source: https://developers.statuscake.com/api/index Retrieves a list of all uptime checks associated with an account. Authentication is required. Optional query parameters can filter results by status, page, limit, tags, and matching logic. ```cURL curl https://api.statuscake.com/v1/uptime \ -H "Authorization: Bearer ${API_TOKEN}" ``` -------------------------------- ### Retrieve SSL Check by ID (Go) Source: https://developers.statuscake.com/api/index This Go code snippet demonstrates how to retrieve a specific SSL check by its ID. It utilizes the `net/http` package to make a GET request to the API endpoint. The function expects the API token and the test ID as input and returns the SSL check data or an error. ```Go package main import ( "fmt" "io/ioutil" "net/http" "strings" ) func getSSLCheck(apiToken string, testID string) (string, error) { url := fmt.Sprintf("https://api.statuscake.com/v1/ssl/%s", testID) req, err := http.NewRequest("GET", url, nil) if err != nil { return "", err } req.Header.Add("Authorization", "Bearer "+apiToken) client := &http.Client{} res, err := client.Do(req) if err != nil { return "", err } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { return "", err } if res.StatusCode != http.StatusOK { return "", fmt.Errorf("API returned status code %d: %s", res.StatusCode, string(body)) } return string(body), nil } func main() { // Replace with your actual API token and test ID apiToken := "YOUR_API_TOKEN" testID := "YOUR_TEST_ID" sslCheckData, err := getSSLCheck(apiToken, testID) if err != nil { fmt.Printf("Error retrieving SSL check: %v\n", err) return } fmt.Println("SSL Check Data:") fmt.Println(sslCheckData) } ``` -------------------------------- ### GET /uptime/{test_id}/alerts Source: https://developers.statuscake.com/api/index Retrieves a list of uptime check alerts for a specified test ID. Results are paginated and include alert details. A 'links' object provides navigation for pagination. ```APIDOC ## GET /uptime/{test_id}/alerts ### Description Returns a list of uptime check alerts for a given id. The returned results are a paginated series. Alongside the response data is a `links` object referencing the current response document, `self`, and the next page in the series, `next`. ### Method GET ### Endpoint `/v1/uptime/{test_id}/alerts` ### Parameters #### Path Parameters - **test_id** (string) - Required - Uptime check ID #### Query Parameters - **limit** (integer) - Optional - The number of uptime alerts to return per page. Default: 25. Range: [1 .. 100] - **before** (integer) - Optional - Only alerts triggered before this UNIX timestamp will be returned. Must be >= 0. - **after** (integer) - Optional - Only alerts triggered after this UNIX timestamp will be returned. Must be >= 0. ### Response #### Success Response (200) - **data** (Array of objects) - Required - List of uptime check alerts. - **links** (object) - Required - Navigation links for pagination. #### Response Example ```json { "data": [ { "id": "123", "status": "down", "status_code": 404, "triggered_at": "2013-02-25T14:42:41+00:00" } ], "links": { "self": "https://api.statuscake.com/v1/uptime/1/alerts?before=1361803461", "next": "https://api.statuscake.com/v1/uptime/1/alerts?before=1361803361" } } ``` ``` -------------------------------- ### Get All Pagespeed Checks Response Sample (JSON) Source: https://developers.statuscake.com/api/index This JSON response contains a list of pagespeed checks and pagination metadata. Each check includes details like ID, name, URL, check rate, alert thresholds, contact groups, latest statistics, location, and paused status. ```json { "data": [ { "id": "123", "name": "Example", "website_url": "https://www.example.com", "check_rate": 1800, "alert_bigger": 0, "alert_slower": 0, "alert_smaller": 0, "contact_groups": [ "1", "2", "3" ], "latest_stats": { "loadtime": 209, "filesize": 160.513, "requests": 5, "has_issue": true, "latest_issue": "The Total Load Time of the Page (4841/ms) is longer than the alert\nthreshold of 0/ms" }, "location": "PAGESPD-UK5", "paused": false } ], "metadata": { "page": 1, "per_page": 25, "page_count": 10, "total_count": 230 } } ``` -------------------------------- ### GET /uptime/{test_id}/periods Source: https://developers.statuscake.com/api/index Retrieves a list of uptime check periods for a specified test ID. Results are paginated and include creation time, end time, and duration. A 'links' object provides navigation for pagination. ```APIDOC ## GET /uptime/{test_id}/periods ### Description Returns a list of uptime check periods for a given id, detailing the creation time of the period, when it ended and the duration. The returned results are a paginated series. Alongside the response data is a `links` object referencing the current response document, `self`, and the next page in the series, `next`. ### Method GET ### Endpoint `/v1/uptime/{test_id}/periods` ### Parameters #### Path Parameters - **test_id** (string) - Required - Uptime check ID #### Query Parameters - **limit** (integer) - Optional - The number of uptime check periods to return per page. Default: 25. Range: [1 .. 100] - **before** (integer) - Optional - Only check periods created before this UNIX timestamp will be returned. Must be >= 0. - **after** (integer) - Optional - Only check periods created after this UNIX timestamp will be returned. Must be >= 0. ### Response #### Success Response (200) - **data** (Array of objects) - Required - List of uptime check periods. - **links** (object) - Required - Navigation links for pagination. #### Response Example ```json { "data": [ { "created_at": "2017-11-04T11:58:23+00:00", "location": "UKCON2", "performance": 579, "status_code": 200 } ], "links": { "self": "https://api.statuscake.com/v1/uptime/1/history?before=1509796803", "next": "https://api.statuscake.com/v1/uptime/1/history?before=1509796703" } } ``` ``` -------------------------------- ### Create a maintenance window Source: https://developers.statuscake.com/api/index Creates a maintenance window with the given parameters. Requires either tags or tests to be specified. ```APIDOC ## POST /v1/maintenance-windows ### Description Creates a maintenance window with the given parameters. ### Method POST ### Endpoint https://api.statuscake.com/v1/maintenance-windows ### Parameters #### Request Body - **name** (string) - Required - Name of the maintenance window. - **end_at** (string) - Required - End of the maintenance window (RFC3339 format). - **repeat_interval** (string) - Optional - Enum: "never", "1d", "1w", "2m", "1m" - How often the maintenance window should occur. - **start_at** (string) - Required - Start of the maintenance window (RFC3339 format). - **tags** (array of strings) - Optional - List of tags used to include matching uptime checks in this maintenance window. At least one of `tests` and `tags` must be present. - **tests** (array of strings) - Optional - List of uptime check IDs explicitly included in this maintenance window. At least one of `tests` and `tags` must be present. - **timezone** (string) - Required - Standard timezone associated with this maintenance window. ### Request Example ``` curl -X POST https://api.statuscake.com/v1/maintenance-windows \ -H "Authorization: Bearer ${API_TOKEN}" \ -d "name=Weekends&start_at=2021-12-06T01:30:00Z&end_at=2021-07-11T06:00:00Z&repeat_interval=1w&tags[]=production&timezone=UTC" ``` ### Response #### Success Response (201) - **data** (object) - Contains the new ID of the created maintenance window. #### Response Example ```json { "data": { "new_id": "123" } } ``` ``` -------------------------------- ### JSON Response Sample - Create Maintenance Window (201 Created) Source: https://developers.statuscake.com/api/index A sample JSON response indicating successful creation of a maintenance window. It returns a 'data' object containing the 'new_id' of the created maintenance window. ```json { "data": { "new_id": "123" } } ``` -------------------------------- ### Create SSL Check (Go) Source: https://developers.statuscake.com/api/index This Go code snippet demonstrates how to create a new SSL check using the StatusCake API. It constructs a POST request with the necessary form data, including website URL, check rate, and alert configurations. The function returns the ID of the newly created check or an error. ```Go package main import ( "fmt" "io/ioutil" "net/http" "net/url" "strings" ) func createSSLCheck(apiToken string, websiteURL string, checkRate int, alertAt []string, alertReminder bool, alertExpiry bool, alertBroken bool, alertMixed bool) (string, error) { url := "https://api.statuscake.com/v1/ssl" formData := url.Values{} formData.Set("website_url", websiteURL) formData.Set("check_rate", fmt.Sprintf("%d", checkRate)) for _, day := range alertAt { formData.Add("alert_at[]", day) } formData.Set("alert_reminder", fmt.Sprintf("%t", alertReminder)) formData.Set("alert_expiry", fmt.Sprintf("%t", alertExpiry)) formData.Set("alert_broken", fmt.Sprintf("%t", alertBroken)) formData.Set("alert_mixed", fmt.Sprintf("%t", alertMixed)) req, err := http.NewRequest("POST", url, strings.NewReader(formData.Encode())) if err != nil { return "", err } req.Header.Add("Authorization", "Bearer "+apiToken) req.Header.Add("Content-Type", "application/x-www-form-urlencoded") client := &http.Client{} res, err := client.Do(req) if err != nil { return "", err } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { return "", err } if res.StatusCode != http.StatusCreated { return "", fmt.Errorf("API returned status code %d: %s", res.StatusCode, string(body)) } // Assuming the response for creation is JSON with a "data" object containing "new_id" // You would typically parse this JSON to extract the new_id return string(body), nil // Returning the raw body for simplicity, parse as needed } func main() { // Replace with your actual API token apiToken := "YOUR_API_TOKEN" websiteURL := "https://www.example.com" checkRate := 1800 alertAt := []string{"1", "7", "30"} alertReminder := true alertExpiry := true alertBroken := true alertMixed := false newID, err := createSSLCheck(apiToken, websiteURL, checkRate, alertAt, alertReminder, alertExpiry, alertBroken, alertMixed) if err != nil { fmt.Printf("Error creating SSL check: %v\n", err) return } fmt.Printf("Successfully created SSL check. Response: %s\n", newID) } ``` -------------------------------- ### GET /contact-groups/{group_id} Source: https://developers.statuscake.com/api/index Retrieves a specific contact group by its ID. ```APIDOC ## GET /contact-groups/{group_id} ### Description Returns a contact group with the given id. ### Method GET ### Endpoint https://api.statuscake.com/v1/contact-groups/{group_id} ### Parameters #### Path Parameters - **group_id** (string) - Required - Contact group ID ### Request Example ```curl curl https://api.statuscake.com/v1/contact-groups/123 \ -H "Authorization: Bearer ${API_TOKEN}" ``` ### Response #### Success Response (200) - **data** (object) - The contact group object - **id** (string) - Contact group ID - **name** (string) - Name of the contact group - **email_addresses** (array of strings) - List of email addresses - **integrations** (array of strings) - List of configured integration IDs - **mobile_numbers** (array of strings) - List of international format mobile phone numbers - **ping_url** (string) - URL or IP address of an endpoint to push uptime events. #### Response Example ```json { "data": { "id": "123", "name": "Operations Team", "email_addresses": [ "johnsmith@example.com", "janesmith@example.com" ], "integrations": [ "1", "2", "3" ], "mobile_numbers": [ "447712345678", "447987462344" ], "ping_url": "https://www.example.com/notifications" } } ``` ``` -------------------------------- ### Create Uptime Check (Go) Source: https://developers.statuscake.com/api/index This Go code snippet illustrates how to create an uptime check via the StatusCake API. It constructs a POST request with necessary headers and form data, handling potential errors and responses. ```go package main import ( "fmt" "net/http" "strings" ) func main() { url := "https://api.statuscake.com/v1/uptime" payload := strings.NewReader("name=Example%20HTTP&test_type=HTTP&website_url=https://www.example.com&check_rate=1800®ions[]=london®ions[]=paris") req, err := http.NewRequest("POST", url, payload) if err != nil { panic(err) } req.Header.Add("Authorization", "Bearer ${API_TOKEN}") req.Header.Add("Content-Type", "application/x-www-form-urlencoded") client := &http.Client{} res, err := client.Do(req) if err != nil { panic(err) } defer res.Body.Close() fmt.Println(res) } ```