SDK reference · Python SDK
prov.mandate.network.request_grant
prov.mandate.network.request_grant in Python SDK.
Signature
prov.mandate.network.request_grant(**body: Any = …) -> AnyParameters
**bodyAny
Request fields
agent_idstringRequired- Your registered agent (it needs an active signing key).
proposedobjectRequired- A network mandate's limits. The person's rules apply on top.
Show child attributes
max_amountnumber | null- Per-order limit, in major units.
budget_amountnumber | null- Budget per
budget_window, in major units. budget_windowenum- The budget window, counted in UTC. One of
day,week,month. currencystringRequired- ISO 4217; an order in another currency is refused.
allowed_storesarray of strings | null- Store origins it may buy at without asking; null for any store.
blocked_storesarray of strings- Store origins it must never buy at.
allowed_categoriesarray of enums- Store categories it may buy at without asking (the store directory's list); empty for any.
heartbeatobject | null- Check-ins (
interval: weekly, biweekly or monthly;grace_hours); it stops if the person doesn't confirm. expires_attimestampRequired- At most a year out.
purposestring- What the permission is for, in plain text ("Restock printer paper for the office"). Set by the request and shown on the grant screen; the person sets the limits, not the purpose. Present when set.
accept_withinobject- How far an outside agent's offer may differ from a brief before the person is asked (
constraints.accept_withinon a grant). Every field is optional; a child grant inherits what it leaves out and can't loosen a field, nor set one its parent leaves out (past the strictest value). With none anywhere in the chain, only an offer no worse in every way is accepted alone. Never on the grant token.Show child attributes
price_up_pctnumber- The most the price may rise, as a percentage of the brief's price line.
price_up_amountnumber- The most the price may rise, in the grant's currency (major units). Both price fields must pass when both are set.
date_earlier_minutesinteger- How much earlier a date may move.
date_later_minutesinteger- How much later a date may move.
substitutesenum- Whether a substitute item in the brief line's category may be accepted. One of
none,same_category. quantity_shortenum- Whether an offer of part of the quantity may be accepted. One of
none,partial. terms_worseboolean- Whether worse terms (not refundable, an earlier cancellation deadline, a change fee, later delivery) may be accepted.
other_sellerboolean- Whether a seller other than the brief's counterparties may be accepted.
on_timeoutenum- What happens when the person doesn't answer an ask (default
decline). Asks arrive in a later slice. One ofdecline,accept_within_tolerances.
payment_cardobject | null- The card this grant pays with (
personal_card_id), checked only where Provenance decides the payment. Present when set; never in a token.Show child attributes
personal_card_idstring- The person's card (
pcard_…).
return_urlstring- Where the grant screen sends the person afterwards (https).
hard_maxobject- The most a person may raise a network grant's money limits to, set by the agent's maker on its grant request. Never below the ask. A person may raise above the ask with their passkey, up to this line; with no
hard_maxthere is no maker ceiling.Show child attributes
max_amountnumber | null- The highest per-order limit a person may set; null for no ceiling.
budget_amountnumber | null- The highest budget a person may set; null for no ceiling.
limit_notice_channelsobject- This grant's near-limit channels, overriding your setting at
/v1/mandate/settings/limit_notices.Show child attributes
pushboolean- Push to the app or the web home.
textboolean- A text (billed to you).
emailboolean- An email.
Returns
Any The request, with grant_url.
HTTP operation
POST /v1/mandate/grant_requests: Ask a person for a network mandate
Errors
Example
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/agents`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "name": "cartwise", "category": "shopping_agent" }),
})).json();
const agentId = step1.id;
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/identify/agents/${agentId}/signing_keys`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"jwk": {
"kty": "OKP",
"crv": "Ed25519",
"x": "G_STrQBvTD7Bi8OjlNnLcKPPiPp03Vh0sJKTMG7QzFY"
}
}),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/grant_requests`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"agent_id": agentId,
"proposed": {
"max_amount": 50,
"budget_amount": 200,
"budget_window": "month",
"currency": "USD",
"expires_at": "2027-06-30T00:00:00Z"
},
"return_url": "https://cartwise.example/connected",
"hard_max": {
"max_amount": 100,
"budget_amount": 400
}
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/mandate/agents", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"name": "cartwise",
"category": "shopping_agent"
}).json()
agent_id = step1["id"]
step2 = httpx.post(f"{api}/v1/identify/agents/{agent_id}/signing_keys", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"jwk": {
"kty": "OKP",
"crv": "Ed25519",
"x": "G_STrQBvTD7Bi8OjlNnLcKPPiPp03Vh0sJKTMG7QzFY"
}
}).json()
data = httpx.post(f"{api}/v1/mandate/grant_requests", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"agent_id": agent_id,
"proposed": {
"max_amount": 50,
"budget_amount": 200,
"budget_window": "month",
"currency": "USD",
"expires_at": "2027-06-30T00:00:00Z"
},
"return_url": "https://cartwise.example/connected",
"hard_max": {
"max_amount": 100,
"budget_amount": 400
}
}).json()