---
title: Finance approvals
description: One approval engine for every Finance module. Policies with typed conditions and versions, approval steps and who they name, delegation, what happens when a document changes, bulk approval and exceptions, break-glass, agents, reminders and escalation, and the tools.
section: finance
order: 60
audience: [user, operator, agent]
sources: [services/nodejs-cloud/lib/finance/core/approvals, services/nodejs-cloud/app/(finance)/finance/approvals, services/nodejs-cloud/app/(finance)/finance/settings/approval-policies, services/nodejs-cloud/migrations/0426_fin_approvals.sql]
features: [cloud.page-finance]
---

Petawork Finance has one approval engine. A module that needs a document approved (a bill, a payment run, an expense
report) sends it through the engine, and the engine finds the approval policy that applies, works out who approves
each step, and records every decision on the [Finance audit trail](/docs/finance/audit-trail.md). Approvals that wait for you show
in **Finance > Approvals**, in the bell, and in [Drafts](/docs/cloud/drafts.md).

No module sends documents yet. The engine ships with an empty list of document types: the modules that own bills,
payment runs and expense reports register theirs when they arrive. You can write policies for those types now, and
try them in the simulator.

## Policies {#policies}

A policy says which documents it covers and who approves them. Set policies up in **Finance > Settings > Approval
policies** (`/finance/settings/approval-policies`). Each policy has:

- a **document type**: `bill`, `purchase_request`, `expense_report`, `advance`, `payment_run`, `write_off`,
  `credit_memo`, `bank_change` or `override` (and any type a module registers);
- an **entity**, or none for a policy that covers every entity;
- a **priority**, from 0 to 10000, where lower is tried first;
- **conditions**, which say which documents of that type it covers (below);
- one to ten **steps**, in order;
- whether it is **active**.

When a document is sent for approval, the engine tries the active policies for its type: the ones for the document's
entity before the ones for every entity, then lower priority first, then the older policy first. The first policy
whose conditions match routes the document.

A document that matches no policy is **refused** with `no_policy`. It is never approved by itself. A document type may
declare a fallback instead, in which case any controller on the document's entity approves it in one step. An approver step naming the controller role, and this fallback, include the organisation's owners and admins: they manage Finance and act as controllers on every entity, even when nobody holds a controller grant. The requester never approves their own document.

### Versions {#versions}

Saving a policy never changes the stored policy. It writes the next version, and the old one is kept. Each approval
request records the policy and the exact version it ran under, so you can always see what the chain was when the
document was sent.

### Checks when you save {#save-checks}

Saving refuses a policy where someone who may approve at any step also holds `payment_releaser`, so one person could
approve and release the same payment.

It warns, and saves:

