SDK reference · Python SDK
prov.mandate.grants.propose_as_holder
prov.mandate.grants.propose_as_holder in Python SDK. propose as the agent that holds the mandate, with no account key (holder proof, as delegate_as_holder).
Signature
prov.mandate.grants.propose_as_holder(mandate_id: str, parent_token: str, private_jwk: Mapping[str, Any], directory_url: str, children: list, supersedes: Optional[str] = …, expires_in: Optional[int] = …, notify: Optional[bool] = …, keyid: Optional[str] = …) -> AnyParameters
mandate_idstrRequiredparent_tokenstrRequiredprivate_jwkMapping[str, Any]Requireddirectory_urlstrRequiredchildrenlistRequiredsupersedesOptional[str]expires_inOptional[int]notifyOptional[bool]keyidOptional[str]
Request fields
Idempotency-Keystringheader- Retry a create safely: the same key + request returns the stored response (24 h, per caller).
Content-Digeststringheader- Holder proof:
sha-256=:<base64>:of the request body as sent (RFC 9530). Signature-Inputstringheader- Holder proof: the signature's covered components and parameters.
Signaturestringheader- Holder proof: the agent's Ed25519 signature.
Signature-Agentstringheader- Holder proof: the agent's directory URL.
idstringpathRequired- The parent mandate's ID.
approverobject- Display only: the name of the person you expect to answer ("Maya Chen"). The run reads
waiting_on: "Maya Chen"while the proposal waits, and your reads of the proposal return it asapprover. Never shown on the plan page.Show child attributes
namestring- One line of 1 to 100 characters.
childrenarray of objectsRequired- The proposed children, in the order the person sees them.
Show child attributes
agent_idstringRequired- A registered agent of the account that will hold the child.
purposestringRequired- What the child is for.
purpose_tagsarray of strings- Up to 10 of the parent's action types or counterparties.
constraintsobject- The child's limits, as
POST /v1/mandate/grants/{id}/delegatetakes them. budgetobject- A budget's two settings, the same on company grants and on a person's subagents.
allocation: is the money set aside for this budget (reserved, so its siblings can't spend it) or drawn from what the parent has left (shared, "Flexible share")?at_limit: when it reaches its amount, does itstop(refuse anything past it),ask(ask the person, or the grant's approver, up toask_up_topast it, then refuse) orcontinue(go past without asking while every budget above it has room)? Any allocation combines with any limit behaviour.Show child attributes
allocationenumreserved: set aside from the parent; siblings can't spend it.shared: drawn from what the parent has left. One ofreserved,shared.at_limitenumstop: refuse past the amount.ask: ask the person, refusing pastask_up_to.continue: go past without asking while every budget above has room. One ofstop,ask,continue.ask_up_toobject | null- With
askonly: how far past the amount a person may still be asked, as a percentage of it (percent, 20 by default when left out) or a fixedamountin the grant's currency. Exactly one of the two.nullasks at any amount the parent has room for.Show child attributes
percentnumber- The margin, in percent of the amount (10: ask up to 1.1 times it).
amountnumber- The margin as a fixed amount in the grant's currency.
max_depthinteger- How deep its own subtree may go.
supersedesstring- A pending proposal on the same mandate this one replaces (it becomes
superseded). expires_ininteger- Seconds the proposal waits for the person (24 hours by default, never past the mandate's expiry).
notifyboolean- Tell the person by text and email.
falsewhen the agent sendsapprove_urlitself. parent_tokenstring- Holder proof, in place of an account key: the mandate's own token, with a request signature from a key registered to the agent the mandate names, as on
POST /v1/mandate/grants/{id}/delegate. limits_versioninteger- Sandbox only (
400in live): a version of the account's mandate limits, a draft included, to apply instead of the live version. The account's published limits fill what a child leaves out (the share mode, the merchant lists, a provisioned cap's own budget setting) and cap the budgets handed on together (mandate_limits_cap_exceeded). draft_groupstring- With
limits_version: the draft's group, when it was saved in one (a draft of another group is400).
Returns
Any The proposal, the hosted page's link (shown once) and how the person was told.
HTTP operation
POST /v1/mandate/grants/{id}/delegation_proposals: Propose a delegation structure
Errors
- authentication_required
- holder_proof_invalid
- parameter_invalid
- delegation_exceeds_parent
- delegation_depth_exceeded
- delegation_limit_reached
- mandate_limits_cap_exceeded
- resource_missing
- purpose_tags_exceed_parent
- grant_invalid
- proposal_closed
- rate_limit_exceeded
- resource_missing
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": "Scout Flights", "category": "shopping_agent" }),
})).json();
const flightsId = step1.id;
const step2 = 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": "Scout Stays", "category": "shopping_agent" }),
})).json();
const staysId = step2.id;
const step3 = 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",
"purpose": "Book Maya's Lisbon trip, 12 to 16 March",
"constraints": {
"max_amount": 1300,
"budget_amount": 2400,
"budget_window": "month",
"currency": "USD",
"allowed_mcc": [
{
"group": "airlines"
},
{
"group": "lodging"
}
],
"expires_at": "2027-12-31T23:59:59Z"
}
}),
})).json();
const mandateId = step3.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/grants/${mandateId}/delegation_proposals`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"notify": false,
"approver": {
"name": "Maya Chen"
},
"children": [
{
"agent_id": flightsId,
"purpose": "Book the flights",
"budget": {
"allocation": "shared",
"at_limit": "continue"
},
"constraints": {
"budget_amount": 900,
"allowed_mcc": [
{
"group": "airlines"
}
]
}
},
{
"agent_id": staysId,
"purpose": "Book the stay",
"budget": {
"allocation": "reserved",
"at_limit": "stop"
},
"constraints": {
"budget_amount": 1100,
"allowed_mcc": [
{
"group": "lodging"
}
],
"allowed_counterparties": [
"casamarlinde.example"
]
}
}
]
}),
})).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": "Scout Flights",
"category": "shopping_agent"
}).json()
flights_id = step1["id"]
step2 = httpx.post(f"{api}/v1/mandate/agents", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"name": "Scout Stays",
"category": "shopping_agent"
}).json()
stays_id = step2["id"]
step3 = httpx.post(f"{api}/v1/mandate/grants", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"device_id": "dev_00000000000000000000000000000001",
"purpose": "Book Maya's Lisbon trip, 12 to 16 March",
"constraints": {
"max_amount": 1300,
"budget_amount": 2400,
"budget_window": "month",
"currency": "USD",
"allowed_mcc": [
{
"group": "airlines"
},
{
"group": "lodging"
}
],
"expires_at": "2027-12-31T23:59:59Z"
}
}).json()
mandate_id = step3["id"]
data = httpx.post(f"{api}/v1/mandate/grants/{mandate_id}/delegation_proposals", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"notify": False,
"approver": {
"name": "Maya Chen"
},
"children": [
{
"agent_id": flights_id,
"purpose": "Book the flights",
"budget": {
"allocation": "shared",
"at_limit": "continue"
},
"constraints": {
"budget_amount": 900,
"allowed_mcc": [
{
"group": "airlines"
}
]
}
},
{
"agent_id": stays_id,
"purpose": "Book the stay",
"budget": {
"allocation": "reserved",
"at_limit": "stop"
},
"constraints": {
"budget_amount": 1100,
"allowed_mcc": [
{
"group": "lodging"
}
],
"allowed_counterparties": [
"casamarlinde.example"
]
}
}
]
}).json()