# Approval routing

Approver groups a rule's `route` sends approvals to, with escalation, a wait and what happens if nobody answers.

Related guide: [Route approvals](https://provenanceauth.com/docs/mandate/guides/route-approvals.md)

## Endpoints

- `POST /v1/mandate/approver_groups`: [Create an approver group](#post-v1-mandate-approver-groups)
- `GET /v1/mandate/approver_groups/{id}`: [Retrieve an approver group](#get-v1-mandate-approver-groups-id)
- `PATCH /v1/mandate/approver_groups/{id}`: [Update an approver group](#patch-v1-mandate-approver-groups-id)
- `PUT /v1/mandate/settings/approver_availability`: [Set Away and a backup](#put-v1-mandate-settings-approver-availability)
- `GET /v1/mandate/approver_groups`: [List approver groups](#get-v1-mandate-approver-groups)
- `GET /v1/mandate/approval_routes`: [List approval routes](#get-v1-mandate-approval-routes)
- `GET /v1/mandate/settings/approver_availability`: [List Away and backups](#get-v1-mandate-settings-approver-availability)
- `DELETE /v1/mandate/approver_groups/{id}`: [Delete an approver group](#delete-v1-mandate-approver-groups-id)

## The approver group object

### Attributes

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | no | `agr_…`, or a built-in ID. |
| `object` | enum | no | The type of object. One of `approver_group`. |
| `name` | string | no | The group's name. |
| `built_in` | boolean | no | Whether it's a built-in group. |
| `members` | array of objects | no | The members, in the order listed. |
| `members.person` | string | no | The person ref: `user:usr_…`, `user:owner` or `approver:lnk_…`. |
| `members.kind` | enum | no | A console member or an outside approver. One of `user`, `approver`. |
| `members.id` | string | no | The user ID (`owner` for the account owner) or the approver link ID. |
| `members.name` | string | no | Their email or display name. |
| `lead` | string \| null | no | The lead's person ref (a member), for `lead` escalation steps. |
| `channels_override` | array of enums \| null | no | The channels to try, in order, for this group's outside approvers. |
| `hours` | object \| any \| null | no | The group's business hours, for a route's `hours`. |
| `hours.time_zone` | string | no | An IANA time zone, such as `America/New_York`. |
| `hours.schedule` | object | no | Keys `mon` to `sun`, each a list of up to 4 intervals such as `["09:00", "17:00"]`. |
| `created_at` | timestamp \| null | no | When it was created (null for built-ins). |
| `updated_at` | timestamp \| null | no | When it last changed (null for built-ins). |

### Example

```json
{
  "id": "owners",
  "object": "approver_group",
  "name": "Owners",
  "built_in": true,
  "members": [
    {
      "person": "user:owner",
      "kind": "user",
      "id": "owner",
      "name": "policy-demo@sandbox.example"
    }
  ],
  "lead": null,
  "channels_override": null,
  "hours": null,
  "created_at": null,
  "updated_at": null
}
```

## Events

Sent to your [webhook endpoints](https://provenanceauth.com/docs/integrate/webhooks.md) when they subscribe:

- `mandate.approval.escalated`

## Create an approver group

`POST /v1/mandate/approver_groups`

Creates a group a rule's `route` can send approvals to. Members are console members with the approver role or above (`{ "user_id": "owner" }` is the account owner) or outside approvers with an active link. Up to 50 groups, 100 members each. Pro and above.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Retry a create safely: the same key + request returns the stored response (24 h, per caller). |
| `name` | body | string | yes | A name your team reads, such as `Finance`. |
| `members` | body | array of objects | yes | Each member: `{ user_id }` or `{ approver_link_id }`. |
| `members.user_id` | body | string | no | A console member's user ID. |
| `members.approver_link_id` | body | string | no | An outside approver's link ID (`lnk_…`). |
| `lead` | body | object \| null | no | A member who gets `lead` escalation steps: `{ user_id }` or `{ approver_link_id }`. |
| `lead.user_id` | body | string | no | A console member's user ID. |
| `lead.approver_link_id` | body | string | no | An outside approver's link ID (`lnk_…`). |
| `hours` | body | object \| any \| null | no | Business hours a route can use with `hours`; null clears them. |
| `hours.time_zone` | body | string | no | An IANA time zone, such as `America/New_York`. |
| `hours.schedule` | body | object | no | Keys `mon` to `sun`, each a list of up to 4 intervals such as `["09:00", "17:00"]`. |
| `channels_override` | body | array of enums \| null | no | The channels to try, in order, for this group's outside approvers. |

### Returns

The group. See [the approver group object](#object).

### Errors

- [`approver_group_limit_reached`](https://provenanceauth.com/docs/platform/errors.md#approver_group_limit_reached)
- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`insufficient_role`](https://provenanceauth.com/docs/platform/errors.md#insufficient_role)
- [`invalid_json`](https://provenanceauth.com/docs/platform/errors.md#invalid_json)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`parameter_missing`](https://provenanceauth.com/docs/platform/errors.md#parameter_missing)
- [`plan_required`](https://provenanceauth.com/docs/platform/errors.md#plan_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X POST "$PROVENANCE_API/v1/mandate/approver_groups" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Finance",
    "members": [
      {
        "user_id": "owner"
      }
    ],
    "lead": {
      "user_id": "owner"
    },
    "hours": {
      "time_zone": "America/New_York",
      "schedule": {
        "mon": [
          [
            "09:00",
            "17:00"
          ]
        ],
        "tue": [
          [
            "09:00",
            "17:00"
          ]
        ],
        "wed": [
          [
            "09:00",
            "17:00"
          ]
        ],
        "thu": [
          [
            "09:00",
            "17:00"
          ]
        ],
        "fri": [
          [
            "09:00",
            "17:00"
          ]
        ]
      }
    }
  }'
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/approver_groups`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "name": "Finance",
    "members": [
      {
        "user_id": "owner"
      }
    ],
    "lead": {
      "user_id": "owner"
    },
    "hours": {
      "time_zone": "America/New_York",
      "schedule": {
        "mon": [
          [
            "09:00",
            "17:00"
          ]
        ],
        "tue": [
          [
            "09:00",
            "17:00"
          ]
        ],
        "wed": [
          [
            "09:00",
            "17:00"
          ]
        ],
        "thu": [
          [
            "09:00",
            "17:00"
          ]
        ],
        "fri": [
          [
            "09:00",
            "17:00"
          ]
        ]
      }
    }
  }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/mandate/approver_groups", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "name": "Finance",
    "members": [
        {
            "user_id": "owner"
        }
    ],
    "lead": {
        "user_id": "owner"
    },
    "hours": {
        "time_zone": "America/New_York",
        "schedule": {
            "mon": [
                [
                    "09:00",
                    "17:00"
                ]
            ],
            "tue": [
                [
                    "09:00",
                    "17:00"
                ]
            ],
            "wed": [
                [
                    "09:00",
                    "17:00"
                ]
            ],
            "thu": [
                [
                    "09:00",
                    "17:00"
                ]
            ],
            "fri": [
                [
                    "09:00",
                    "17:00"
                ]
            ]
        }
    }
}).json()
```

### Response 201

```json
{
  "id": "agr_01M6VQBCKVH4458E9B4CE5MR94",
  "object": "approver_group",
  "name": "Finance",
  "built_in": false,
  "members": [
    {
      "person": "user:owner",
      "kind": "user",
      "id": "owner",
      "name": "policy-demo@sandbox.example"
    }
  ],
  "lead": "user:owner",
  "channels_override": null,
  "hours": {
    "time_zone": "America/New_York",
    "schedule": {
      "mon": [
        [
          "09:00",
          "17:00"
        ]
      ],
      "tue": [
        [
          "09:00",
          "17:00"
        ]
      ],
      "wed": [
        [
          "09:00",
          "17:00"
        ]
      ],
      "thu": [
        [
          "09:00",
          "17:00"
        ]
      ],
      "fri": [
        [
          "09:00",
          "17:00"
        ]
      ]
    }
  },
  "created_at": "2026-11-07T19:21:46.363Z",
  "updated_at": "2026-11-07T19:21:46.363Z"
}
```

## Retrieve an approver group

`GET /v1/mandate/approver_groups/{id}`

Retrieves one group, built-in or yours, with its members and lead.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The group's ID (`agr_…`, `owners`, `admins` or `all_approvers`). |

### Returns

The group. See [the approver group object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/mandate/approver_groups/owners" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/approver_groups/owners`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/mandate/approver_groups/owners", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "id": "owners",
  "object": "approver_group",
  "name": "Owners",
  "built_in": true,
  "members": [
    {
      "person": "user:owner",
      "kind": "user",
      "id": "owner",
      "name": "policy-demo@sandbox.example"
    }
  ],
  "lead": null,
  "channels_override": null,
  "hours": null,
  "created_at": null,
  "updated_at": null
}
```

## Update an approver group

`PATCH /v1/mandate/approver_groups/{id}`

Changes the name, members, lead or channels. Open requests keep the route they started with; new requests use the change. Built-in groups can't be edited.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The group's ID. |
| `name` | body | string | no | The group's name. |
| `members` | body | array of objects | no | The whole member list: `{ user_id }` or `{ approver_link_id }` each. |
| `lead` | body | object \| null | no | A member, or null for no lead. |
| `hours` | body | object \| any \| null | no | Business hours a route can use with `hours`; null clears them. |
| `hours.time_zone` | body | string | no | An IANA time zone, such as `America/New_York`. |
| `hours.schedule` | body | object | no | Keys `mon` to `sun`, each a list of up to 4 intervals such as `["09:00", "17:00"]`. |
| `channels_override` | body | array of enums \| null | no | The channels for outside approvers. |

### Returns

The updated group. See [the approver group object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`insufficient_role`](https://provenanceauth.com/docs/platform/errors.md#insufficient_role)
- [`invalid_json`](https://provenanceauth.com/docs/platform/errors.md#invalid_json)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`plan_required`](https://provenanceauth.com/docs/platform/errors.md#plan_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/mandate/approver_groups" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Research desk", "members": [{ "user_id": "owner" }] }' > step.json
export GROUP_ID=$(jq -r '.id' step.json)
curl -X PATCH "$PROVENANCE_API/v1/mandate/approver_groups/$GROUP_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Research", "lead": { "user_id": "owner" } }'
curl -s -X DELETE "$PROVENANCE_API/v1/mandate/approver_groups/$GROUP_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/approver_groups`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({ "name": "Research desk", "members": [{ "user_id": "owner" }] }),
})).json();
const groupId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/approver_groups/${groupId}`, {
  method: "PATCH",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({ "name": "Research", "lead": { "user_id": "owner" } }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/mandate/approver_groups", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "name": "Research desk",
    "members": [
        {
            "user_id": "owner"
        }
    ]
}).json()
group_id = step1["id"]
data = httpx.patch(f"{api}/v1/mandate/approver_groups/{group_id}", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "name": "Research",
    "lead": {
        "user_id": "owner"
    }
}).json()
```

### Response 200

```json
{
  "id": "agr_01M6VQBCKZ7R6VZCFGXXSQHT1D",
  "object": "approver_group",
  "name": "Research",
  "built_in": false,
  "members": [
    {
      "person": "user:owner",
      "kind": "user",
      "id": "owner",
      "name": "policy-demo@sandbox.example"
    }
  ],
  "lead": "user:owner",
  "channels_override": null,
  "hours": null,
  "created_at": "2026-11-07T19:21:46.367Z",
  "updated_at": "2026-11-07T19:21:46.367Z"
}
```

## Set Away and a backup

`PUT /v1/mandate/settings/approver_availability`

Sets a person's Away and backup. A console member sets their own (leave out the person); owners, admins and API keys can set anyone's. A backup who is also away is refused. Send `away_until: null` with no backup to clear it.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `user_id` | body | string | no | The member (`owner` for the account owner); leave out for yourself. |
| `approver_link_id` | body | string | no | Or an outside approver, by their link ID (`lnk_…`). |
| `away_until` | body | timestamp \| null | yes | When they are back; null when they are here. |
| `backup` | body | object \| null | no | Who gets their requests meanwhile: `{ user_id }` or `{ approver_link_id }`. |
| `backup.user_id` | body | string | no | A console member's user ID. |
| `backup.approver_link_id` | body | string | no | An outside approver's link ID (`lnk_…`). |

### Returns

The person's Away and backup.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`insufficient_role`](https://provenanceauth.com/docs/platform/errors.md#insufficient_role)
- [`invalid_json`](https://provenanceauth.com/docs/platform/errors.md#invalid_json)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`parameter_missing`](https://provenanceauth.com/docs/platform/errors.md#parameter_missing)
- [`plan_required`](https://provenanceauth.com/docs/platform/errors.md#plan_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X PUT "$PROVENANCE_API/v1/mandate/settings/approver_availability" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "user_id": "owner", "away_until": "2030-01-05T00:00:00Z" }'
curl -s -X PUT "$PROVENANCE_API/v1/mandate/settings/approver_availability" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "user_id": "owner", "away_until": null }' > /dev/null
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/settings/approver_availability`, {
  method: "PUT",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({ "user_id": "owner", "away_until": "2030-01-05T00:00:00Z" }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.put(f"{api}/v1/mandate/settings/approver_availability", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "user_id": "owner",
    "away_until": "2030-01-05T00:00:00Z"
}).json()
```

### Response 200

```json
{
  "id": "user:owner",
  "object": "approver_availability",
  "person": "user:owner",
  "name": "policy-demo@sandbox.example",
  "away": true,
  "away_until": "2030-01-05T00:00:00Z",
  "backup": null,
  "backup_name": null,
  "updated_at": "2026-11-07T19:21:46.376Z"
}
```

## List approver groups

`GET /v1/mandate/approver_groups`

Lists the built-in groups (owners, admins, all approvers) first, then yours, with their members.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

No parameters.

### Returns

The groups.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/mandate/approver_groups" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/approver_groups`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/mandate/approver_groups", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "object": "list",
  "data": [
    {
      "id": "owners",
      "object": "approver_group",
      "name": "Owners",
      "built_in": true,
      "members": [
        {
          "person": "user:owner",
          "kind": "user",
          "id": "owner",
          "name": "policy-demo@sandbox.example"
        }
      ],
      "lead": null,
      "channels_override": null,
      "hours": null,
      "created_at": null,
      "updated_at": null
    },
    {
      "id": "admins",
      "object": "approver_group",
      "name": "Admins",
      "built_in": true,
      "members": [],
      "lead": null,
      "channels_override": null,
      "hours": null,
      "created_at": null,
      "updated_at": null
    },
    {
      "id": "all_approvers",
      "object": "approver_group",
      "name": "All approvers",
      "built_in": true,
      "members": [
        {
          "person": "user:owner",
          "kind": "user",
          "id": "owner",
          "name": "policy-demo@sandbox.example"
        }
      ],
      "lead": null,
      "channels_override": null,
      "hours": null,
      "created_at": null,
      "updated_at": null
    },
    {
      "id": "agr_01M6VQBCKVH4458E9B4CE5MR94",
      "object": "approver_group",
      "name": "Finance",
      "built_in": false,
      "members": [
        {
          "person": "user:owner",
          "kind": "user",
          "id": "owner",
          "name": "policy-demo@sandbox.example"
        }
      ],
      "lead": "user:owner",
      "channels_override": null,
      "hours": {
        "time_zone": "America/New_York",
        "schedule": {
          "mon": [
            [
              "09:00",
              "17:00"
            ]
          ],
          "tue": [
            [
              "09:00",
              "17:00"
            ]
          ],
          "wed": [
            [
              "09:00",
              "17:00"
            ]
          ],
          "thu": [
            [
              "09:00",
              "17:00"
            ]
          ],
          "fri": [
            [
              "09:00",
              "17:00"
            ]
          ]
        }
      },
      "created_at": "2026-11-07T19:21:46.363Z",
      "updated_at": "2026-11-07T19:21:46.363Z"
    }
  ],
  "has_more": false,
  "next_cursor": null
}
```

## List approval routes

`GET /v1/mandate/approval_routes`

Lists every rule of your active policy that asks for a person, with its route in plain words. Edit a route by saving the policy (PUT /v1/mandate/policies).

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

No parameters.

### Returns

The approval rules and their routes.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X PUT "$PROVENANCE_API/v1/mandate/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "big sales go to the owners",
    "document": {
      "rules": [
        {
          "id": "big-sales",
          "when": [
            {
              "fact": "transaction_amount",
              "op": "gt",
              "value": 10000
            }
          ],
          "require": {
            "approval": true,
            "route": {
              "to": "group:owners",
              "wait": "4h",
              "escalate": [
                {
                  "after": "30m",
                  "to": "group:admins"
                }
              ],
              "if_unanswered": "decline"
            }
          }
        }
      ]
    }
  }' > /dev/null
curl "$PROVENANCE_API/v1/mandate/approval_routes" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/mandate/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
  method: "PUT",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "note": "big sales go to the owners",
    "document": {
      "rules": [
        {
          "id": "big-sales",
          "when": [
            {
              "fact": "transaction_amount",
              "op": "gt",
              "value": 10000
            }
          ],
          "require": {
            "approval": true,
            "route": {
              "to": "group:owners",
              "wait": "4h",
              "escalate": [
                {
                  "after": "30m",
                  "to": "group:admins"
                }
              ],
              "if_unanswered": "decline"
            }
          }
        }
      ]
    }
  }),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/approval_routes`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.put(f"{api}/v1/mandate/policies", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "note": "big sales go to the owners",
    "document": {
        "rules": [
            {
                "id": "big-sales",
                "when": [
                    {
                        "fact": "transaction_amount",
                        "op": "gt",
                        "value": 10000
                    }
                ],
                "require": {
                    "approval": True,
                    "route": {
                        "to": "group:owners",
                        "wait": "4h",
                        "escalate": [
                            {
                                "after": "30m",
                                "to": "group:admins"
                            }
                        ],
                        "if_unanswered": "decline"
                    }
                }
            }
        ]
    }
}).json()
data = httpx.get(f"{api}/v1/mandate/approval_routes", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "object": "list",
  "data": [
    {
      "id": "rul_01M7MY20KZHKVEY0HGRF107BE2",
      "object": "approval_route",
      "rule_id": "rul_01M7MY20KZHKVEY0HGRF107BE2",
      "conditions": "Amount over 10,000",
      "summary": "Amount over 10,000 → Owners · after 30 min → Admins · waits 4 h · if nobody answers: decline",
      "approvers": 1,
      "route": {
        "to": "group:owners",
        "escalate": [
          {
            "after": "30m",
            "to": "group:admins"
          }
        ],
        "wait": "4h",
        "if_unanswered": "decline"
      },
      "policy_version": 3
    }
  ],
  "has_more": false,
  "next_cursor": null
}
```

## List Away and backups

`GET /v1/mandate/settings/approver_availability`

Lists who is away and their backups. Owners and admins see everyone; other members see their own.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

No parameters.

### Returns

The people with Away or a backup set.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/mandate/settings/approver_availability" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/settings/approver_availability`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/mandate/settings/approver_availability", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "object": "list",
  "data": [],
  "has_more": false,
  "next_cursor": null
}
```

## Delete an approver group

`DELETE /v1/mandate/approver_groups/{id}`

Deletes a group no rule in your active policy routes to. Open requests keep their route.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The group's ID. |

### Returns

The deleted group.

### Errors

- [`approver_group_in_use`](https://provenanceauth.com/docs/platform/errors.md#approver_group_in_use)
- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`insufficient_role`](https://provenanceauth.com/docs/platform/errors.md#insufficient_role)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/mandate/approver_groups" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Night desk", "members": [{ "user_id": "owner" }] }' > step.json
export GROUP_ID=$(jq -r '.id' step.json)
curl -X DELETE "$PROVENANCE_API/v1/mandate/approver_groups/$GROUP_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/approver_groups`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({ "name": "Night desk", "members": [{ "user_id": "owner" }] }),
})).json();
const groupId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/approver_groups/${groupId}`, {
  method: "DELETE",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/mandate/approver_groups", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "name": "Night desk",
    "members": [
        {
            "user_id": "owner"
        }
    ]
}).json()
group_id = step1["id"]
data = httpx.delete(f"{api}/v1/mandate/approver_groups/{group_id}", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "id": "agr_01M6VQBCM9E7X1K5BSH5PNFN0X",
  "object": "approver_group",
  "deleted": true
}
```
