View as Markdown

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
  1. Approver selects
    up to 25 in the portal
  2. One passkey prompt
    signs the whole list
  3. Each request approved
    one 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 /v1/mandate/settings/approvals:

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 }'
{
  "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_reasonThe request
over_batch_max_amountIs above your batch_max_amount
option_groupHas options to choose from
first_time_payeeIs the first approved payment to this payee
individual_requiredMatched a rule with require: { individual: true }
plan_below_growthCame 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"] }'
{
  "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_challenge returns the challenge for exactly the ticked requests, or batch_not_allowed for one that needs its own review.
  • POST /v1/embed/approvals/batch verifies the one assertion and approves each request, with the same batch_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

CodeStatusWhat to do
batch_not_allowed409Leave the listed requests out and approve them one at a time.
parameter_invalid400Send the list the page showed, with its challenge; list each request once and only your own.
approver_enrollment_failed400The assertion isn't from this approver's passkey.
resource_missing404The batch link expired or was used.

See also