Skip to main content
Update an approval rule

Authorizations

Authorization
string
header
required

Personal API key sent as a bearer token, together with X-Organization-Id. The key must have at least the access level the endpoint requires (read, write or admin).

Headers

X-Organization-Id
string

The organization to act in. Required for personal API keys; list the organizations you can access with GET /v1/organizations.

Path Parameters

id
string<uuid>
required

Body

application/json
name
string
Required string length: 1 - 100
conditions
object

What the rule applies to, as a View filter over the subject's fields. Both subjects: the workspace company (company.id). Invoices: only fields an invoice answers by itself: supplier, supplier country, recipient, amount, currency, references, delivery address and issued date (no relative ranges). Agreement fields are rejected, since agreements are matched after an invoice arrives. Purchase orders: supplier, buyer (recipient.id), amount excluding VAT, currency and owner. Required on create, except for the fallback rule, which has none.

approver_ids
string[]

Members who approve what the rule matches. Rules add people, never access. Puts everyone in step 1; send steps instead to approve in several steps, never both. Refused on a rule in several steps: send steps for it.

Maximum array length: 50
Required string length: 1 - 255
approver_team_ids
string<uuid>[]

Teams that approve what the rule matches: each counts as one approver, and whoever is in it while a request waits may decide for it. Puts everyone in step 1; send steps instead to approve in several steps, never both. Refused on a rule in several steps: send steps for it.

Maximum array length: 50
steps
object[]

Who approves what the rule matches, in steps, first step first (WD-2904). Steps set only the order: one approval from anyone in a step ends its turn and starts the next step's. The invoice is approved at the organization's required number of approvals, whatever the number of steps. A person or team is in one step only, and empty steps are dropped. Invoice rules only: a purchase order rule has one step. When several rules give an invoice approvers (without single_rule), approvers with the same step number share that step, and someone several rules name takes the step of the first rule in the rules' order. Invoices already waiting keep their approvers.

Maximum array length: 10
fallback
boolean

Whether the rule is the fallback, as it was created: a rule never becomes or stops being the fallback (WD-2930). Accepted when it matches.

Response

The saved rule.

id
string<uuid>
required
name
string
required
subject
enum<string>
required

What the rule approves: invoice, or purchase_order for orders made in Watchdog before they open, and amendments that raise their commitment or change their supplier, buyer, currency or commitment basis. Fixed once the rule is created.

Available options:
invoice,
purchase_order
fallback
boolean
required

The fallback rule: who approves what no other rule of its subject gives approvers, at intake after the other rules, and when a waiting record loses its last approver. It has no conditions and matches every record, so a fallback for purchase orders makes every order made in Watchdog wait for approval. At most one per subject (WD-2930). Rules made as fallbacks before then may still have conditions and keep them.

position
integer
required

Where the rule stands in the organization's order, lowest first. Under the approval policy's single_rule, an invoice takes its approvers from the first rule that matches it, in that rule's steps. Otherwise every matching rule adds its approvers by step number, and someone several rules name takes the step of the first.

Required range: x >= 0
approvers
object[]
required
approver_teams
object[]
required

Teams that approve what the rule matches, by name.

references
object[]
required

Names of the companies, suppliers and recipients the conditions name.

skipped_people
object[]
required

People the rule names but did not add, once per person and reason, on invoices in Inbox or Needs approval, as of when each invoice arrived. Blocking reasons come first, then hand removals.

skipped_teams
object[]
required

Teams the rule names but did not add, on invoices in Inbox or Needs approval, as of when each invoice arrived, by name. Such an invoice gets the fallback rules' approvers, or none.

created_at
string<date-time>
required
updated_at
string<date-time>
required
conditions
any

A saved View filter, returned as stored for unrestricted callers; it may be null or no longer valid. A restricted caller receives null with filter_restricted=true when the definition contains unavailable references or cannot be safely read. To replace it, send a filter in the shape the View create and update requests accept.