---
url: /api/approvers.md
---
# List Approvers

Returns the people who can approve payment requests at a site. Use an `id` from here as the **required** `admin` field when you [create a request](/api/create-request).

::: tip How admin is used
Johari still routes the request through the site's approval rules first. `admin` is the approver used when **no one** in those rules can approve the request (for example, the amount is above everyone's limit). It is always required, the same as the approver field on the web form.
:::

## Endpoint

| Method | URL |
|---|---|
| `GET` | `/api/sites/:siteID/approvers` |

| Path parameter | Description |
|---|---|
| `siteID` | An `id` from [List Sites](/api/sites) |

```
<timestamp>.GET./api/sites/3c9a7f52-1d4e-4b8a-9f6c-2e1d5a7b8c90/approvers.
```

## Response

`data` is an array of people (complete in one response, not paginated):

| Field | Type | Description |
|---|---|---|
| `id` | `string` | The person's ID (24 hex characters). Use it as `admin` |
| `name` | `string` | Their name |

## Example

::: code-group

```bash [cURL]
SITE_ID="3c9a7f52-1d4e-4b8a-9f6c-2e1d5a7b8c90"
TS=$(date +%s)
SIG=$(printf '%s' "$TS.GET./api/sites/$SITE_ID/approvers." \
  | openssl dgst -sha256 -hmac "$SIGNING_SECRET" \
  | sed 's/^.* //')
curl "$BASE_URL/api/sites/$SITE_ID/approvers" \
  -H "x-api-key: $API_KEY" \
  -H "x-timestamp: $TS" \
  -H "x-signature: $SIG"
```

```js [Node.js]
const siteID = "3c9a7f52-1d4e-4b8a-9f6c-2e1d5a7b8c90";
const result = await callJohari("GET", `/api/sites/${siteID}/approvers`);
console.log(result.data);
```

```python [Python]
site_id = "3c9a7f52-1d4e-4b8a-9f6c-2e1d5a7b8c90"
result = call_johari("GET", f"/api/sites/{site_id}/approvers")
print(result["data"])
```

:::

Response `200`:

```json
{
  "status": "success",
  "data": [
    {
      "id": "6650f1a2b3c4d5e6f7a8b7a1",
      "name": "Amina Juma"
    },
    {
      "id": "6650f1a2b3c4d5e6f7a8b7a2",
      "name": "Peter Mushi"
    }
  ],
  "message": "Approvers fetched successfully"
}
```

The list can include the API key's own user, if they are allowed to approve at that site.

Response `404`, when the site ID is wrong or the user cannot raise requests there:

```json
{
  "status": "error",
  "data": null,
  "message": "Site not found"
}
```

## Common mistakes

::: danger Leaving out admin
`admin` is required on every request. Without it, or with a value that is not a 24-hex-character ID, you get `400` (`Please provide an admin: an approver id from the site's approvers list`).
:::

::: danger Using an approver from another site
`admin` must be an approver **of the site** in `requestingSite`. Otherwise you get `400` (`admin is not one of this site's approvers`).
:::

## Related pages

* [Create a Request](/api/create-request)
* [List Sites](/api/sites)
