edit alert.md

Edit Alert

Allows api users to update existing alerts. Alerts can currently be created either from Asset Locator Portal or via Create alert. These alerts are triggered when a scheduled job is triggered and perform the search on the detections based on the alerts criteria. Notifications are sent via email and webhooks.

This endpoint is restricted to authorized users with appropriate permissions.


Authentication

Include the following headers in your requests:


Permissions

Make sure your API user is created with a role that includes either admin or edit-alert-endpoint permissions.


Endpoint


Request Parameters

Only the following fields are updatable:

{% hint style="info" %}


Response Codes

Code Meaning
200 OK Successfully updated the alert.
400 Bad Request Missing or invalid parameters.
401 Unauthorized Authentication credentials are missing or invalid.
403 Forbidden User lacks required permissions.
404 Not Found No alert found with the specified ID.
500 Internal Server Error An unexpected server error occurred.

External Patch Alert

Partially update an existing alert by alert_id. `start_date` and `end_date` accept ISO 8601 date-time strings with `Z`, timezone offsets, or no timezone. Timezone-aware values are normalized to UTC and returned without timezone information.

{"openapi":"3.1.0","info":{"title":"Alert API","version":"0.0.1"},"security":[{"APIKeyHeader":[]}],"components":{"securitySchemes":{"APIKeyHeader":{"type":"apiKey","description":"JWT Access Token required for authentication","in":"header","name":"Access-Token"}},"schemas":{"UpdateAlertSchema":{"properties":{"alert_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Alert Name"},"location_state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location State"},"location_city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location City"},"license_plate":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"License Plate"},"license_plate_state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"License Plate State"},"usdot_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Usdot Number"},"chassis_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chassis Number"},"exact_match_chassis_number":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Exact Match Chassis Number","default":false},"container_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Container Number"},"equipment_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Equipment Type"},"exact_match_container_number":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Exact Match Container Number","default":false},"mc_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mc Number"},"vin":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vin"},"cab_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cab Number"},"trailer_logo":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trailer Logo"},"trailer_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trailer Number"},"disabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Disabled"},"cc_emails":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Cc Emails"},"alert_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Alert Type"},"exact_match_trailer_number":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Exact Match Trailer Number"},"start_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"ISO 8601 date-time. Values with `Z` or timezone offsets are normalized to UTC and stored/returned without timezone information.","title":"Start Date"},"end_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"ISO 8601 date-time. Values with `Z` or timezone offsets are normalized to UTC and stored/returned without timezone information.","title":"End Date"},"deep_search":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Deep Search"},"notification_channels":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Notification Channels"}},"additionalProperties":false,"type":"object","title":"UpdateAlertSchema","description":"Schema for partial updates of alerts (PATCH operations). All fields are optional - only provided fields will be updated."},"AlertResponseSchema":{"properties":{"alert_name":{"type":"string","title":"Alert Name"},"location_state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location State"},"location_city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location City"},"license_plate":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"License Plate"},"license_plate_state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"License Plate State"},"usdot_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Usdot Number"},"chassis_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chassis Number"},"exact_match_chassis_number":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Exact Match Chassis Number","default":false},"container_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Container Number"},"equipment_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Equipment Type"},"exact_match_container_number":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Exact Match Container Number","default":false},"mc_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mc Number"},"vin":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vin"},"cab_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cab Number"},"trailer_logo":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trailer Logo"},"trailer_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trailer Number"},"disabled":{"type":"boolean","title":"Disabled","default":false},"cc_emails":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Cc Emails"},"alert_type":{"type":"string","title":"Alert Type","default":"normal"},"exact_match_trailer_number":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Exact Match Trailer Number","default":false},"start_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Returned as a timezone-free UTC date-time string after normalization.","title":"Start Date"},"end_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Returned as a timezone-free UTC date-time string after normalization.","title":"End Date"},"deep_search":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Deep Search"},"id":{"type":"integer","title":"Id"},"email":{"type":"string","title":"Email"},"last_updated_timestamp":{"type":"string","format":"date-time","title":"Last Updated Timestamp"},"insert_timestamp":{"type":"string","format":"date-time","title":"Insert Timestamp"},"notification_channels":{"items":{"type":"string"},"type":"array","title":"Notification Channels","default":[]}},"additionalProperties":false,"type":"object","required":["alert_name","id","email","last_updated_timestamp","insert_timestamp"],"title":"AlertResponseSchema","description":"Public API response schema for alerts - extends base with response-specific fields"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/alerts/{alert_id}":{"patch":{"tags":["alerts"],"summary":"External Patch Alert","description":"Partially update an existing alert by alert_id. `start_date` and `end_date` accept ISO 8601 date-time strings with `Z`, timezone offsets, or no timezone. Timezone-aware values are normalized to UTC and returned without timezone information.","operationId":"external_patch_alert_alerts__alert_id__patch","parameters":[{"name":"alert_id","in":"path","required":true,"schema":{"type":"integer","title":"Alert Id"}},...},{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAlertSchema"}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertResponseSchema"}}}},"400":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}