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.
- Log in to the AlertFleet website
- Go to the
Subscription
page - 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)
Field | Type | Required | Description |
---|---|---|---|
level | string | Yes | Alert level (e.g., Info , Warning , Danger ) |
message | string | Yes | Message to be sent |
sms | array of strings | No | List of phone numbers to notify via SMS (E.164 format) |
whatsapp | array of strings | No | List of phone numbers to notify via WhatsApp (E.164 format) |
email | array of strings | No | List of email addresses to notify |
webhook | array of objects | No | List of webhook calls to perform. Each object must include method and url |
Each webhook object has the following fields:
Field | Type | Required | Description |
---|---|---|---|
method | string | Yes | HTTP method to use (e.g., POST , GET ) |
url | string | Yes | Encoded 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"
]
}