SDK reference · Node SDK

prov.mandate.grants.setLimits

prov.mandate.grants.setLimits in Node SDK. Slice 11: save the mandate limits as a new live version (a key with the mandate scope).

Signature

prov.mandate.grants.setLimits(document: MandateLimitsDocument, params?: { note?: string }): Promise<MandateLimitsVersion>

Parameters

documentMandateLimitsDocumentRequired
params{ note?: string }

Request fields

Idempotency-Keystringheader
Retry a create safely: the same key + request returns the stored response (24 h, per caller).
documentobjectRequired
The account's mandate limits, a fixed set of rows over the grant fields: the overall cap, a sub-agent's budget settings, the merchant lists, reject past a margin, then ask. Published, the overall cap's rows become the account's over-limit settings for the budget lock (and the merchant locks when their rows are on), and the rest are the defaults each delegation on the account is handed where it leaves a field out. Strict: an unknown key is 400 policy_invalid.
Show child attributes
capobjectRequired
The most a parent hands its sub-agents in all (their budgets together). Off: no cap.
Show child attributes
enabledbooleanRequired
Whether the cap applies.
amountnumberRequired
The cap, in major units.
currencystringRequired
ISO 4217 code, stored upper-case.
budgetobjectRequired
The budget settings a sub-agent is handed when its delegation doesn't say, the same words as a grant's budget.
Show child attributes
allocationenumRequired
shared (drawn from what the parent has left) or reserved (set aside from the parent's budget; siblings can't spend it). One of shared, reserved.
at_limitenumRequired
At the sub-agent's limit: stop (refuse past it), ask (ask a person, refusing past refuse_over_share; off, at any amount over) or continue (go past without asking while every budget above has room). One of stop, ask, continue.
allowed_mccobjectRequired
Kinds of merchant a sub-agent may buy from; any other is refused or asked.
Show child attributes
enabledbooleanRequired
Whether the row applies (on needs at least one entry).
actionenumRequired
What a purchase from another kind of merchant does. One of refuse, ask.
mccarray of objectsRequired
MCC groups by name ({ group: lodging }) or ranges ({ from, to }), stored as ranges with the group's name.
named_merchantsobjectRequired
Merchants a sub-agent may buy from; any other is refused or asked.
Show child attributes
enabledbooleanRequired
Whether the row applies (on needs at least one merchant).
actionenumRequired
What a purchase from another merchant does. One of refuse, ask.
merchantsarray of stringsRequired
Merchant ids or origins, matched as allowed_counterparties.
blocked_mccobjectRequired
Kinds of merchant always refused.
Show child attributes
enabledbooleanRequired
Whether the row applies.
mccarray of objectsRequired
MCC groups or ranges.
blocked_merchantsobjectRequired
Merchants always refused.
Show child attributes
enabledbooleanRequired
Whether the row applies.
merchantsarray of stringsRequired
Merchant ids or origins.
refuse_over_capobjectRequired
A margin row: past a budget (refuse_over_cap, any mandate's budget; refuse_over_share, a sub-agent's own limit when its budget.at_limit is ask) by more than value percent of it, or by more than value in the cap's currency, refuse without asking. Off: ask at any amount over.
Show child attributes
enabledbooleanRequired
Whether the margin applies.
unitenumRequired
A percentage of the budget (the default), or a fixed amount. One of percent, amount.
valuenumberRequired
The margin (a percentage is at most 1000).
ask_over_capobjectRequired
Otherwise over a mandate's budget: ask a person. Off: refuse at the budget.
Show child attributes
enabledbooleanRequired
Whether a person is asked.
refuse_over_shareobjectRequired
A margin row: past a budget (refuse_over_cap, any mandate's budget; refuse_over_share, a sub-agent's own limit when its budget.at_limit is ask) by more than value percent of it, or by more than value in the cap's currency, refuse without asking. Off: ask at any amount over.
Show child attributes
enabledbooleanRequired
Whether the margin applies.
unitenumRequired
A percentage of the budget (the default), or a fixed amount. One of percent, amount.
valuenumberRequired
The margin (a percentage is at most 1000).
notestring
A note for the record.

Returns

Promise<MandateLimitsVersion> The new live version, with its document as stored.

HTTP operation

PUT /v1/mandate/settings/limits: Save the mandate limits

Errors

Example

const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/settings/limits`, {
  method: "PUT",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "document": {
      "cap": {
        "enabled": true,
        "amount": 2400,
        "currency": "USD"
      },
      "budget": {
        "allocation": "shared",
        "at_limit": "continue"
      },
      "allowed_mcc": {
        "enabled": true,
        "action": "refuse",
        "mcc": [
          {
            "group": "airlines"
          },
          {
            "group": "lodging"
          },
          {
            "group": "car_rental"
          }
        ]
      },
      "named_merchants": {
        "enabled": false,
        "action": "refuse",
        "merchants": []
      },
      "blocked_mcc": {
        "enabled": false,
        "mcc": []
      },
      "blocked_merchants": {
        "enabled": false,
        "merchants": []
      },
      "refuse_over_cap": {
        "enabled": true,
        "unit": "percent",
        "value": 20
      },
      "ask_over_cap": {
        "enabled": true
      },
      "refuse_over_share": {
        "enabled": false,
        "unit": "percent",
        "value": 20
      }
    },
    "note": "Scout's trip limits"
  }),
})).json();

Was this page helpful? Send us feedback

LLM? Read llms.txt.