SDK reference · Node SDK

prov.mandate.runs.list

prov.mandate.runs.list in Node SDK. One page of your runs, newest first (20 by default; pass cursor from the previous page's next_cursor).

Signature

prov.mandate.runs.list(params?: ListRunsParams): Promise<Run[]>

Parameters

paramsListRunsParams

Request fields

sortenumquery
The order of the list: created, or spent (what the run's root grant spent this budget window), with - in front for descending. Newest first when omitted. Another order sorts the newest 1,000 runs that match the filters, and a run with no root grant or no budget sorts last. A next_cursor carries its order; pass it back with the same sort. One of created, -created, spent, -spent.
limitintegerquery
Page size, 1–100 (default 20). Outside the range → 400 parameter_invalid.
cursorstringquery
Opaque; pass a response's next_cursor back to get the next page.
statusarray of enumsquery
Only runs in these statuses. One value, or several separated by commas.
qstringquery
Search text. Matches when the run's ID or name contains it, ignoring case. At most 200 characters.
created_gtetimestampquery
Only runs started at or after this time.
created_ltetimestampquery
Only runs started at or before this time.
outside_agentenumquery
Only runs where an outside agent made a proposal (proposed), took part at all (took_part: a proposal or a brief the run sent it), or neither (none). Combines with the other filters and pages with the same cursor. One of proposed, took_part, none.

Returns

Promise<Run[]> The runs.

HTTP operation

GET /v1/mandate/runs: List runs

Errors

Example

const step1 = 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": "Restock printer paper for the office",
    "constraints": {
      "max_amount": 80,
      "budget_amount": 200,
      "budget_window": "month",
      "expires_at": "2027-12-31T23:59:59Z"
    }
  }),
})).json();
const mandateId = step1.id;
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/runs`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({ "root_grant_id": mandateId }),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/runs`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();

Was this page helpful? Send us feedback

LLM? Read llms.txt.