Update Approval Policy

PATCH /base/approval-policies/{id}

Group: Base › Approval Policies · Operation ID: updateApprovalPolicy

Updates the approval policy with the given identifier. Only the fields in the request body change.

The response is empty. Read the stored state back with GET base/approval-policies/:id. Omitting a field leaves it unchanged, at every level: the header's own fields, a line's fields and an approver's fields. Child collections are edited with three arrays, never by re-sending the collection. createLines adds lines, updateLines changes lines matched by id, and deleteLines removes lines by id, taking their approvers with them. The same split applies to exclusionLines and to each line's approvers. A line you do not mention survives. businessObject cannot be changed. A policy for a different document type is a different policy, so create one and delete this. Setting status to 'active', or moving the policy onto entity coverage that another active policy already covers, fails with CONFLICTING_ACTIVE_POLICY. Editing a policy that already overlaps another is allowed, so a tenant that acquired overlapping policies can still correct them. After your operations the policy must still have at least one rule line, and every surviving line at least one approver, otherwise NO_LINES or LINE_WITHOUT_APPROVERS.

Open in the interactive reference

Parameters

Name In Type Required Description
Api-Version header "v1" yes The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version v1.
Idempotency-Key header string no An opaque caller-chosen string (1-255 characters) that makes this request safe to retry. Repeating the same key with an identical request body replays the original response instead of re-executing - but only once that original request succeeded; a failed attempt re-executes on retry. Repeating the key with a different body is answered with 422. A key still in flight is answered with 409 - as is a key whose original request was interrupted before it finished, for a few minutes afterwards, until that attempt is presumed dead. A completed response stays replayable for 24 hours. The key is scoped to the caller, not to the action: reusing it for a different action is answered with 409 or 422 rather than treated independently. On read actions this header is ignored. On write actions that cannot offer the guarantee it is answered with 400 IDEMPOTENCY_NOT_SUPPORTED rather than silently ignored.
id path string yes The unique identifier for the approval policy to update.

Request body

Required, application/json: updateApprovalPolicyInput.

Field Type Required Description
entityId string no The legal entity the policy applies to. Omit to leave unchanged. Ignored when isAllEntities is true. See id on GET base/entities.
isAllEntities boolean no Whether the policy applies to every legal entity. Set true to widen it to all, false to narrow it back to the entity in entityId. Omit to leave unchanged.
status string, one of "active", "inActive" no The lifecycle status of the policy. Omit to leave unchanged. Setting 'inActive' stops the policy matching new documents, while documents already in the workflow keep approving against it, which makes it the safe alternative to deleting.
startDate string no The first date the policy is eligible for matching. Use format YYYY-MM-DD. Omit to leave unchanged.
endDate string no The last date the policy is eligible for matching. Use format YYYY-MM-DD. Omit to leave unchanged.
submitterCannotApprove boolean no Whether the document submitter is stopped from approving their own document. Omit to leave unchanged.
approverCommentEnabled boolean no Whether approvers are prompted for an optional comment at approve time. Omit to leave unchanged.
notification object no The notification channels for this policy. This object replaces the stored settings, so a channel left out is turned off. Omit the object to leave the settings unchanged.
notification.emailNotification boolean no
notification.nativeNotification boolean no
notification.slackNotification boolean no
createLines array of object no The rule lines to add. Each is a whole new line with no id, carrying its approvers as a plain array.
createLines[].criteria string yes The document field the rule tests, for example 'Vendor', 'Total Amount' or 'Upon Creation'. Pass the literal COMPOSITE to combine several conditions in one line.
createLines[].operator string yes The comparison to apply to the criteria, for example 'Equal', 'Not Equal', 'Greater Than', 'Less Than', 'In', 'Intersect' or the Any and All variants for array fields. Use '-' for a criteria that takes no value.
createLines[].value array of string no The values to compare against, each as a string. Omit only when valueType is 'noValue'.
createLines[].valueType string, one of "number", "multivalue", "value", "noValue", "arrayField", "composite" yes How to interpret value. 'number' is a single numeric comparison, 'multivalue' one or more discrete values, 'value' a single discrete value, 'noValue' a criteria that takes none such as 'Upon Creation', 'arrayField' the Any, All and Intersect operators over a line-level array, and 'composite' a COMPOSITE expression.
createLines[].step number yes The approval order, starting at 1. Lines that share a step are approved together, and a higher step is reached only once the lower steps are satisfied.
createLines[].requireAction string, one of "All", "Any" no Whether all of the line's approvers must approve, or any one of them is enough. Defaults to 'All'.
createLines[].approvers array of object yes The approvers for this line. It must not be empty.
createLines[].approvers[].approverId number yes The approver. For approverType 'employee' or 'supremeApprover' it is the employee, and for 'manager' it is the manager-hierarchy record. It is an integer, not a UUID. There is no endpoint for it.
createLines[].approvers[].approverType string, one of "employee", "manager", "supremeApprover" yes
updateLines array of object no The rule lines to change, matched by id. Every field except id is optional, and omitting one leaves it unchanged. Each line edits its own approvers through the nested createApprovers, updateApprovers and deleteApprovers arrays.
updateLines[].id string yes The id of the existing rule line, from the line's id on GET base/approval-policies/:id. An id that does not belong to this policy fails with UNKNOWN_LINE.
updateLines[].criteria string no The document field the rule tests. Omit to leave it unchanged.
updateLines[].operator string no The comparison to apply to the criteria. Omit to leave it unchanged.
updateLines[].value array of string no The values to compare against, each as a string. This replaces the whole list rather than merging into it. Omit to leave it unchanged.
updateLines[].valueType string, one of "number", "multivalue", "value", "noValue", "arrayField", "composite" no How to interpret value. Omit to leave it unchanged.
updateLines[].step number no The approval order, starting at 1. Omit to leave it unchanged.
updateLines[].requireAction string, one of "All", "Any" no Whether all of the line's approvers must approve, or any one of them is enough. Omit to leave it unchanged.
updateLines[].createApprovers array of object no The approvers to add to this line.
updateLines[].createApprovers[].approverId number yes
updateLines[].createApprovers[].approverType string, one of "employee", "manager", "supremeApprover" yes
updateLines[].updateApprovers array of object no The approvers to change, matched by id. An id that does not belong to this line fails with UNKNOWN_APPROVER.
updateLines[].updateApprovers[].id string yes The id of the existing approver assignment, from the approver's id on GET base/approval-policies/:id.
updateLines[].updateApprovers[].approverId number no The approver. Omit to leave it unchanged.
updateLines[].updateApprovers[].approverType string, one of "employee", "manager", "supremeApprover" no The kind of approver. Omit to leave it unchanged.
updateLines[].deleteApprovers array of string no The ids of approver assignments to remove from this line. Removing the last approver of a surviving line fails with LINE_WITHOUT_APPROVERS.
deleteLines array of string no The ids of rule lines to remove. Deleting a line also removes its approvers, so do not list them separately.
createExclusionLines array of object no The exclusion lines to add.
createExclusionLines[].criteria string yes
createExclusionLines[].operator string yes
createExclusionLines[].value array of string no The values to compare against, each as a string. Omit only when valueType is 'noValue'.
createExclusionLines[].valueType string, one of "number", "multivalue", "value", "noValue", "arrayField", "composite" yes
updateExclusionLines array of object no The exclusion lines to change, matched by id. Omitting a field leaves it unchanged.
updateExclusionLines[].id string yes The id of the existing exclusion line. An id that does not belong to this policy fails with UNKNOWN_EXCLUSION_LINE.
updateExclusionLines[].criteria string no
updateExclusionLines[].operator string no
updateExclusionLines[].value array of string no
updateExclusionLines[].valueType string, one of "number", "multivalue", "value", "noValue", "arrayField", "composite" no
deleteExclusionLines array of string no The ids of exclusion lines to remove.

