Save Rules
const url = 'https://example.com/api/v1/alert-rules';const options = { method: 'PUT', headers: {'Content-Type': 'application/json'}, body: '{"budget_overspent":{"enabled":true,"category_id":1,"percent":1,"percent2":1},"bill_due":{"enabled":true,"days":1},"stale_snapshot":{"enabled":true,"days":1,"account_id":1}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://example.com/api/v1/alert-rules \ --header 'Content-Type: application/json' \ --data '{ "budget_overspent": { "enabled": true, "category_id": 1, "percent": 1, "percent2": 1 }, "bill_due": { "enabled": true, "days": 1 }, "stale_snapshot": { "enabled": true, "days": 1, "account_id": 1 } }'Save the three rules and re-evaluate the caller at once: a rule switched off resolves its alerts, and an alert that newly fires is posted to the caller’s webhooks and, for a type set to email, emailed after the response, except on the caller’s first alert evaluation, which stores its alerts without sending anything.
Request Bodyrequired
Section titled “Request Bodyrequired”PUT body: all three rules, saved together.
object
Fires when a category’s month-to-date spending reaches percent, and again at percent2
when set, of its monthly budget: once per category per month for each level. percent2 must
be sent and is null for a single level. category_id null means every category with a
budget.
Fires once per due date for a manual planned item due within days days, or overdue.
object
Example generated
{ "budget_overspent": { "enabled": true, "category_id": 1, "percent": 1, "percent2": 1 }, "bill_due": { "enabled": true, "days": 1 }, "stale_snapshot": { "enabled": true, "days": 1, "account_id": 1 }}Responses
Section titled “Responses”Successful Response
The user’s three rules, defaults filled in for any rule never saved.
object
Fires when a category’s month-to-date spending reaches percent, and again at percent2
when set, of its monthly budget: once per category per month for each level. percent2 must
be sent and is null for a single level. category_id null means every category with a
budget.
Fires once per due date for a manual planned item due within days days, or overdue.
object
Example generated
{ "budget_overspent": { "enabled": true, "category_id": 1, "percent": 1, "percent2": 1 }, "bill_due": { "enabled": true, "days": 1 }, "stale_snapshot": { "enabled": true, "days": 1, "account_id": 1 }}Validation Error
object
object
object
Example generated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}