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, orspent(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. Anext_cursorcarries its order; pass it back with the samesort. One ofcreated,-created,spent,-spent. limitintegerquery- Page size, 1–100 (default 20). Outside the range → 400 parameter_invalid.
cursorstringquery- Opaque; pass a response's
next_cursorback 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 ofproposed,took_part,none.
Returns
Promise<Run[]> The runs.
HTTP operation
GET /v1/mandate/runs: List runs
Errors
- authentication_required
- insufficient_scope
- parameter_invalid
- rate_limit_exceeded
- run_outside_counts_unavailable
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();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/mandate/grants", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"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()
mandate_id = step1["id"]
step2 = httpx.post(f"{api}/v1/mandate/runs", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"root_grant_id": mandate_id
}).json()
data = httpx.get(f"{api}/v1/mandate/runs", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()