# Pay runs API

> Read pay runs with their lines and totals. GET /api/v1/pay-runs, GET /api/v1/pay-runs/{id}.

2 operations. Each needs an API key with the permission shown; see [API keys and permissions](https://staffedly.com/docs/developers/api-keys).

| Operation | Permission |
| --- | --- |
| [`GET /api/v1/pay-runs`](#get-api-v1-pay-runs) | `pay:read` |
| [`GET /api/v1/pay-runs/{id}`](#get-api-v1-pay-runs-id) | `pay:read` |

## GET /api/v1/pay-runs

Pay runs, newest period first, each with its lines and totals as they were when the run was made.

- **Permission:** `pay:read`
- **Returns:** a page of records: `{ data, hasMore, nextCursor }`, status 200

**Query parameters** (all optional)

| Name | Description |
| --- | --- |
| `status` | draft, pending_approval, approved or paid. |
| `limit` | Rows per page, 1 to 200. Default 50. |
| `cursor` | The nextCursor value from the previous page. |

**Fields in each record:** `id`, `periodStart`, `periodEnd`, `schedule`, `status`, `lines`, `totals`, `generatedAt`, `approvedAt`

```bash
curl "https://app.staffedly.com/api/v1/pay-runs?limit=50" \
  -H "Authorization: Bearer $STAFFEDLY_API_KEY"
```

## GET /api/v1/pay-runs/{id}

One pay run.

- **Permission:** `pay:read`
- **Returns:** one record: `{ data }`, status 200

**Path**

| Name | Description |
| --- | --- |
| `id` | The record's id. |

**Fields in each record:** `id`, `periodStart`, `periodEnd`, `schedule`, `status`, `lines`, `totals`, `generatedAt`, `approvedAt`

```bash
curl "https://app.staffedly.com/api/v1/pay-runs/<id>" \
  -H "Authorization: Bearer $STAFFEDLY_API_KEY"
```

