SDK reference · Node SDK
prov.mandate.grants.addTrustedAgent
prov.mandate.grants.addTrustedAgent in Node SDK. Add a trusted outside agent (an admin key).
Signature
prov.mandate.grants.addTrustedAgent(params: AddTrustedAgentParams): Promise<TrustedAgent>Parameters
paramsAddTrustedAgentParamsRequired
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
Promise<TrustedAgent> 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()