View as Markdown

Mandate · Guide

Near-limit notices

When an order your agent makes takes a person's weekly or monthly budget to their near-limit percent, Provenance tells them once that window how much of the budget the agent has used, with buttons to adjust the limit or pause the agent. You choose the channels; the person chooses the percent.

Before you begin: your agent holds a network grant with a weekly or monthly budget.

When a notice goes

  • After an authorized order, the first time spent and held reach the person's percent in that window: 80% unless they changed it to 50% or 90% or turned it off, for all agents or for yours.
  • Once per window per grant.
  • Never for a daily budget, a grant with no budget or a per-order cap.

Your agent's response says so too:

{
  "object": "network_authorization",
  "result": "authorized",
  "limit_notice": { "percent_used": 82, "remaining": 36 }
}

limit_notice is present on every authorized order at or past the percent, so your agent can tell the person before it asks.

Choose the channels

Push, text and email are all on by default. A notice goes on each channel you left on that the person has set up: the Provenance app (then web push), a verified phone and a verified email.

GET /v1/mandate/settings/limit_notices reads the setting. PUT /v1/mandate/settings/limit_notices changes it with an admin key or an owner or admin session; a field left out keeps its value.

{ "channels": { "text": false } }

To set channels for one grant, send limit_notice_channels on its grant request.

What it costs

Notices are free. Texts you leave on are billed to you at the text price, like any text Provenance sends for you. A Free account sends no texts, so its notices go by push and email.

The webhook

Subscribe to mandate.network_grant.limit_near to hear when a notice went out:

percent_usednumber
How much of the budget was spent and held.
windowstring
The budget window (week or month), starting at window_start.
channelsarray
The channels the notice went on.
textsinteger
Texts billed to you for it.

Errors you might see

CodeWhat to do
insufficient_scopeChange the channels with an admin key, or from the console as an owner or admin.
parameter_invalidSend channels with only push, text and email, each true or false.

See also