Skip to Content
API ReferenceEmail Alerts

Email Alerts

Read and change the account’s email alert settings, and send a test email. These settings are account-wide: they apply to every check.

All three endpoints need an unrestricted key. A key restricted to checks or folders gets 403, because a recipient added here would receive alerts for checks outside the key’s grant.

Events

The events field takes these values:

EventSent when
website_downA check goes down
website_upA check recovers
website_errorA check returns an error
ssl_errorA certificate is invalid or expired
ssl_warningA certificate is close to expiry
domain_expiringA domain is close to expiry
domain_expiredA domain has expired
domain_renewedA domain was renewed

See Alert Events for what each one means. Unknown values are dropped.

Get Email Settings

Required scope: alerts:read

GET /v1/public/alerts/email

200 OK

{ "data": { "enabled": true, "recipients": ["ops@example.com", "oncall@example.com"], "events": ["website_down", "website_up"], "emailFormat": "html", "updatedAt": 1736985600000 } }

If email alerts were never set up, data is null.

Update Email Settings

Required scope: alerts:write

PATCH /v1/public/alerts/email

Send only the fields you want to change.

FieldTypeDescription
recipientsstring[]1 to 10 email addresses. Replaces the current list. Duplicates are removed
eventsstring[]Which events send an email. Replaces the current list
enabledbooleanSwitch email alerts on or off
emailFormatstringhtml or text

The first call, when no settings exist yet, must include recipients. events then defaults to ["website_down", "website_up"] and enabled to true.

200 OK

{ "data": { "enabled": true, "recipients": ["ops@example.com"], "events": ["website_down", "website_up", "ssl_warning"], "emailFormat": "html" } }

Send a Test Email

Required scope: alerts:write

POST /v1/public/alerts/email/test

Sends a test email to every recipient. No request body.

200 OK

{ "data": { "delivered": ["ops@example.com"], "message": "Test alert sent to ops@example.com" } }

If a send fails partway, the response is 502 and delivered lists the addresses that did get the email.

Error Responses

StatusDescription
400Invalid field: recipients not an array, more than 10, an invalid address, or empty; no valid events; enabled not a boolean; emailFormat not html or text; or recipients missing on the first call
403Credential missing the required scope, or the key is restricted to checks or folders
404No alerts endpoint matches the method and path
412Test only: no email settings, or no recipients
429Rate limit exceeded
502Test only: sending failed
503Test only: email delivery is not configured on the server

Code Examples

cURL

curl -X PATCH \ -H "X-Api-Key: ek_live_your_key_here" \ -H "Content-Type: application/json" \ -d '{"recipients": ["ops@example.com"], "events": ["website_down", "website_up"]}' \ "https://us-central1-exit1-dev.cloudfunctions.net/publicApi/v1/public/alerts/email" curl -X POST \ -H "X-Api-Key: ek_live_your_key_here" \ "https://us-central1-exit1-dev.cloudfunctions.net/publicApi/v1/public/alerts/email/test"

JavaScript

const response = await fetch( "https://us-central1-exit1-dev.cloudfunctions.net/publicApi/v1/public/alerts/email", { method: "PATCH", headers: { "X-Api-Key": process.env.EXIT1_API_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ recipients: ["ops@example.com"] }), } ); console.log(await response.json());

Python

import os, requests response = requests.patch( "https://us-central1-exit1-dev.cloudfunctions.net/publicApi/v1/public/alerts/email", headers={"X-Api-Key": os.environ["EXIT1_API_KEY"]}, json={"recipients": ["ops@example.com"], "emailFormat": "text"}, ) response.raise_for_status() print(response.json())
Last updated on