SDK reference · Node SDK

prov.mandate.agents.setDefaults

prov.mandate.agents.setDefaults in Node SDK. Replace the agent's defaults (a key left out or null is cleared).

Signature

prov.mandate.agents.setDefaults(id: string, params: { askAbove?: { percentOfBudget: number } | { amount: number } | null; overLimit?: { percent: number } | { amount: number } | null; overUsual?: { percent: number } | null; }): Promise<AgentDefaults>

Parameters

idstringRequired
params{ askAbove?: { percentOfBudget: number } | { amount: number } | null; overLimit?: { percent: number } | { amount: number } | null; overUsual?: { percent: number } | null; }Required

Request fields

idstringpathRequired
The object's ID.
ask_aboveobject | any | null
{ percent_of_budget } (over 0, up to 100) or { amount }; null clears it.
Show child attributes
percent_of_budgetnumber
The share of the grant's budget as a percentage.
amountnumber
An amount in the grant's currency.
over_limitobject | any | null
{ percent } (0 to 1000) or { amount }; null clears it.
Show child attributes
percentnumber
The margin as a percentage of the limit.
amountnumber
The margin as an amount in the grant's currency.
over_usualobject | any | null
How far over the person's usual spend in a category to ask, in percent; null to turn it off. A percentage only.
Show child attributes
percentnumber
How far over the usual spend, in percent.

Returns

Promise<AgentDefaults> The defaults as saved.

HTTP operation

PUT /v1/mandate/agents/{id}/defaults: Set an agent's defaults

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": "Rooms" }),
})).json();
const agentId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/agents/${agentId}/defaults`, {
  method: "PUT",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "ask_above": {
      "percent_of_budget": 20
    },
    "over_limit": {
      "percent": 20
    },
    "over_usual": {
      "percent": 50
    }
  }),
})).json();

Was this page helpful? Send us feedback

LLM? Read llms.txt.