> For the complete documentation index, see [llms.txt](https://docs.genlogs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.genlogs.io/alerts/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](/alerts/create-alert.md) . 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:

* **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 your API user is created with a role that includes either `admin` or `edit-alert-endpoint` permissions.

***

### Endpoint

* **URL**: `https://api.genlogs.io/alerts/{alert_id}`
* **Method**: `PATCH`

***

### Request Parameters

Only the following fields are updatable:

* **alert\_name** (string, Optional): The name of the alert for identification. ​
* **location\_state** (string, Optional): State where the alert is triggered. ​
* **location\_city** (string, Optional): City where the alert is triggered. ​
* **license\_plate** (string, Optional): License plate number related to the alert. ​
* **location\_plate\_state** (string, Optional): State where the license plate is registered. ​
* **usdot\_number** (string, Optional): USDOT number of the vehicle. ​
* **mc\_number** (string, Optional): MC number of the vehicle. ​
* **vin** (string, Optional): Last 6 digits of the VIN. ​
* **cab\_number** (string, Optional): Cab number of the vehicle. ​
* **equipment\_type** (string, Optional): Equipment type of the trailer. ​
* **trailer\_logo** (string, Optional): Logo displayed on the trailer. ​
  * You can see the list of available logos at [this](/alerts/list-logos.md) endpoint.
* **trailer\_number** (string, Optional): Trailer number associated with the alert. ​
* **exact\_match\_trailer\_number** (boolean, Optional): Whether to do an exact match on trailer number.
* **cc\_emails** (array of strings, Optional): Additional recipients for email notifications. ​
* **alert\_type** (string, Optional): `normal` or `hot`. Defines how often alerts are triggered. ​
* **disabled** (boolean, Optional): Indicates whether the alert is active. ​
* **start\_date** (string (ISO 8601 date-time string), Optional): Alert start date. ​
* **end\_date** (string (ISO 8601 date-time string), Optional): Alert end date. ​
* **deep\_search** (boolean, Optional): Enables deeper asset match scanning. ​
* **notification\_channels** (array of strings, Optional): List of channels to receive notifications.

{% hint style="info" %}

* `start_date` and `end_date` accept ISO 8601 date-time strings with `Z`, timezone offsets, or naive date-time strings.
* Timezone-aware input is normalized to UTC and stored/returned without timezone.
* Invalid date-time strings return `400`.
  {% endhint %}

***

### 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.

```json
{"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"}}],"requestBody":{"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"}}}}}}}}}
```
