# Invoice

A legacy invoice header: the description, date and hourly rate a project was billed at before sales invoices replaced it. It can be listed, read and created, but never edited or deleted through the API: both are always refused. Its rows are not exposed in any form, so there is no line-item total here.

## Used by
- GET /api/v2/invoices: List invoices (InvoiceList)
- POST /api/v2/invoices: Create an invoice (Invoice)
- GET /api/v2/invoices/{invoice}: Read an invoice (Invoice)

## Invoice fields
- id (integer, required): Unique identifier.
- project_id (integer, required): Project this invoice was raised for.
- project (Ref or ProjectSummary, required): The project this invoice was raised for.
- user_id (integer or null, required, server-assigned): Employee the invoice is attributed to. Assigned from the authenticated user on create and never writable; `null` once that user is deleted.
- user (Ref or UserSummary or null, required): The employee this invoice is attributed to. Expanding it with `?include=user` additionally requires the `users::read` permission and a token scope covering the users prefix.
- description (string, required, multiline): What was invoiced, as free text. This is the field `?q=` searches.
- date (date (YYYY-MM-DD), required): Invoice date, a zone-free calendar date. Newest first is the default sort.
- hourly_rate (decimal (2 dp) ≥ 0, required): Hourly rate this invoice was billed at, as a decimal string with two places. Never rounded or rescaled.
- created_at (timestamp (YYYY-MM-DDThh:mm:ssZ), required): Creation timestamp.
- updated_at (timestamp (YYYY-MM-DDThh:mm:ssZ), required): Last-write timestamp; use for incremental sync. It also feeds the `ETag` revision, because a legacy invoice has no `version` field.
- links (InvoiceLinks, required)
  - self (url, required): The canonical URI of this record.

## Variants

### InvoiceList

What a collection returns, and what `?view=summary` returns on a single record.

11 fields.
Identical to the detail object above.

### InvoiceSummary

The embedded form: what you get when another resource carries this one and you did not `include` it.

3 fields.
Omits: project_id, project, user_id, user, description, created_at, updated_at, links
Narrows hourly_rate: decimal (2 dp) ≥ 0 -> decimal (2 dp)

### InvoiceLinks

The `links` object on this resource.

Keys: self

## Example
```json
{
  "id": 1,
  "project_id": 1,
  "project": {
    "id": 1
  },
  "user_id": 1,
  "user": null,
  "description": "Sprint 14: portal rebuild",
  "date": "2026-03-31",
  "hourly_rate": "85.00",
  "created_at": "2026-03-04T09:15:00Z",
  "updated_at": "2026-03-04T09:15:00Z",
  "links": {
    "self": "https://<your-url>/api/v2/work-items/1"
  }
}
```
