SDK reference · Python SDK
prov.mandate.grants.add_trusted_agent
prov.mandate.grants.add_trusted_agent in Python SDK. Add a trusted outside agent (an admin key): {"kind": "provenance_agent", "agent_id":...} or {"kind": "key", "name":..., "origin": "https://...", "holder_key": <P-256 public JWK>}, with optional caps.
Signature
prov.mandate.grants.add_trusted_agent(receiver: dict, max_amount: Optional[float] = …, budget_amount: Optional[float] = …) -> AnyParameters
receiverdictRequiredmax_amountOptional[float]budget_amountOptional[float]
Request fields
receiverobjectRequiredprovenance_agentwithagent_id, orkeywithname,originandholder_key.Show child attributes
kindenumRequired- How the agent is named. One of
provenance_agent,key. agent_idstring- An agent registered in another account.
namestring- The agent's name (up to 100 characters).
originstring- The agent's https origin, such as
https://seats.skydesk.example. holder_keyobject- The agent's P-256 public key (JWK).
max_amountnumber- The highest per-order cap that skips the ask.
budget_amountnumber- The highest budget that skips the ask.
Returns
Any The trusted agent.
HTTP operation
POST /v1/mandate/trusted_agents: Add a trusted outside agent
Errors
- authentication_required
- insufficient_scope
- insufficient_role
- invalid_json
- parameter_invalid
- resource_missing
- rate_limit_exceeded
Example
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/trusted_agents`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"receiver": {
"kind": "key",
"name": "SkyDesk Seats",
"origin": "https://seats.skydesk.example",
"holder_key": {
"kty": "EC",
"crv": "P-256",
"x": "NeVHu4qeD40iEEgSDcTm26Y0xApkjq41T6BuENVl0js",
"y": "qS59-GAPcl0bJ-yYFvPJA3omsU9DJFedMw4rou5cXo8"
}
},
"max_amount": 600
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/mandate/trusted_agents", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"receiver": {
"kind": "key",
"name": "SkyDesk Seats",
"origin": "https://seats.skydesk.example",
"holder_key": {
"kty": "EC",
"crv": "P-256",
"x": "NeVHu4qeD40iEEgSDcTm26Y0xApkjq41T6BuENVl0js",
"y": "qS59-GAPcl0bJ-yYFvPJA3omsU9DJFedMw4rou5cXo8"
}
},
"max_amount": 600
}).json()