SDK reference · Node SDK
prov.mandate.grants.create
prov.mandate.grants.create in Node SDK. Grant a mandate; returns it plus the one-time mandateToken (Growth+).
Signature
prov.mandate.grants.create(params: GrantMandateParams): Promise<GrantWithToken>Parameters
paramsGrantMandateParamsRequired
Request fields
Idempotency-Keystringheader- Retry a create safely: the same key + request returns the stored response (24 h, per caller).
device_idstringRequired- The capture or approving device's ID.
agent_session_idstring- The agent session the token was minted for.
constraintsobjectRequired- Bounded standing-authority constraints, validated at grant.
Show child attributes
max_amountnumber | null- Per-action cap.
budget_amountnumber | null- Cumulative cap per window.
budget_windowenum- The budget's window:
day,weekormonth, in UTC. One ofday,week,month. allowed_action_typesarray of strings- Empty ⇒ any action type. Matched against context.action_type at verify.
allowed_counterpartiesarray of strings | null- null ⇒ any counterparty. Matched against context.counterparty at verify.
scheduleobject | null- A standing schedule. The human authorizes a recurrence once; the agent executes ONE action per cycle inside a grace window. We authorize, we NEVER move money. Verify denials: schedule_counterparty_mismatch, schedule_amount_exceeded, schedule_window_missed, schedule_already_executed, schedule_occurrences_exhausted. UTC only (caller maps local time).
Show child attributes
cadenceenumRequired- How often the scheduled payment runs:
weekly,monthlyorquarterly. One ofweekly,monthly,quarterly. dayinteger- day-of-month (monthly/quarterly) or ISO weekday 1-7 (weekly).
amount_fixednumber | null- Exact required amount (XOR amount_max).
amount_maxnumber | null- Max allowed amount (XOR amount_fixed).
counterpartystringRequired- The required counterparty.
occurrencesinteger | null- Total executions allowed (null ⇒ until expiry).
grace_window_hoursinteger- Hours after the scheduled instant an execution is valid (default 48).
heartbeatobject- The check-in: the grant stays valid only while its person checks in with their passkey each period; a missed check-in pauses it. Present only when set.
Show child attributes
intervalenumRequired- How often the person checks in:
weekly,biweeklyormonthly(UTC periods). One ofweekly,biweekly,monthly. grace_hoursinteger- Hours into a period before a missing check-in pauses the grant (default 72).
currencystring- The ISO 4217 code the grant's amounts are in (stored upper-case). Present only when set. An amount in another currency isn't covered (
grant_currency_mismatch): verify needscontext.currencyto match, a store's cart must be in it. A child inherits it and can't change it. Not carried in the mandate token. max_usesinteger- Purchases allowed over the grant's whole life (1 = single use). Each verify pass and each cart the grant covers at a store is one. A spent grant refuses (
grant_uses_exhausted). Counts for every grant below it. Present only when set; not carried in the token. max_purchasesinteger- Purchases allowed per
purchase_window(grant_purchase_limit_reachedpast it). Needspurchase_window. Present only when set; not carried in the token. purchase_windowenum- The window
max_purchasesis counted over:day,weekormonthin UTC, orlifetime(the whole grant). Independent of the budget window. One ofday,week,month,lifetime. over_limitobject- What each lock does when a purchase at a store goes past it (ask a person or refuse; the amount and budget locks ask up to a margin, a percentage of the limit). A lock left out follows the grant above it, then the account's settings, then the defaults. On a delegation each lock given can only be stricter than the parent's. Present only when set; not carried in the token.
Show child attributes
amountobject- What one of a grant's locks does when a purchase goes past it.
askopens an approval for a person;refuserefuses without asking. The amount and budget locks takerefuse_overwithask: past the limit plus that margin, the purchase is refused without asking.Show child attributes
actionenumRequired- Ask a person, or refuse. One of
ask,refuse. refuse_overobject | null- The amount and budget locks only, with
ask: how far past the limit a person may still be asked, as a percentage of the limit (percent, 20 by default when left out) or, in Advanced, a fixedamountin the grant's currency. Exactly one of the two.nullasks at any amount over.Show child attributes
percentnumber- The margin, in percent of the limit (20: ask up to 1.2 times the limit).
amountnumber- The margin as a fixed amount in the grant's currency (300: ask up to the limit plus 300). On a grant it needs the grant's
currency.
budgetobject- What one of a grant's locks does when a purchase goes past it.
askopens an approval for a person;refuserefuses without asking. The amount and budget locks takerefuse_overwithask: past the limit plus that margin, the purchase is refused without asking.Show child attributes
actionenumRequired- Ask a person, or refuse. One of
ask,refuse. refuse_overobject | null- The amount and budget locks only, with
ask: how far past the limit a person may still be asked, as a percentage of the limit (percent, 20 by default when left out) or, in Advanced, a fixedamountin the grant's currency. Exactly one of the two.nullasks at any amount over.Show child attributes
percentnumber- The margin, in percent of the limit (20: ask up to 1.2 times the limit).
amountnumber- The margin as a fixed amount in the grant's currency (300: ask up to the limit plus 300). On a grant it needs the grant's
currency.
datesobject- What one of a grant's locks does when a purchase goes past it.
askopens an approval for a person;refuserefuses without asking. The amount and budget locks takerefuse_overwithask: past the limit plus that margin, the purchase is refused without asking.Show child attributes
actionenumRequired- Ask a person, or refuse. One of
ask,refuse. refuse_overobject | null- The amount and budget locks only, with
ask: how far past the limit a person may still be asked, as a percentage of the limit (percent, 20 by default when left out) or, in Advanced, a fixedamountin the grant's currency. Exactly one of the two.nullasks at any amount over.Show child attributes
percentnumber- The margin, in percent of the limit (20: ask up to 1.2 times the limit).
amountnumber- The margin as a fixed amount in the grant's currency (300: ask up to the limit plus 300). On a grant it needs the grant's
currency.
categoryobject- What one of a grant's locks does when a purchase goes past it.
askopens an approval for a person;refuserefuses without asking. The amount and budget locks takerefuse_overwithask: past the limit plus that margin, the purchase is refused without asking.Show child attributes
actionenumRequired- Ask a person, or refuse. One of
ask,refuse. refuse_overobject | null- The amount and budget locks only, with
ask: how far past the limit a person may still be asked, as a percentage of the limit (percent, 20 by default when left out) or, in Advanced, a fixedamountin the grant's currency. Exactly one of the two.nullasks at any amount over.Show child attributes
percentnumber- The margin, in percent of the limit (20: ask up to 1.2 times the limit).
amountnumber- The margin as a fixed amount in the grant's currency (300: ask up to the limit plus 300). On a grant it needs the grant's
currency.
counterpartyobject- What one of a grant's locks does when a purchase goes past it.
askopens an approval for a person;refuserefuses without asking. The amount and budget locks takerefuse_overwithask: past the limit plus that margin, the purchase is refused without asking.Show child attributes
actionenumRequired- Ask a person, or refuse. One of
ask,refuse. refuse_overobject | null- The amount and budget locks only, with
ask: how far past the limit a person may still be asked, as a percentage of the limit (percent, 20 by default when left out) or, in Advanced, a fixedamountin the grant's currency. Exactly one of the two.nullasks at any amount over.Show child attributes
percentnumber- The margin, in percent of the limit (20: ask up to 1.2 times the limit).
amountnumber- The margin as a fixed amount in the grant's currency (300: ask up to the limit plus 300). On a grant it needs the grant's
currency.
currencyobject- What one of a grant's locks does when a purchase goes past it.
askopens an approval for a person;refuserefuses without asking. The amount and budget locks takerefuse_overwithask: past the limit plus that margin, the purchase is refused without asking.Show child attributes
actionenumRequired- Ask a person, or refuse. One of
ask,refuse. refuse_overobject | null- The amount and budget locks only, with
ask: how far past the limit a person may still be asked, as a percentage of the limit (percent, 20 by default when left out) or, in Advanced, a fixedamountin the grant's currency. Exactly one of the two.nullasks at any amount over.Show child attributes
percentnumber- The margin, in percent of the limit (20: ask up to 1.2 times the limit).
amountnumber- The margin as a fixed amount in the grant's currency (300: ask up to the limit plus 300). On a grant it needs the grant's
currency.
blockobject- What one of a grant's locks does when a purchase goes past it.
askopens an approval for a person;refuserefuses without asking. The amount and budget locks takerefuse_overwithask: past the limit plus that margin, the purchase is refused without asking.Show child attributes
actionenumRequired- Ask a person, or refuse. One of
ask,refuse. refuse_overobject | null- The amount and budget locks only, with
ask: how far past the limit a person may still be asked, as a percentage of the limit (percent, 20 by default when left out) or, in Advanced, a fixedamountin the grant's currency. Exactly one of the two.nullasks at any amount over.Show child attributes
percentnumber- The margin, in percent of the limit (20: ask up to 1.2 times the limit).
amountnumber- The margin as a fixed amount in the grant's currency (300: ask up to the limit plus 300). On a grant it needs the grant's
currency.
usesobject- What one of a grant's locks does when a purchase goes past it.
askopens an approval for a person;refuserefuses without asking. The amount and budget locks takerefuse_overwithask: past the limit plus that margin, the purchase is refused without asking.Show child attributes
actionenumRequired- Ask a person, or refuse. One of
ask,refuse. refuse_overobject | null- The amount and budget locks only, with
ask: how far past the limit a person may still be asked, as a percentage of the limit (percent, 20 by default when left out) or, in Advanced, a fixedamountin the grant's currency. Exactly one of the two.nullasks at any amount over.Show child attributes
percentnumber- The margin, in percent of the limit (20: ask up to 1.2 times the limit).
amountnumber- The margin as a fixed amount in the grant's currency (300: ask up to the limit plus 300). On a grant it needs the grant's
currency.
purchasesobject- What one of a grant's locks does when a purchase goes past it.
askopens an approval for a person;refuserefuses without asking. The amount and budget locks takerefuse_overwithask: past the limit plus that margin, the purchase is refused without asking.Show child attributes
actionenumRequired- Ask a person, or refuse. One of
ask,refuse. refuse_overobject | null- The amount and budget locks only, with
ask: how far past the limit a person may still be asked, as a percentage of the limit (percent, 20 by default when left out) or, in Advanced, a fixedamountin the grant's currency. Exactly one of the two.nullasks at any amount over.Show child attributes
percentnumber- The margin, in percent of the limit (20: ask up to 1.2 times the limit).
amountnumber- The margin as a fixed amount in the grant's currency (300: ask up to the limit plus 300). On a grant it needs the grant's
currency.
countryobject- What one of a grant's locks does when a purchase goes past it.
askopens an approval for a person;refuserefuses without asking. The amount and budget locks takerefuse_overwithask: past the limit plus that margin, the purchase is refused without asking.Show child attributes
actionenumRequired- Ask a person, or refuse. One of
ask,refuse. refuse_overobject | null- The amount and budget locks only, with
ask: how far past the limit a person may still be asked, as a percentage of the limit (percent, 20 by default when left out) or, in Advanced, a fixedamountin the grant's currency. Exactly one of the two.nullasks at any amount over.Show child attributes
percentnumber- The margin, in percent of the limit (20: ask up to 1.2 times the limit).
amountnumber- The margin as a fixed amount in the grant's currency (300: ask up to the limit plus 300). On a grant it needs the grant's
currency.
allowed_mccarray of objects- Kinds of merchant allowed, by merchant category code (MCC): each entry a group by name (
{ "group": "lodging" }) or a range ({ "from": "3000", "to": "3299" },toleft out for one code). A group is stored as its ranges with its name. Checked against the MCC the merchant declares with the cart (merchant.mcc) or in verify'scontext.mcc; a cart with no MCC isn't covered. A miss follows thecategorylock (ask by default). Groups:airlines,lodging,car_rental,rail,grocery,office_supplies,software,gambling,cash_like,money_transfer. On a delegation each range sits inside the parent's. Present only when set; not carried in the token.Show child attributes
groupstring- A group by name when sending (
lodging); stored on each of its ranges. fromstring- The first MCC in the range.
tostring- The last MCC in the range (the same as
fromfor one code). namestring- The plain name ("Lodging").
blocked_mccarray of objects- MCC ranges refused, in the same form as
allowed_mcc. A block wins over every allow list. A hit follows theblocklock (refuse by default); a cart with no MCC follows thecategorylock. A child's list is its parent's with its own additions. Present only when set; not carried in the token.Show child attributes
groupstring- A group by name when sending (
lodging); stored on each of its ranges. fromstring- The first MCC in the range.
tostring- The last MCC in the range (the same as
fromfor one code). namestring- The plain name ("Lodging").
blocked_counterpartiesarray of strings- Merchants refused, matched as
allowed_counterpartiesis (a cart'smerchant_idororigin, verify'scontext.counterparty). A hit follows theblocklock (refuse by default). A child's list is its parent's with its own additions. Present only when set; not carried in the token. allowed_countriesarray of string | objects- Merchant countries allowed, given as alpha-2 (
"PT") or ISO 3166-1 numeric ("620") codes and stored as{ code, alpha2 }. Checked against the country the merchant declares (merchant.country, verify'scontext.merchant_country); a cart with no country isn't covered. A miss follows thecountrylock (ask by default). On a delegation each country is one of the parent's. Present only when set; not carried in the token.Show child attributes
codestring- The ISO 3166-1 numeric code (
620). alpha2string- The alpha-2 code (
PT), for display.
blocked_countriesarray of string | objects- Merchant countries refused, in the same form as
allowed_countries. A hit follows theblocklock (refuse by default). A child's list is its parent's with its own additions. Present only when set; not carried in the token.Show child attributes
codestring- The ISO 3166-1 numeric code (
620). alpha2string- The alpha-2 code (
PT), for display.
service_windowobject- The dates of what is bought, separate from
expires_at(when the agent may act). Two calendar dates, both included; for lodgingtois the check-out date. Every cart line'sservice_period(verify'scontext.service_startandcontext.service_end) must sit inside it, compared as calendar dates in their own offset; a cart with no dates isn't covered. A miss follows thedateslock (ask by default). On a delegation it sits inside the parent's. Present only when set; not carried in the token.Show child attributes
fromstringRequired- The first date (
2027-03-12). tostringRequired- The last date, on or after
from(2027-03-16).
expires_attimestampRequired- The grant's hard expiry.
biometric_challengestring- The challenge from
POST /v1/mandate/biometric_challengesthe assertion signs. biometric_assertionobject- The passkey assertion over the challenge.
purposestring- What the mandate is for, in plain text ("Restock printer paper for the office"). The person sees it with the limits, and every subagent's approval names it. Optional here for older clients; the console requires it.
agent_idstring- The registered agent that holds the mandate. Its name appears in the chain subagents carry.
max_depthinteger- How many levels below this mandate subagents may delegate (default 4; 0 = no delegation).
holder_keyobject- Bind the grant to its holder: the holder's P-256 public key as a JWK (
ktyEC,crvP-256,x,y; neverd). Only its RFC 7638 thumbprint is kept (holder_jkt), and the token carries it ascnf.jkt. Every use then needs a DPoP proof from that key (theDPoPheader). Leave it out for a bearer grant. Free on every plan.Show child attributes
ktyenumRequired- The key type. One of
EC. crvenumRequired- The curve. One of
P-256. xstringRequired- The x coordinate, base64url (32 bytes).
ystringRequired- The y coordinate, base64url (32 bytes).
Returns
Promise<GrantWithToken> The mandate, with its token. The token is shown only once.
HTTP operation
POST /v1/mandate/grants: Grant a mandate
Errors
- authentication_required
- insufficient_scope
- invalid_json
- parameter_invalid
- parameter_missing
- rate_limit_exceeded
- usage_limit_reached
Example
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/grants`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"device_id": "dev_00000000000000000000000000000001",
"agent_session_id": "sess_buyer_1",
"purpose": "Pay Brindlecote Supplies invoices this year",
"constraints": {
"max_amount": 400,
"budget_amount": 500,
"budget_window": "day",
"allowed_action_types": [
"payment"
],
"allowed_counterparties": [
"acct_brindlecote_supplies"
],
"expires_at": "2027-12-31T23:59:59Z"
},
"holder_key": {
"kty": "EC",
"crv": "P-256",
"x": "NeVHu4qeD40iEEgSDcTm26Y0xApkjq41T6BuENVl0js",
"y": "qS59-GAPcl0bJ-yYFvPJA3omsU9DJFedMw4rou5cXo8"
}
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/mandate/grants", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"device_id": "dev_00000000000000000000000000000001",
"agent_session_id": "sess_buyer_1",
"purpose": "Pay Brindlecote Supplies invoices this year",
"constraints": {
"max_amount": 400,
"budget_amount": 500,
"budget_window": "day",
"allowed_action_types": [
"payment"
],
"allowed_counterparties": [
"acct_brindlecote_supplies"
],
"expires_at": "2027-12-31T23:59:59Z"
},
"holder_key": {
"kty": "EC",
"crv": "P-256",
"x": "NeVHu4qeD40iEEgSDcTm26Y0xApkjq41T6BuENVl0js",
"y": "qS59-GAPcl0bJ-yYFvPJA3omsU9DJFedMw4rou5cXo8"
}
}).json()