SDK reference · Python SDK

prov.mandate.grants.propose

prov.mandate.grants.propose in Python SDK. Propose a delegation structure under a mandate you hold.

Signature

prov.mandate.grants.propose(mandate_id: str, children: list, supersedes: Optional[str] = …, expires_in: Optional[int] = …, notify: Optional[bool] = …, limits_version: Optional[int] = …, draft_group: Optional[str] = …, approver: Optional[dict] = …) -> Any

Parameters

mandate_idstrRequired
childrenlistRequired
supersedesOptional[str]
expires_inOptional[int]
notifyOptional[bool]
limits_versionOptional[int]
draft_groupOptional[str]
approverOptional[dict]

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 as approver. 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}/delegate takes 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 it stop (refuse anything past it), ask (ask the person, or the grant's approver, up to ask_up_to past it, then refuse) or continue (go past without asking while every budget above it has room)? Any allocation combines with any limit behaviour.
Show child attributes
allocationenum
reserved: set aside from the parent; siblings can't spend it. shared: drawn from what the parent has left. One of reserved, shared.
at_limitenum
stop: refuse past the amount. ask: ask the person, refusing past ask_up_to. continue: go past without asking while every budget above has room. One of stop, ask, continue.
ask_up_toobject | null
With ask only: 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 fixed amount in the grant's currency. Exactly one of the two. null asks 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. false when the agent sends approve_url itself.
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 (400 in 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 is 400).

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

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();

Was this page helpful? Send us feedback

LLM? Read llms.txt.