# Create an Alert Creates a new alert on an item or custom field value. item_id is required. For Quantity alerts: set item_id to the item's numeric ID, then choose a threshold_method such as quantity_less_than and a threshold_value. For DateReminder alerts, set: - item_id and custom_attribute_id, the datetime custom field to watch - threshold_method to before, after or same_day - threshold_interval to days, weeks, months or years, with threshold_value as the count So 30 with days and before fires 30 days ahead of the date. same_day ignores the interval and the value. triggerable_type and triggerable_id are response fields only. Sortly derives them from item_id and custom_attribute_id, and sending them is rejected with 422 Item can't be blank. Create and update take the same identifying fields. Endpoint: POST /api/v1/alerts Security: BearerAuth ## Request fields (application/json): - `item_id` (number, required) The item the alert watches. Required on create and on every update, whatever the alert's type. Leave it out and the request is rejected with 422. Example: 12345 - `custom_attribute_id` (number,null) For a DateReminder, the datetime custom field to watch. Pairs with item_id: together they identify whose field value the alert is about. - `type` (string, required) Quantity fires when an item's stock crosses a threshold. DateReminder fires relative to a date held in a datetime custom field. Enum: "Quantity", "DateReminder" - `threshold_method` (string) What triggers the alert. Use a quantity_* method (or less_than_or_equal_to_min_quantity) with type: Quantity, and before, after or same_day with type: DateReminder. Enum: "less_than_or_equal_to_min_quantity", "quantity_greater_than", "quantity_less_than", "quantity_less_than_equal_to", "quantity_greater_than_equal_to", "before", "after", "same_day" - `threshold_value` (number) The number the alert is compared against. Example: 5 - `threshold_interval` (string,null) How far before or after the date to fire. Required for DateReminder alerts, null for Quantity. Enum: "days", "weeks", "months", "years", null - `recipient_groups` (array) Who gets notified when the alert fires. Defaults to owners if omitted. Enum: "owners", "admins", "members" - `is_deleted` (boolean) Whether the alert has been deleted. ## Response 201 fields (application/json): - `data` (object) - `data.item_id` (number) - `data.custom_attribute_id` (number,null) - `data.threshold_method` (string) - `data.threshold_value` (number) - `data.threshold_interval` (string,null) - `data.is_fired` (boolean,null) - `data.type` (string) - `data.is_deleted` (boolean) - `data.recipient_groups` (array) ## Response 400 fields (application/json): - `message` (string) ## Response 401 fields (application/json): - `message` (string) ## Response 422 fields (application/json): - `message` (string) ## Response 429 fields (application/json): - `message` (string)