---
title: "Budget alerts"
description: "Budget alerts mail people as a budget's spend nears its limit, before reservations are refused."
---

# Budget alerts

A budget's alerts mail people when its spend nears its limit, so someone can raise the limit or
find what is spending before Tidegate starts refusing reservations. Each budget has up to 10
alerts, of two kinds:

- **Spent**: the window's spend has reached a percent of the limit, such as 80% or 100%.
- **Pace**: at the rate it has spent so far this window, spend will reach a percent of the limit
  before the window resets. A pace alert at 100% warns that the budget will run out early, while
  there is still time to act.

A percent can be anything from 1% to 1000%: an alert past 100% says how far over its limit a
budget's spend has gone, since settlements and price changes can take it past.

## Only budgets of a day or longer

**A budget whose windows are shorter than a day has no alerts, and can't be given any.** By the
time a mail is read, an hour's window has reset, and a rate limit's alerts would mail all day.
Its denials, and the Budgets page, are where to watch it: its panel there says it has no alerts,
and it has no Change alerts. A budget of daily, weekly, or monthly windows, or any window of a
day or longer, can have them.

## Where it all lives

| What                       | Where                                                    | Who changes it              |
| -------------------------- | -------------------------------------------------------- | --------------------------- |
| A budget's alerts          | The Budgets page: the budget's panel, and its row's menu | Admins, the API, and agents |
| The organization's address | People, in Settings, under Alert address                 | Admins; members see it      |
| Whether you get alerts     | Your account, in Settings                                | Each person, for themselves |

## Changing a budget's alerts

A new budget has two alerts: spent at 100%, and pace at 100%. Picking a budget on the Budgets
page opens its panel, which lists its alerts, such as "80% spent · on pace for 120%". Admins
change them with Change alerts, in the panel or the menu at the end of the budget's row: each
alert is a kind, Spent or On pace for, and a percent of the limit, and Add alert and the × beside
each add and remove them, up to 10. Saving replaces them all; saving none turns the budget's
alerts off. The API and an [agent](/tidegate/guide/agents) change them too, and every change is recorded in
the [history](/tidegate/guide/history), with the alerts before and after.

The Budgets page shows each budget's pace beside its window, such as "on pace for 140%": where
its spend would end the window, at the rate it has spent so far, as a percent of its limit. It is
the same reckoning a pace alert makes, so a pace alert at 100% fires once the page reads 100% or
more. Like the alert, it waits until a tenth of the window has passed. A split budget shows the
pace of the value that has spent the most.

## When an alert fires

Tidegate checks every budget's alerts about once a minute. An alert fires once per window: once
it has mailed, it stays quiet until the next window starts, or until an admin changes the
budget's limit, which arms it again. Several alerts firing in the same check, such as spent at
80% and pace at 100%, are one mail.

A budget [split by a label](/tidegate/guide/budgets#splitting-by-a-label) has each value checked on its own,
against the full limit, as reservations are: one mail lists every value that crossed, the 20 that
spent most first, then how many more.

A pace alert waits until a tenth of the window has passed, so a burst in its first minutes
doesn't project to many times the limit. Once spend has reached its percent, a pace alert stays
quiet: the line is no longer ahead, and a spent alert at that percent is the one to say so.

A frozen or archived budget is never checked. Restored, it is checked again; an alert that
crossed while it was archived fires then.

## Who gets the mail

Alerts go to two kinds of recipient, each address once:

- **The organization's alert address**, such as a team's mailing list, once someone there has
  confirmed it. Admins set it on the People page, in Settings, under Alert address, where they
  also change it and remove it; members see it there too. Tidegate mails the address a link to
  confirm it, which works for 7 days; until someone follows it, the page says it is waiting for
  confirmation, nothing else is mailed there, and Resend link mails a new one (at most one a
  minute). An address gets at most 5 links a day, and an organization sends at most 10; past
  that, setting the address is refused until the next day, and the address before stays. Anyone who reads that address can confirm it, so it can be a list nobody in the
  organization is on. The link opens a page with a Confirm button, and nothing is confirmed until
  someone presses it, so a mail scanner that opens the link confirms nothing.
- **Members who want alerts**, each with the switch "Email me budget alerts" in Your account, in
  Settings, which says whether they get them and why. Admins get them unless the organization has
  a confirmed alert address, since that is usually where they want alerts to go instead; members
  don't, unless they turn them on. Each person's choice is their own, and wins over either
  default; Use the default, below the switch, goes back to their role's. The choice is for the
  organization the pages show, so someone in several chooses in each.

Tidegate mails only people who have signed in at least once, so being added to an organization
never means mail to an address nobody has used. A mail says why it was sent, and a member's says
where to turn alerts off. It links to the budget on the Budgets page, which scrolls to it and
marks it.

Where a Tidegate deployment sends no mail, the pages say so, budgets' alerts are kept but mail
nobody, the switch in Your account can't be changed, and an organization can't set an alert address.

## Setting alerts with the API

`PUT /tenants/{tenant}/budgets/{id}/alerts` sets a budget's alerts, replacing them all:

```json
{
  "alerts": [
    { "kind": "spent", "percent": 80 },
    { "kind": "spent", "percent": 100 },
    { "kind": "pace", "percent": 100 }
  ]
}
```

It answers the budget's state, with its alerts sorted. It needs an admin, or a [manager key](/tidegate/guide/keys), and
refuses a budget whose windows are shorter than a day (`422 AlertsNeedDailyWindows`) unless the
list is empty. An agent sets them with the `set_budget_alerts` tool. The alert address and
people's own settings are only on the pages.
