# Bills

> Create draft supplier bills, submit them for review, approve them, and manage payment holds.

Part of the [Prosaic API reference](https://developer.prosaic.works/docs/api.md). Base URL: `https://app.prosaic.works/api/public/v1`. Authenticate with `Authorization: Bearer <API key or access token>`.

## List supplier bills for an entity

`GET /api/public/v1/entities/{entityId}/bills`

SDK: `prosaic.bills.list(entityId, params)`

Requires workspace staff access and entity view permission. Returns current payment balances and display statuses. Date filters are inclusive calendar days.

### Path parameters

- `entityId` (string, required)

### Query parameters

- `page` (integer): Default: `1`.
- `pageSize` (integer): Default: `25`.
- `displayStatuses` (string): Comma-separated DRAFT, IN_REVIEW, AWAITING_PAYMENT, PART_PAID, OVERDUE, ON_HOLD, PAID or VOIDED.
- `contactId` (string)
- `dueDateFrom` (string)
- `dueDateTo` (string)
- `search` (string): Supplier name or supplier invoice number.

### Responses

- `200`: Successful response
  - `data` (array of objects, required)
    - `id` (string, required)
    - `supplierName` (string, required)
    - `supplierInvoiceNumber` (string, nullable, required)
    - `reference` (string, nullable, required)
    - `issueDate` (string, date-time, required)
    - `dueDate` (string, date-time, nullable, required)
    - `status` (string, required)
    - `displayStatus` (string, required): One of: `IN_REVIEW`, `DRAFT`, `VOIDED`, `AWAITING_PAYMENT`, `PART_PAID`, `OVERDUE`, `ON_HOLD`, `PAID`.
    - `total` (number, required)
    - `amountPaid` (string, required)
    - `amountDue` (string, nullable, required)
    - `heldAt` (string, date-time, nullable, required)
    - `holdReason` (string, nullable, required)
    - `reviewerId` (string, nullable, required)
    - `entity` (object, required)
      - `id` (string, required)
      - `name` (string, required)
  - `pagination` (object, required)
    - `currentPage` (number, required)
    - `pageSize` (number, required)
    - `totalCount` (number, required)
    - `totalPages` (number, required)
    - `hasNextPage` (boolean, required)
    - `hasPreviousPage` (boolean, required)
- `400`: Invalid filters or pagination (VALIDATION_ERROR).
- `401`: Authentication required.
- `403`: Staff access required or token entity mismatch.
- `404`: Entity not found or bills disabled.
- `500`: Unexpected bill listing failure.

### Example (Node SDK)

```ts
const page = await prosaic.bills.list(entityId);
```

### Example (curl)

```bash
curl https://app.prosaic.works/api/public/v1/entities/$ENTITY_ID/bills \
  -H "Authorization: Bearer $PROSAIC_API_KEY"
```

## Retrieve a supplier bill and its lines

`GET /api/public/v1/entities/{entityId}/bills/{billId}`

SDK: `prosaic.bills.retrieve(entityId, billId)`

Requires workspace staff and entity view permission. Bills outside the URL entity return 404. Monetary outputs are numeric; dates serialize as ISO strings. Use the list endpoint for current payment balances and display status.

### Path parameters

- `entityId` (string, required)
- `billId` (string, required)

### Responses

- `200`: Successful response
  - `data` (object, required)
    - `id` (string, required)
    - `entityId` (string, required)
    - `workspaceId` (string, required)
    - `contactId` (string, nullable, required)
    - `fileId` (string, nullable, required)
    - `supplierInvoiceNumber` (string, nullable, required)
    - `reference` (string, nullable, required)
    - `status` (string, required)
    - `taxMode` (string, required)
    - `issueDate` (string, date-time, required)
    - `dueDate` (string, date-time, nullable, required)
    - `supplier` (object, nullable, required)
      - `name` (string, required)
      - `contactType` (string, nullable): One of: `BUSINESS`, `INDIVIDUAL`.
      - `gstNumber` (string, nullable)
      - `address` (string, nullable)
    - `supplierName` (string, required)
    - `subtotal` (number, required)
    - `taxTotal` (number, required)
    - `total` (number, required)
    - `notes` (string, nullable, required)
    - `heldAt` (string, date-time, nullable, required)
    - `holdReason` (string, nullable, required)
    - `reviewerId` (string, nullable, required)
    - `sentBackReason` (string, nullable, required)
    - `sentBackById` (string, nullable, required)
    - `sentBackAt` (string, date-time, nullable, required)
    - `createdAt` (string, date-time, required)
    - `updatedAt` (string, date-time, required)
    - `lines` (array of objects, required)
      - `id` (string, required)
      - `entityAccountId` (string, nullable, required)
      - `position` (number, required)
      - `description` (string, required)
      - `quantity` (number, required)
      - `unitPrice` (number, required)
      - `taxRate` (number, required)
      - `taxRateCode` (string, nullable, required)
      - `amount` (number, required)
      - `taxAmount` (number, required)
      - `taxAmountStated` (boolean, required)
- `401`: Authentication required.
- `403`: Staff access required or token entity mismatch.
- `404`: Bill or entity not found, or bills disabled.
- `500`: Unexpected bill retrieval failure.

### Example (Node SDK)

```ts
const { data } = await prosaic.bills.retrieve(entityId, billId);
```

### Example (curl)

```bash
curl https://app.prosaic.works/api/public/v1/entities/$ENTITY_ID/bills/$BILL_ID \
  -H "Authorization: Bearer $PROSAIC_API_KEY"
```

## Create a draft supplier bill

`POST /api/public/v1/entities/{entityId}/bills`

SDK: `prosaic.bills.create(entityId, params)`

Creates DRAFT only. Upload one document using files.upload and pass its fileId. The document must belong to this entity. Approve separately with PATCH status APPROVED. Requires workspace staff and entity create permission. Amount inputs are finite decimal strings; dates are calendar days. Empty drafts are permitted.

### Path parameters

- `entityId` (string, required)

### Request body

Content type: `application/json`

- `issueDate` (string, required)
- `reference` (string, nullable)
- `notes` (string, nullable)
- `contactId` (string, nullable)
- `fileId` (string, nullable)
- `supplierInvoiceNumber` (string, nullable)
- `taxMode` (string): One of: `TAX_EXCLUSIVE`, `TAX_INCLUSIVE`, `NO_TAX`.
- `supplierName` (string)
- `dueDate` (string, nullable)
- `lines` (array of objects)
  - `description` (string, required)
  - `taxRateCode` (string, required)
  - `quantity` (string, required)
  - `unitPrice` (string, required)
  - `taxRate` (string, required)
  - `entityAccountId` (string, nullable)
  - `taxAmount` (string, nullable)

### Responses

- `201`: Successful response
  - `data` (object, required)
    - `id` (string, required)
    - `entityId` (string, required)
    - `workspaceId` (string, required)
    - `contactId` (string, nullable, required)
    - `fileId` (string, nullable, required)
    - `supplierInvoiceNumber` (string, nullable, required)
    - `reference` (string, nullable, required)
    - `status` (string, required)
    - `taxMode` (string, required)
    - `issueDate` (string, date-time, required)
    - `dueDate` (string, date-time, nullable, required)
    - `supplier` (object, nullable, required)
      - `name` (string, required)
      - `contactType` (string, nullable): One of: `BUSINESS`, `INDIVIDUAL`.
      - `gstNumber` (string, nullable)
      - `address` (string, nullable)
    - `supplierName` (string, required)
    - `subtotal` (number, required)
    - `taxTotal` (number, required)
    - `total` (number, required)
    - `notes` (string, nullable, required)
    - `heldAt` (string, date-time, nullable, required)
    - `holdReason` (string, nullable, required)
    - `reviewerId` (string, nullable, required)
    - `sentBackReason` (string, nullable, required)
    - `sentBackById` (string, nullable, required)
    - `sentBackAt` (string, date-time, nullable, required)
    - `createdAt` (string, date-time, required)
    - `updatedAt` (string, date-time, required)
    - `lines` (array of objects, required)
      - `id` (string, required)
      - `entityAccountId` (string, nullable, required)
      - `position` (number, required)
      - `description` (string, required)
      - `quantity` (number, required)
      - `unitPrice` (number, required)
      - `taxRate` (number, required)
      - `taxRateCode` (string, nullable, required)
      - `amount` (number, required)
      - `taxAmount` (number, required)
      - `taxAmountStated` (boolean, required)
- `400`: Invalid JSON, bill input, contact, account, tax code or file (VALIDATION_ERROR).
- `401`: Authentication required.
- `403`: Staff access required or token entity mismatch.
- `404`: Entity not found or bills disabled.
- `500`: Unexpected bill creation failure.

### Example (Node SDK)

```ts
const { data } = await prosaic.bills.create(entityId, {
  issueDate: '2026-04-01',
});
```

### Example (curl)

```bash
curl -X POST https://app.prosaic.works/api/public/v1/entities/$ENTITY_ID/bills \
  -H "Authorization: Bearer $PROSAIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "issueDate": "2026-04-01"
  }'
```

## Edit a draft bill or change its status

`PATCH /api/public/v1/entities/{entityId}/bills/{billId}`

SDK: `prosaic.bills.update(entityId, billId, params)`

Send draft fields or one status change with its action-specific fields.
IN_REVIEW submits a complete draft for review or changes its reviewer.
Supply reviewerId for a specific reviewer, or omit it to leave the bill
unassigned. DRAFT sends a bill in review back with a required reason,
or unapproves a posted bill. APPROVED posts a draft or a bill in review.
VOIDED voids an approved bill.

Existing period locks and live-payment restrictions apply. Omitted
draft fields stay unchanged. Null clears nullable fields, and lines
replaces all lines. Requires workspace staff and entity edit
permission. Invalid JSON or mixed status and draft fields returns 400.

### Path parameters

- `entityId` (string, required)
- `billId` (string, required)

### Request body

Content type: `application/json`

- `contactId` (string, nullable)
- `fileId` (string, nullable)
- `supplierInvoiceNumber` (string, nullable)
- `reference` (string, nullable)
- `taxMode` (string): One of: `TAX_EXCLUSIVE`, `TAX_INCLUSIVE`, `NO_TAX`.
- `supplierName` (string)
- `notes` (string, nullable)
- `issueDate` (string)
- `dueDate` (string, nullable)
- `lines` (array of objects)
  - `description` (string, required)
  - `taxRateCode` (string, required)
  - `quantity` (string, required)
  - `unitPrice` (string, required)
  - `taxRate` (string, required)
  - `entityAccountId` (string, nullable)
  - `taxAmount` (string, nullable)

### Responses

- `200`: Successful response
  - `data` (object, required)
    - `id` (string, required)
    - `entityId` (string, required)
    - `workspaceId` (string, required)
    - `contactId` (string, nullable, required)
    - `fileId` (string, nullable, required)
    - `supplierInvoiceNumber` (string, nullable, required)
    - `reference` (string, nullable, required)
    - `status` (string, required)
    - `taxMode` (string, required)
    - `issueDate` (string, date-time, required)
    - `dueDate` (string, date-time, nullable, required)
    - `supplier` (object, nullable, required)
      - `name` (string, required)
      - `contactType` (string, nullable): One of: `BUSINESS`, `INDIVIDUAL`.
      - `gstNumber` (string, nullable)
      - `address` (string, nullable)
    - `supplierName` (string, required)
    - `subtotal` (number, required)
    - `taxTotal` (number, required)
    - `total` (number, required)
    - `notes` (string, nullable, required)
    - `heldAt` (string, date-time, nullable, required)
    - `holdReason` (string, nullable, required)
    - `reviewerId` (string, nullable, required)
    - `sentBackReason` (string, nullable, required)
    - `sentBackById` (string, nullable, required)
    - `sentBackAt` (string, date-time, nullable, required)
    - `createdAt` (string, date-time, required)
    - `updatedAt` (string, date-time, required)
    - `lines` (array of objects, required)
      - `id` (string, required)
      - `entityAccountId` (string, nullable, required)
      - `position` (number, required)
      - `description` (string, required)
      - `quantity` (number, required)
      - `unitPrice` (number, required)
      - `taxRate` (number, required)
      - `taxRateCode` (string, nullable, required)
      - `amount` (number, required)
      - `taxAmount` (number, required)
      - `taxAmountStated` (boolean, required)
- `400`: Invalid input (VALIDATION_ERROR) or incomplete bill with structured issues (BILL_INCOMPLETE).
- `401`: Authentication required.
- `403`: Staff access required or token entity mismatch.
- `404`: Bill or entity not found, or bills disabled.
- `409`: Lifecycle or live-payment conflict (BILL_NOT_EDITABLE), or accounting period locked (ACCOUNTING_PERIOD_LOCKED).
- `500`: Unexpected bill update failure.

### Example (Node SDK)

```ts
const { data } = await prosaic.bills.update(entityId, billId, {
  status: 'IN_REVIEW',
});
```

### Example (curl)

```bash
curl -X PATCH https://app.prosaic.works/api/public/v1/entities/$ENTITY_ID/bills/$BILL_ID \
  -H "Authorization: Bearer $PROSAIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "IN_REVIEW"
  }'
```

## Put a supplier bill on hold

`POST /api/public/v1/entities/{entityId}/bills/{billId}/hold`

SDK: `prosaic.bills.hold(entityId, billId, params)`

Hold an approved bill without changing its posting or payments. Holding an already held bill updates its reason. Requires workspace staff, entity edit permission and the bills feature. A hold does not prevent recording or matching an actual external payment. No journal is posted or reversed, so accounting period locks do not prevent holding a bill.

### Path parameters

- `entityId` (string, required)
- `billId` (string, required)

### Request body

Content type: `application/json`

- `reason` (string, nullable)

### Responses

- `200`: Successful response
  - `data` (object, required)
    - `id` (string, required)
    - `entityId` (string, required)
    - `workspaceId` (string, required)
    - `contactId` (string, nullable, required)
    - `fileId` (string, nullable, required)
    - `supplierInvoiceNumber` (string, nullable, required)
    - `reference` (string, nullable, required)
    - `status` (string, required)
    - `taxMode` (string, required)
    - `issueDate` (string, date-time, required)
    - `dueDate` (string, date-time, nullable, required)
    - `supplier` (object, nullable, required)
      - `name` (string, required)
      - `contactType` (string, nullable): One of: `BUSINESS`, `INDIVIDUAL`.
      - `gstNumber` (string, nullable)
      - `address` (string, nullable)
    - `supplierName` (string, required)
    - `subtotal` (number, required)
    - `taxTotal` (number, required)
    - `total` (number, required)
    - `notes` (string, nullable, required)
    - `heldAt` (string, date-time, nullable, required)
    - `holdReason` (string, nullable, required)
    - `reviewerId` (string, nullable, required)
    - `sentBackReason` (string, nullable, required)
    - `sentBackById` (string, nullable, required)
    - `sentBackAt` (string, date-time, nullable, required)
    - `createdAt` (string, date-time, required)
    - `updatedAt` (string, date-time, required)
    - `lines` (array of objects, required)
      - `id` (string, required)
      - `entityAccountId` (string, nullable, required)
      - `position` (number, required)
      - `description` (string, required)
      - `quantity` (number, required)
      - `unitPrice` (number, required)
      - `taxRate` (number, required)
      - `taxRateCode` (string, nullable, required)
      - `amount` (number, required)
      - `taxAmount` (number, required)
      - `taxAmountStated` (boolean, required)
- `400`: Invalid JSON, reason or unknown field (VALIDATION_ERROR).
- `401`: Authentication required.
- `403`: Staff access required or token entity mismatch.
- `404`: Bill or entity not found, or bills disabled.
- `409`: Bill is not approved (BILL_NOT_EDITABLE).
- `500`: Unexpected bill hold failure.

### Example (Node SDK)

```ts
const { data } = await prosaic.bills.hold(entityId, billId, {
  reason: 'string',
});
```

### Example (curl)

```bash
curl -X POST https://app.prosaic.works/api/public/v1/entities/$ENTITY_ID/bills/$BILL_ID/hold \
  -H "Authorization: Bearer $PROSAIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "string"
  }'
```

## Release a supplier bill from hold

`DELETE /api/public/v1/entities/{entityId}/bills/{billId}/hold`

SDK: `prosaic.bills.release(entityId, billId)`

Clear hold metadata on an approved bill; an already released approved bill remains released. Does not approve, pay, unapprove or change the journal. Requires workspace staff, entity edit permission and the bills feature. No request body. Accounting period locks do not prevent releasing a hold.

### Path parameters

- `entityId` (string, required)
- `billId` (string, required)

### Responses

- `200`: Successful response
  - `data` (object, required)
    - `id` (string, required)
    - `entityId` (string, required)
    - `workspaceId` (string, required)
    - `contactId` (string, nullable, required)
    - `fileId` (string, nullable, required)
    - `supplierInvoiceNumber` (string, nullable, required)
    - `reference` (string, nullable, required)
    - `status` (string, required)
    - `taxMode` (string, required)
    - `issueDate` (string, date-time, required)
    - `dueDate` (string, date-time, nullable, required)
    - `supplier` (object, nullable, required)
      - `name` (string, required)
      - `contactType` (string, nullable): One of: `BUSINESS`, `INDIVIDUAL`.
      - `gstNumber` (string, nullable)
      - `address` (string, nullable)
    - `supplierName` (string, required)
    - `subtotal` (number, required)
    - `taxTotal` (number, required)
    - `total` (number, required)
    - `notes` (string, nullable, required)
    - `heldAt` (string, date-time, nullable, required)
    - `holdReason` (string, nullable, required)
    - `reviewerId` (string, nullable, required)
    - `sentBackReason` (string, nullable, required)
    - `sentBackById` (string, nullable, required)
    - `sentBackAt` (string, date-time, nullable, required)
    - `createdAt` (string, date-time, required)
    - `updatedAt` (string, date-time, required)
    - `lines` (array of objects, required)
      - `id` (string, required)
      - `entityAccountId` (string, nullable, required)
      - `position` (number, required)
      - `description` (string, required)
      - `quantity` (number, required)
      - `unitPrice` (number, required)
      - `taxRate` (number, required)
      - `taxRateCode` (string, nullable, required)
      - `amount` (number, required)
      - `taxAmount` (number, required)
      - `taxAmountStated` (boolean, required)
- `401`: Authentication required.
- `403`: Staff access required or token entity mismatch.
- `404`: Bill or entity not found, or bills disabled.
- `409`: Bill is not approved (BILL_NOT_EDITABLE).
- `500`: Unexpected bill release failure.

### Example (Node SDK)

```ts
const { data } = await prosaic.bills.release(entityId, billId);
```

### Example (curl)

```bash
curl -X DELETE https://app.prosaic.works/api/public/v1/entities/$ENTITY_ID/bills/$BILL_ID/hold \
  -H "Authorization: Bearer $PROSAIC_API_KEY"
```

## Delete a draft supplier bill

`DELETE /api/public/v1/entities/{entityId}/bills/{billId}`

SDK: `prosaic.bills.del(entityId, billId)`

Only drafts can be deleted. Requires workspace staff and entity edit permission.

### Path parameters

- `entityId` (string, required)
- `billId` (string, required)

### Responses

- `200`: Successful response
  - `success` (boolean, required): One of: `true`.
- `401`: Authentication required.
- `403`: Staff access required or token entity mismatch.
- `404`: Bill or entity not found, or bills disabled.
- `409`: Only drafts can be deleted (BILL_NOT_EDITABLE).
- `500`: Unexpected bill deletion failure.

### Example (Node SDK)

```ts
const result = await prosaic.bills.del(entityId, billId);
```

### Example (curl)

```bash
curl -X DELETE https://app.prosaic.works/api/public/v1/entities/$ENTITY_ID/bills/$BILL_ID \
  -H "Authorization: Bearer $PROSAIC_API_KEY"
```