Spend caps, budget alerts, and auto-cutoff
Orbit’s spend controls answer one customer question end-to-end: how do you stop the wallet from running away without a human on watch. Pick the ceiling you care about — a percentage of your monthly budget, an exact month-to-date spend amount, today’s spend, or a balance floor — and configure an alert rule for it. The rule watches your usage in real time, fires email and/or SMS to the recipients you choose the moment the threshold trips, and — when you pick one of the two enforcement actions — automatically pauses or blocks the org’s outbound sending so a runaway burn can’t stack up another invoice in the five minutes you weren’t reading email. With this in place, thresholds are opt-in and org-owned: you set the rule, the recipient list, the action, and the cooldown, and no Devotel support ticket is required to change any of it.1. Alert rules — your org’s thresholds
Create and read the rules under Billing → Alerts, or via the API:GET /api/v1/billing/alerts/GET /api/v1/billing/alerts/:id— list and read rules.POST /api/v1/billing/alerts— create one.POST /api/v1/billing/alerts/:id/test— dry-run a rule against today’s metrics without stamping it or pausing anything.
Worked response (HTTP 201). A successful create returns the full rule in
data.alert, so your policy layer can verify the write landed exactly as intended instead of re-reading:
last_triggered_at starts null and fills in the first time the threshold trips. A rule whose body fails validation comes back as an HTTP 422 in the standard error envelope; creating a rule against a percent threshold with no monthly budget set is not rejected — the rule reports itself inapplicable and never fires (see the budget note below).
spend_percent requires monthly_budget_cents on the org to be meaningful. With no budget set, the rule reports itself inapplicable and never fires — and until you set a budget the dashboard disables the percent option with a “Set a monthly budget first” pointer. Set the budget on Billing → Alerts in the monthly-budget-cap card (the same value Settings → Account → General edits).
2. What happens when a rule trips
The billing alert scheduler evaluates enabled rules on a 10-minute tick. The moment a threshold crosses, three things happen:- Notifications go out. Every email and SMS recipient receives one message per firing, with the rule’s name, the threshold descriptor, and the observed value (e.g. “Observed 82.4% against a threshold of 80% of monthly budget”).
last_triggered_atis stamped. Until the cooldown expires the same rule stays quiet — the 10-minute tick never turns into a notification storm while spend hovers just above the line.- The action fires (if you chose one).
pause_outboundsetsoutbound_paused = TRUEin a single UPDATE and immediately invalidates the cached outbound-flags entry across every API pod, so the send pipeline re-reads the flag on the next send call — not up to five minutes later.block_outbounddoes the same against the stricteroutbound_blockedflag.
SENDING_PAUSED (HTTP 402). The wallet header and the dashboard settings read flag the org as paused, and Billing → Alerts → clear the alert (or the same POST to the alert’s record) re-arms outbound.
3. Self-serve daily agent spend cap
Separate from the org-wide rules, an AI-agent owner can pin a hard ceiling on agent LLM spend in USD per UTC day. When the cap trips the runtime gate refuses new agent runs withAGENT_DAILY_SPEND_CAP_REACHED (HTTP 429) until midnight UTC or you raise the cap.
GET /api/v1/settings/agents/spend-cap— read the cap, today’s spend so far, and the server-computedcap_reachedflag in one payload.PUT /api/v1/settings/agents/spend-cap— set or clear it.nullremoves the cap entirely.
daily_spend_cap_cents: null clears the cap and returns "daily_spend_cap_cents": null. Write via the owner role; owner, admin, and developer roles can all read the GET.
The sentinel value range is 1 cent to $10,000 per UTC day, denominated in USD (the same ledger the agent billing events write to), and is not converted to a tenant wallet currency.
Error envelope (HTTP 422). A cap that violates the accepted shape — outside the 1¢–$10,000 range, a non-integer, or a missing field — is rejected before anything is written:
details.issues names the offending field and why it was rejected, so an automation can log or surface the exact fix instead of retrying blindly.
4. Sub-account kill-switch — reseller budgets as a hard latch
Resellers pinmonthly_spend_cap_cents on each child (sub)account and the per-sub-account scheduler watches the month-to-date rollup per child. The kill-switch latch trips at 100% of cap and — unlike the monthly notification-only rules — stays tripped for the rest of the UTC billing month, so a spend runaway stopping short of the reseller’s notice is still cut off. A new UTC month re-arms every sub-account automatically; a refund that pulls a child back under its cap releases the latch on the same tick that discovers it.
You do not have to do anything to get the auto-cutoff; it follows from the reseller’s per-sub-account cap the same way the monthly org rules follow from your own alert rules.
5. Cooldowns — how repeat trips debounce
cooldown_hourson an org rule anchors a repeat-notification silence. Stamp + cooldown window = a jittery threshold emits at most one email/SMS per window, not once per 10-minute tick.- The per-sub-account kill-switch re-arms per UTC billing month automatically — a latch written last month is invisible to this month’s gate.
- The agent daily cap re-arms at UTC midnight. Raising the cap via
PUT /settings/agents/spend-capre-arms the gate immediately rather than waiting for the next UTC boundary.
6. When outbound halts — troubleshooting and recovery
This section answers the operator question: my spend alert fired and my campaign didn’t send — what now? The answer depends on which gate halted traffic, and each gate has its own recovery path.Two gates, one decision
Every outbound send passes two independent pre-flight checks, in order:- The wallet balance gate. The send pipeline reserves an estimate hold for the send’s projected cost (segments times rate for SMS/MMS/WhatsApp, per-minute estimate for voice). If the wallet cannot cover the hold, the send is refused with
INSUFFICIENT_BALANCE(HTTP 402) before any ceiling is consulted. This gate sees money on account only; it knows nothing about budgets or caps. - The spend-cap gates. Your alert rules (§1), the sub-account monthly latch (§4), and the agent daily cap (§3) then evaluate against the funded wallet. A rule with
action_on_hit: notifynever blocks;pause_outboundandblock_outboundreturnSENDING_PAUSED(HTTP 402) until cleared.
GET /api/v1/billing/balance with 429 refusals means a spend ceiling fired (work it through Troubleshoot spend-cap refusals); a 402 INSUFFICIENT_BALANCE means the wallet is empty no matter what your caps say.
Soft vs hard breach
Who gets alerted, and when
A rule notifies exactly the addresses in its ownnotify_emails and notify_sms_numbers — Orbit does not fan out to every admin in the org. If you want the owner paged at 80% of budget, put the owner’s address on the rule. Both lists may be empty: the rule then enforces its action_on_hit with no notification, which is a legitimate pure-cut-off configuration. SMS recipients must be verified numbers on your org’s messaging surface.
Separate from rules, the Billing page raises a low-balance banner when the wallet drops to the warning floor (default $1.00), and the wallet card shows the org’s pause state and pause reason before an operator meets the 402 on a send.
Worked scenario — a 400-recipient campaign meets a $0.42 wallet
Your wallet holds $0.42 and a 400-recipient single-segment SMS campaign is in flight:- Sends already dispatched complete and settle. Each reserved an estimate hold at dispatch; when the carrier delivery report arrives the hold settles to the actual segment cost. Recipients whose messages were dispatched receive them; their DLRs and bounces report as normal.
- The first send whose estimate hold exceeds $0.42 is refused with
INSUFFICIENT_BALANCE(402). The refusal is per-send and atomic: no recipient ever gets a half-send, and a refused send bills nothing. - The remainder of the queue refuses the same way. Refusals are not delivery bounces — nothing reached a carrier, so there are no DLRs to read for the unsent part. The tell in your delivery report is the boundary between dispatched (DLRs arrive) and refused (402 at the gate, no carrier event).
- Top-up resumes the queue. Fund the wallet on Billing → Balance (or let auto-top-up fire). When the credit lands the platform clears the empty-wallet pause and refreshes the cached gate state, so the next send attempt is admitted within a second — no dashboard toggle to flip. The 5-minute balance sync remains only as a backstop.
- Funds drain back as reports arrive. Holds for sends that never deliver release when the failure report lands, so the balance can creep back up in the minutes after a halt (seconds to minutes, carrier-dependent) even before you top up.
- If sends still return
SENDING_PAUSEDafter funding, the halt is a rule pause, not the wallet: clear it on Billing → Alerts (§2).
When the auto-top-up charge itself fails
Auto-top-up (threshold, recharge amount, per-day and per-month charge caps) is configured on the auto-top-up card on Billing → Balance. If the card is declined mid-retry:- No partial credit. The wallet is credited only after a charge succeeds; a declined charge changes neither the balance nor the outbound pause.
- The failure is surfaced, not swallowed. The decline is recorded with its timestamp and shown on the auto-top-up card, so an operator sees why the recharge didn’t land.
- Retries stay bounded. The per-day and per-month charge caps you configured still bound recovery attempts; a declined card cannot run up charges against your monthly cap.
- Outbound stays halted while the wallet is empty. The deterministic recovery is a manual top-up (or fixing the payment method and letting the next tick retry). A manual top-up runs the same resume path as a successful auto charge — there is no separate re-arm step.
Per-channel pre-flight checks before you send
The composer and the call dialog run the same gates before dispatch and name the fix in the refusal:- SMS/WhatsApp composer — when the wallet can’t cover the projected send cost the send control is disabled with: “Add credit to your wallet before sending — the projected cost exceeds your balance.” When your daily spend ceiling trips instead, the refusal names it and its fix: “Daily SMS spend cap reached (…). Raise it in Settings → Billing → Alerts.”
- Voice call dialog — mirrors the org’s outbound-pause state and block reason from the balance endpoint, so a paused org reads as paused before you place the call, not after a 402.
- Campaign launch — the campaign voice cap pre-checks the campaign’s own envelope; a tripped cap pauses the campaign and names the ceiling (refusal codes).
The three-stage warning ladder
Stage 2 clears itself on credit by design; stage 3 deliberately does not. That distinction is the most common cause of “I topped up, why is sending still paused?” — read the pause reason on the wallet card: if it is not the empty-wallet reason, recovery lives on the billing surface, not in the wallet (see Pause and block recovery). Every funding path — card checkout, auto-top-up, crypto top-up, or an admin credit — runs the same resume step, so recovery behaves identically however the credit lands.
7. Dashboard ↔ API parity
Everything the API exposes shows up in the dashboard, with owner/admin roles the same on both:- Billing → Alerts — create/read/test-fire the four threshold types, configure email/SMS recipients, pick the action, pick the cooldown. The monthly-budget cap lives ON THIS PAGE in a dedicated card — the percent-of-budget denominator — with an inline editor, so you can set or clear the cap without leaving Billing. (The same value is also editable under Settings → Account → General, where the full org settings form lives; both surfaces write the same value.)
- Billing → Balance — the header widget and the balance-read endpoint both display the org’s current outbound-paused flag so operators see a cut-off org before they see the pause error on a send.
- Settings → Agents — the agent-spend-cap card on the settings surface, plus an auto-pause banner on the agents list when
cap_reachedis true.
GET /billing/alerts reads the same rules the UI writes.
spend_percent remains disabled while the budget is null — pick Billing → Alerts to configure it, or pick a spend_amount / balance_remaining / daily_spend threshold type instead.
For the endpoint-by-endpoint error and schema reference see the Billing API reference.