Example:

{
  "entityId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "isAllEntities": true,
  "status": "inActive",
  "startDate": "<startDate>",
  "endDate": "<endDate>",
  "submitterCannotApprove": true,
  "approverCommentEnabled": true,
  "notification": {
    "emailNotification": true,
    "nativeNotification": true,
    "slackNotification": true
  },
  "createLines": [
    {
      "criteria": "<criteria>",
      "operator": "<operator>",
      "value": [
        "<value>"
      ],
      "valueType": "number",
      "step": 0,
      "requireAction": "All",
      "approvers": [
        {
          "approverId": 0,
          "approverType": "employee"
        }
      ]
    }
  ],
  "updateLines": [
    {
      "id": "4e2b7a90-5c31-4d68-9f02-8a1c6b45e7d3",
      "value": [
        "25000"
      ],
      "createApprovers": [
        {
          "approverId": 77,
          "approverType": "employee"
        }
      ],
      "deleteApprovers": [
        "b8c5d2e1-3f47-4a90-8e16-5d2b9c703f8a"
      ]
    }
  ],
  "deleteLines": [
    "<deleteLines>"
  ],
  "createExclusionLines": [
    {
      "criteria": "<criteria>",
      "operator": "<operator>",
      "value": [
        "<value>"
      ],
      "valueType": "number"
    }
  ],
  "updateExclusionLines": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "criteria": "<criteria>",
      "operator": "<operator>",
      "value": [
        "<value>"
      ],
      "valueType": "number"
    }
  ],
  "deleteExclusionLines": [
    "1a3c5e70-9b24-4f18-a06d-7c8e2b41d95f"
  ]
}

Response

200 Success

Response headers

Errors

Code Status
NOT_FOUND 400
MISSING_ENTITY_SCOPE 400
ENTITY_NOT_FOUND 400
UNKNOWN_LINE 400
UNKNOWN_APPROVER 400
UNKNOWN_EXCLUSION_LINE 400
NO_LINES 400
LINE_WITHOUT_APPROVERS 400
MISSING_LINE_VALUE 400
INVALID_NUMBER_VALUE 400
INVALID_COMPOSITE_EXPRESSION 400
CONFLICTING_ACTIVE_POLICY 400
IDEMPOTENCY_KEY_CONFLICT 409
IDEMPOTENCY_PAYLOAD_MISMATCH 422

Statuses