Mandate · Guide
Approve requests in a batch
Available on Pro, Growth and Enterprise
Use batch approval when one approver has many routine requests waiting, such as 30 invoices from the same company. The approver portal lists everything waiting for them, newest first. Approve selected approves up to 25 with one passkey prompt, and each request still gets its own ledger row and its own mandate.approval.approved webhook.
Before you begin: route approvals to an approver link. Batch approval is for the requests your approvers decide; decide your own in the console.
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
- Approver selectsup to 25 in the portal
- One passkey promptsigns the whole list
- Each request approvedone ledger row each
1. Set the batch limit
Any request above batch_max_amount stays out of a batch. It's 1,000 by default; change it with PUT /:
curl -s -X PUT $PROVENANCE_API/v1/mandate/settings/approvals \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "batch_max_amount": 500 }'
const res = await fetch(`${process.env.PROVENANCE_API}/v1/mandate/settings/approvals`, {
method: "PUT",
headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ batch_max_amount: 500 }),
});
const settings = await res.json();
import os
import httpx
settings = httpx.put(f"{os.environ['PROVENANCE_API']}/v1/mandate/settings/approvals",
headers={"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"}, json={"batch_max_amount": 500}).json()
{
"object": "approval_settings",
"batch_max_amount": 500
}
What can't be batched
These stay in the list with Review on its own, and each batch_reason says why:
batch_reason | The request |
|---|---|
over_ | Is above your batch_ |
option_ | Has options to choose from |
first_ | Is the first approved payment to this payee |
individual_ | Matched a rule with require: { individual: true } |
plan_ | Came from a company on Free |
Mark the requests that always need their own review in your policy:
{ "id": "board-approves-each", "when": [{ "fact": "action_type", "op": "eq", "value": "board_payment" }], "require": { "approval": true, "individual": true } }
2. The approver selects requests
The portal reads GET /v1/mandate/approver/approvals with the approver's session. Each request carries batchable:
{
"object": "list",
"data": [
{ "id": "appr_01M5R0C09DQ4X7N2W8K5T3VB6M", "object": "approval", "action_description": "Pay invoice INV-2041: $850.00 to Brindlecote Supplies", "batchable": true },
{ "id": "appr_01M5R0E6T1V3X5Z7B9D2F4H6J8", "object": "approval", "action_description": "Pay invoice INV-2043: $4,800.00 to Brindlecote Supplies", "batchable": false, "batch_reason": "over_batch_max_amount" }
]
}
Approve selected calls POST /v1/mandate/approver/approvals/batch_link, which returns a single-use link (15 minutes) to the approval page:
curl -s $PROVENANCE_API/v1/mandate/approver/approvals/batch_link \
-H "Authorization: Bearer $APPROVER_SESSION" \
-H "Content-Type: application/json" \
-d '{ "approval_ids": ["appr_01M5R0C09DQ4X7N2W8K5T3VB6M", "appr_01M5R0D2K7W9ZQ3V5X8N4T6YBA"] }'
const link = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/approver/approvals/batch_link`, {
method: "POST",
headers: { Authorization: `Bearer ${approverSession}`, "Content-Type": "application/json" },
body: JSON.stringify({ approval_ids: ["appr_01M5R0C09DQ4X7N2W8K5T3VB6M", "appr_01M5R0D2K7W9ZQ3V5X8N4T6YBA"] }),
})).json();
link = httpx.post(f"{os.environ['PROVENANCE_API']}/v1/mandate/approver/approvals/batch_link",
headers={"Authorization": f"Bearer {approver_session}"},
json={"approval_ids": ["appr_01M5R0C09DQ4X7N2W8K5T3VB6M", "appr_01M5R0D2K7W9ZQ3V5X8N4T6YBA"]}).json()
{
"object": "approval_batch_link",
"approve_url": "https://app.provenanceauth.com/approve/batch/Zq4vB2nX8kR1tL6pW3sY9dF0hJ5mC7aE2gU4iO8eQ1w",
"count": 2
}
3. One passkey prompt approves the list
The batch page reads GET /v1/mandate/approval_batches: each request, whether it can go in the batch, and one challenge. The challenge carries sha256 of the sorted list of (approval_id, action_hash), so the approver's assertion signs exactly the requests they see. An approver who unticks a request gets a challenge for the rest.
POST /v1/mandate/approval_batches/respond verifies the assertion once and approves each request:
{
"object": "approval_batch",
"id": "abat_01M5R0F4Q8H2J6K9M3N7P1R5T8",
"status": "decided",
"decided_count": 2,
"results": [
{ "approval_id": "appr_01M5R0C09DQ4X7N2W8K5T3VB6M", "status": "approved" },
{ "approval_id": "appr_01M5R0D2K7W9ZQ3V5X8N4T6YBA", "status": "approved" }
]
}
Each request records the batch_id, gets its own ledger row, and meters as one decision. A list that doesn't match the challenge fails, and a request that can't be batched refuses the whole batch with batch_not_allowed, deciding nothing.
At verify, a batched approval adds the fact approval.batched, so a rule can treat it differently.
Approve selected in your product
<provenance-approvals> puts the same inbox in your own app for the approver who's signed in, with a token you mint for one of your approver links. It lists only your company's requests. The approver ticks the ones to approve and confirms once with their passkey:
POST /v1/embed/approvals/batch_challengereturns the challenge for exactly the ticked requests, orbatch_not_allowedfor one that needs its own review.POST /v1/embed/approvals/batchverifies the one assertion and approves each request, with the samebatch_id, ledger rows and metering as the batch page.
The component calls both for you and fires pv:batch_approved { batch_id, count, approval_ids }.
Errors you might see
| Code | Status | What to do |
|---|---|---|
batch_ | 409 | Leave the listed requests out and approve them one at a time. |
parameter_ | 400 | Send the list the page showed, with its challenge; list each request once and only your own. |
approver_ | 400 | The assertion isn't from this approver's passkey. |
resource_ | 404 | The batch link expired or was used. |