Create alert
This endpoint is restricted to authorized users with appropriate permissions.
Create Alert endpoint allows our customers to create alerts that are triggered when one of GenLogs sensors detects a truck that matches the alert criteria, sending the detection results by email or webhook.
Authentication
Include the following headers in your requests:
Access-Token: The access token obtained from the "Create Access Token" endpoint.
x-api-key: The API key provided by GenLogs. This header must be included in the request.
Permissions
Make sure that your API user is created with a role that has the create-alert-endpoint permission.
Endpoint
URL:
https://api.genlogs.io/alertsMethod:
POST
Request Format
All parameters must be sent as JSON in the request body with the Content-Type: application/json header.
Request Body Content
Only email and alert_name are required. Any field not listed here is rejected with a 400.
email (string, required): Email address that receives the alert results. It must belong to a user of your company.
alert_name (string, required): Name of the alert. Cannot be empty.
alert_type (string, optional, default
normal): Type of alert.normal: Also called "Daily Alerts", triggered once per day in the morning.
hot: Triggered every 15 minutes. The number of active hot alerts per user is limited.
disabled (boolean, optional, default
false): Set totrueto create the alert paused.cc_emails (array of strings, optional): Additional email addresses that receive the alert results. Must be an array, even for a single address.
notification_channels (array of strings, optional, default
["EMAIL"]): Channels that receive the alert results:EMAIL,WEBHOOK. Case-insensitive.
Search criteria – at least one of the following fields must have a value:
usdot_number (string, optional): USDOT number of the carrier.
mc_number (string, optional): MC number of the carrier.
license_plate (string, optional): License plate of the vehicle.
vin (string, optional): Last 6 digits of the vehicle identification number.
cab_number (string, optional): Cab number of the vehicle.
equipment_type (string, optional): Equipment type. Allowed values:
BELLY DUMP,BOX TRUCK,CAR HAULER,CARGO TRAILER,CONESTOGA,DAY CAB,DOUBLE PUP,DRY BULK,DRY VAN,DUMP,END DUMP,FIXED GOOSENECK LOWBOY,FLATBED,HIGH TONNAGE TRAILER,HOPPER,HOTSHOT,INTERMODAL,LIVESTOCK TRAILER,LOGGING,LOWBOY RGN,MOFFETT,OTHER,REEFER,SLEEPER CAB,STEP DECK,TANKER,WRECKER. Case-insensitive.trailer_logo (string, optional): Logo displayed on the trailer. Must be one of the values returned by the List logos endpoint.
trailer_number (string, optional): Trailer number.
exact_match_trailer_number (boolean, optional, default
false):truematches the trailer number exactly;falseuses a "contains" search.chassis_number (string, optional): Chassis number.
exact_match_chassis_number (boolean, optional, default
false):truematches the chassis number exactly;falseuses a "contains" search.container_number (string, optional): Container number.
exact_match_container_number (boolean, optional, default
false):truematches the container number exactly;falseuses a "contains" search.deep_search (string, optional): Free-text deep search criteria.
exact_match_deep_search (boolean, optional, default
false):truematches the deep search criteria exactly;falseuses a "contains" search.
Request Example
Response Codes
200 OK: The alert was created.
400 Bad Request: A field is missing, invalid, or not allowed, no search criteria was provided, the trailer logo is not valid, or the hot alert limit was reached.
401 Unauthorized: The Access-Token is missing, invalid, or expired.
403 Forbidden: The API key is missing or invalid, or your user does not have the required permission.
500 Internal Server Error: An issue occurred on the server.
Response Body
id (integer): Unique identifier of the alert.
email (string): Email address that receives the alert results.
cc_emails (array of strings, nullable): Additional email addresses.
alert_name (string): Name of the alert.
alert_type (string):
normalorhot.disabled (boolean): Whether the alert is paused.
notification_channels (array of strings): Channels that receive the alert results, in uppercase.
usdot_number, mc_number, license_plate, vin, cab_number, equipment_type, trailer_logo, trailer_number, chassis_number, container_number, deep_search (string, nullable): Search criteria of the alert.
exact_match_trailer_number, exact_match_chassis_number, exact_match_container_number, exact_match_deep_search (boolean): Match mode of each criteria.
logo_op_type (string, nullable): Reserved for internal use.
200 OK
400 Bad Request
A required field is missing:
No search criteria was provided:
A field that is not allowed was sent:
The equipment type is not valid:
The trailer logo is not valid:
The hot alert limit was reached:
401 Unauthorized
403 Forbidden
Creates an alert that is triggered when a GenLogs sensor detects a truck matching its search criteria. Only email and alert_name are required, and at least one search criteria field must have a value. email must belong to a user of the caller's company. Unknown properties are rejected.
JWT provided directly in the Access-Token header. No "Bearer" prefix.
API key provided by GenLogs.
Email address that receives the alert results. Must belong to a user of your company.
Name of the alert. Cannot be empty.
normal runs once per day; hot runs every 15 minutes. The number of active hot alerts per user is limited.
normalPossible values: Set to true to create the alert paused.
falseAdditional email addresses. Must be an array, even for a single address.
Search criteria – USDOT number of the carrier.
Search criteria – MC number of the carrier.
Search criteria – license plate of the vehicle.
Search criteria – last 6 digits of the vehicle identification number.
Search criteria – cab number of the vehicle.
Search criteria – equipment type. Case-insensitive.
Search criteria – trailer logo. Must be a value returned by the List logos endpoint.
Search criteria – trailer number.
true matches the trailer number exactly; false uses a "contains" search.
falseSearch criteria – chassis number.
true matches the chassis number exactly; false uses a "contains" search.
falseSearch criteria – container number.
true matches the container number exactly; false uses a "contains" search.
falseSearch criteria – free-text deep search.
true matches the deep search criteria exactly; false uses a "contains" search.
falseAlert created successfully.
12345user@example.com["notification@example.com"]New alertnormalfalse["EMAIL"]Reserved for internal use.
12345falsefalsefalsefalseBad Request – a field is missing, invalid, or not allowed, no search criteria was provided, the trailer logo is not valid, or the hot alert limit was reached.
Unauthorized – Access-Token is missing, invalid, or expired.
Forbidden – the user lacks the required permission.
Internal Server Error.
POST /alerts HTTP/1.1
Host: api.genlogs.io
Access-Token: YOUR_API_KEY
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 193
{
"email": "user@example.com",
"cc_emails": [
"notification@example.com"
],
"alert_name": "New alert",
"alert_type": "normal",
"disabled": false,
"trailer_number": "12345",
"exact_match_trailer_number": false
}{
"id": 12345,
"email": "user@example.com",
"cc_emails": [
"notification@example.com"
],
"alert_name": "New alert",
"alert_type": "normal",
"disabled": false,
"notification_channels": [
"EMAIL"
],
"usdot_number": "text",
"mc_number": "text",
"license_plate": "text",
"vin": "text",
"cab_number": "text",
"equipment_type": "text",
"trailer_logo": "text",
"logo_op_type": "text",
"trailer_number": "12345",
"exact_match_trailer_number": false,
"chassis_number": "text",
"exact_match_chassis_number": false,
"container_number": "text",
"exact_match_container_number": false,
"deep_search": "text",
"exact_match_deep_search": false
}Last updated