- when the last step has only one possible approver, such as a finance director. Other people's documents route to
  them as usual. That person's own documents go to the step's escalation target, or are refused if the step has none
  (see [Steps and approvers](#steps)). Give the last step an escalation target to cover them.
- when a step names nobody today: a Finance role nobody holds, an empty team, no team with an admin for "the
  requester's manager", or no owner on any value of the dimension a "dimension owner" step names.

Only a controller edits policies (`policies.write`, OAuth scope `finance:admin`). An agent never does.

## Conditions {#conditions}

Conditions look at the document's facts:

| Field | Operators | Value |
|---|---|---|
| `amount` | `gte`, `gt`, `lte`, `lt`, `between` | Whole minor units in the entity's functional currency (`between` takes `[from, to]`, both included) |
| `entity` | `in` | Entity ids |
| `dimension` | `in` | A dimension's `key` and the value codes |
| `party` | `in` | Party ids |
| `category` | `in` | Category names |
| `flags` | `has` | `no_po`, `over_po`, `risk_high`, or a flag the document type adds |

Combine them with `all`, `any` and `not`. `{"all": []}` matches every document. A condition with an unknown field,
operator or value is refused, and the message says where:

```json
{"all": [
  {"field": "amount", "op": "gte", "value": 500000},
  {"any": [{"field": "flags", "op": "has", "value": "no_po"}, {"field": "dimension", "key": "cost_centre", "op": "in", "value": ["FB"]}]}
]}
```

Amounts are compared as whole numbers of minor units, so 500000 in SGD is 5,000.00. A document in another currency is
converted at the rate for the day it is sent ([exchange rates](/docs/finance/reference-data.md)); without a rate it is refused with
`fx_missing`.

The editor shows each condition in plain words, one row each.

## Steps and approvers {#steps}

Each step names its approvers, a mode, an optional SLA and escalation target, and whether agents may approve there.

| Approver | Who it names |
|---|---|
| Member | That person (or agent) |
| Finance role | Everyone holding that [Finance role](/docs/finance/roles.md) on the document's entity or on every entity |
| Team | The team's members, including members of the teams above it |
| The requester's manager | The admins of the org teams the requester belongs to. The organisation has no manager field, so a team's admin stands for it. A requester in no team with an admin has no manager, and a step that only names the manager is refused for them |
| Dimension owner | The owner of the document's value of that dimension. Set an owner on each value in **Finance > Settings > Dimensions** |

**Mode** `any` completes the step with one approval. `all` needs every approver.

The approvers are worked out when the document is sent and kept with the request. The person who sent it is taken off
the last step: the requester is never the final approver of their own item. When that leaves the last step with nobody,
it goes to the step's escalation target if it has one who is someone other than the requester. The step is then marked
escalated from the start, with the reason, on the request, its event and in the simulator. Without such a target the
document is refused as `self_approval`, with the reason. Any other step that names nobody is refused as `unresolvable`.
The requester can still never decide the last step, even when a delegation would let them stand in for an approver.

Anyone who is part of a request (the requester, an approver, a delegate) can **ask a colleague for a comment**. The
colleague can then see the request and comment on it. They never decide.

## Delegation {#delegation}

When you are away, hand your approvals to a colleague for a range of dates. While the delegation is live, your slot on
any step goes to them, and their decision is recorded as made on your behalf. Set your own delegation in **Finance >
Approvals**; a controller can set one for anyone. Approvals are only ever handed to a person, never an agent.

A delegation also covers requests that were sent before it started: while it is live, the delegate can decide them for
you.

## When the document changes {#supersede}

Each request keeps a hash of the version that was sent. If the amount, the coding or the lines change after that, the
request is marked **superseded** and the new version is routed from scratch, under the policies as they are then. An
approval of one version never covers another. A decision made on a request whose document has since changed is
refused, and the new request is named.

There is only one live request per document.

## Deciding {#deciding}

**Finance > Approvals** (`/finance/approvals`) lists what waits for you: amount, requester, document and how long it has waited. Approve or
reject with a comment in one step. It works at phone width.

- Only the approvers listed on the current step, or their delegates while they are away, decide.
- The requester can never decide the last step, even if listed there. This is checked again when the decision is made.
- When a step completes, the next one starts. When the last one completes, the document is approved. One rejection
  rejects the request.
- The requester can **withdraw** a pending request.

### Bulk approval and exceptions {#bulk}

Select several requests and approve or reject them together. Anything with an open [exception](/docs/finance/exceptions.md) is left
out, and the answer says which ones and why. An exception counts when its subject is the document (its `subject_kind`
is the document type, such as `bill`, and its `subject_id` the document's id) or the request itself (`approval_request`
and the request's id). Resolve or waive the exception, then approve.

### Break-glass {#break-glass}

A controller on the document's entity can force a decision, approve or reject, on a pending request. It needs a written
reason of at least 20 characters and three words. It is recorded as its own kind of decision and its own event, and
the request is marked break-glass. The **Break-glass** filter in Finance > Approvals (and `break_glass` on
`finance_approval_list`) lists every one. The requester can never break the glass on their own request, and an agent
never can.

## Agents {#agents}

An agent's approval counts as one approver only where the policy step says agents are allowed (`allow_agents`), and only
when the agent's Finance roles allow `approvals.decide` on the document's entity. Otherwise its decision is refused. An
agent and the person who set it up count as the same party, so an agent never approves its owner's own request at the
last step. Agent jobs with their own authority rules are not in Petawork yet; when they arrive, their rule will be
checked too.

## Reminders and escalation {#reminders}

A sweep runs in the background:

- A step past its SLA is **escalated** once: its escalation target sees it in the bell beside the approvers.
- A step that has waited a day or more gets a **reminder** at most once a day: it comes back to the top of its
  approvers' bell.

Both are recorded on the audit trail. Nothing is sent outside Petawork: no email, no message.

## Who would approve this {#simulator}

The simulator in **Finance > Settings > Approval policies** answers who would approve a document: pick the document type,
entity, amount, flags and dimension values, and it shows the policy and every step's approvers, or why the document
would be refused. It uses the same rules as a real submission.

## For agents {#tools}

| Tool | Scope | What it does |
|---|---|---|
| `finance_approval_list` | `finance:read` | `view` `mine` (waiting on you), `requested` or `all`; filters `status`, `doc_type`, `entity_id`, `break_glass` |
| `finance_approval_get` | `finance:read` | One request with its steps, approvers and decisions |
| `finance_approval_decide` | `finance:write` | `decision` `approve`, `reject`, `withdraw`, `comment`, `request_comment` (with `member`) or `break_glass` (with `outcome` and the reason in `comment`); `ids` instead of `id` to approve or reject several |
| `finance_approvalpolicy_list` | `finance:read` | The current policies in the order they are tried |
| `finance_approvalpolicy_get` | `finance:read` | One policy and its versions; or, with `simulate`, who would approve a document |
| `finance_approvalpolicy_update` | `finance:admin` | Create a policy (no `id`) or save its next version |
| `finance_delegation_list` | `finance:read` | Your delegations (everyone's for a controller) |
| `finance_delegation_update` | `finance:write` | Set a delegation, or end one with `id` and `revoked: true` |

The REST twins are under `/api/v1/finance/approvals`, `/api/v1/finance/approval-policies` (with `POST …/simulate`) and
`/api/v1/finance/delegations`. Each request's history is `finance_event_list` with `subject_kind` `approval_request`.

## For module authors {#modules}

A module registers each document type it sends for approval, with how to read a document (its label, entity, amount
and currency, dimensions, party, category, flags and requester), how to hash a version, optional checks before sending
(a problem can warn or block), and what to do when it is approved or rejected. The engine calls each of those once, in
the transaction that decides. A type may also declare the controller fallback. The registry is empty in production
today; the tests register a test type of their own.
