Skip to main content

Use API Source

Use the API source to trigger alerts by simply sending an HTTPS API request.

Requirements

  • A system able to send HTTPS API requests.
  • A subscription plan that includes this feature, see the pricing page for it.

Setup

1. Retrieve your API Key

Before you can send alerts, you must retrieve your API key.

  1. Log in to the AlertFleet website
  2. Go to the Subscription page
  3. In the API Source section, get the API Key value

2. Generate the trigger API request

Perform an API request as described below.

URL

https://api-source.alertfleet.com/api/v1/send

Method

POST

Headers

Authorization: Api-Key {YOUR API KEY}
Content-Type: application/json

Body (JSON)

FieldTypeRequiredDescription
levelstringYesAlert level (e.g., Info, Warning, Danger)
messagestringYesMessage to be sent
smsarray of stringsNoList of phone numbers to notify via SMS (E.164 format)
whatsapparray of stringsNoList of phone numbers to notify via WhatsApp (E.164 format)
emailarray of stringsNoList of email addresses to notify
webhookarray of objectsNoList of webhook calls to perform. Each object must include method and url

Each webhook object has the following fields:

FieldTypeRequiredDescription
methodstringYesHTTP method to use (e.g., POST, GET)
urlstringYesEncoded URL to call

Example of a trigger API request's body

{
"level": "info",
"message": "This is a sample notification's message sent with AlertFleet",
"sms": ["+393333333331", "+393333333332", "+393333333333", "+393333333334"],
"whatsapp": ["+393333333331", "+393333333332", "+393333333333"],
"email": ["receiver1@sample.com", "receiver2@sample.com"],
"webhook": [
{ "method": "POST", "url": "https://sample.com/hook1" },
{ "method": "GET", "url": "https://sample.com/hook?param=1" }
]
}
warning

You can send up to 250 API requests in 24 hours.

Common errors

Missing api key:

{
"message": "Error in Authorization header"
}

Invalid api key:

{
"message": "Invalid API Key",
"reason": "Missing or invalid API key"
}

Invalid level field:

{
"message": "Error in request body",
"details": [
"\"level\" must be one of [info, warning, danger]"
]
}

Empty recipient fields (sms,whatsapp,email,webhook):

{
"message": "Error in request body",
"details": [
"\"sms[0]\" is not allowed to be empty"
]
}