# Invoices API

> Read invoices, their lines and payments. GET /api/v1/invoices, GET /api/v1/invoices/{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/invoices`](#get-api-v1-invoices) | `pay:read` |
| [`GET /api/v1/invoices/{id}`](#get-api-v1-invoices-id) | `pay:read` |

## GET /api/v1/invoices

Invoices, newest first. items is what the client is billed, in dollars; lines and totals are the hours calculation an invoice started from. periodStart and periodEnd are null on an invoice not made from hours.

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

**Query parameters** (all optional)

| Name | Description |
| --- | --- |
| `status` | draft, sent, partial (part paid), paid or void. Overdue is not a status: see the overdue field. |
| `facilityId` | Only this site. |
| `limit` | Rows per page, 1 to 200. Default 50. |
| `cursor` | The nextCursor value from the previous page. |

**Fields in each record:** `id`, `number`, `facilityId`, `source`, `periodStart`, `periodEnd`, `status`, `overdue`, `issueDate`, `dueDate`, `terms`, `items`, `subtotal`, `discount`, `taxLabel`, `taxRate`, `tax`, `total`, `amountPaid`, `balanceDue`, `lines`, `totals`, `createdAt`, `sentAt`, `paidAt`, `voidedAt`

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

## GET /api/v1/invoices/{id}

One invoice.

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

**Path**

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

**Fields in each record:** `id`, `number`, `facilityId`, `source`, `periodStart`, `periodEnd`, `status`, `overdue`, `issueDate`, `dueDate`, `terms`, `items`, `subtotal`, `discount`, `taxLabel`, `taxRate`, `tax`, `total`, `amountPaid`, `balanceDue`, `lines`, `totals`, `createdAt`, `sentAt`, `paidAt`, `voidedAt`

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

