# POST /api/v1/invoices/bulk-payments

> Bulk mark invoices paid

- **Tag:** invoices
- **Operation ID:** `bulk_mark_invoices_paid`

## Description

Mark a selection of invoices paid in one call, recording the payment date you supply and optionally matching one or more bank transactions to each invoice.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Request body

Schema: `BulkMarkInvoicesPaidRequest`

- `invoices` (array · BulkInvoicePaymentRow · required) → `BulkInvoicePaymentRow` — Invoices to settle (1-500 rows).
  - `invoice_id` (string · required) — UUID of the invoice to settle.
  - `paid_on` (string · date-time) — Payment date for this invoice (YYYY-MM-DD or full ISO 8601). Overrides the batch-level `paid_on`. When transactions are linked and no date is given anywhere, the transaction's own date is recorded.
  - `transactions` (array · BulkInvoicePaymentAllocation) — Bank transactions to match to this invoice. One or many — a customer who paid an invoice in two deposits gets two entries. Leave empty to mark the invoice paid without linking a transaction.
- `paid_on` (string · date-time) — Payment date applied to every row that does not carry its own (YYYY-MM-DD or full ISO 8601). This is the date recorded as the invoice's 'Paid on' — not the date the request was made.

## Example request

```json
{
  "invoices": [
    {
      "invoice_id": "019ab37c-0002-7000-8000-000000000002"
    },
    {
      "invoice_id": "019ab37c-0003-7000-8000-000000000003",
      "transactions": [
        {
          "transaction_id": "019ab37c-0004-7000-8000-000000000004"
        }
      ]
    }
  ],
  "paid_on": "2026-03-10"
}
```

## Responses

### 201 — Successful Response

Schema: `SuccessEnvelope_BulkMarkInvoicesPaidResponse_`

- `success` (boolean)
- `message` (string)
- `code` (string)
- `data` (BulkMarkInvoicesPaidResponse)

### 400 — Bad Request - Invalid input

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 401 — Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 403 — Forbidden - Insufficient permissions

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 422 — Validation Error

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/invoices/bulk-payments' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "invoices": [
    {
      "invoice_id": "019ab37c-0002-7000-8000-000000000002"
    },
    {
      "invoice_id": "019ab37c-0003-7000-8000-000000000003",
      "transactions": [
        {
          "transaction_id": "019ab37c-0004-7000-8000-000000000004"
        }
      ]
    }
  ],
  "paid_on": "2026-03-10"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/invoices/bulk-payments', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "invoices": [
    {
      "invoice_id": "019ab37c-0002-7000-8000-000000000002"
    },
    {
      "invoice_id": "019ab37c-0003-7000-8000-000000000003",
      "transactions": [
        {
          "transaction_id": "019ab37c-0004-7000-8000-000000000004"
        }
      ]
    }
  ],
  "paid_on": "2026-03-10"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {'invoices': [{'invoice_id': '019ab37c-0002-7000-8000-000000000002'},
              {'invoice_id': '019ab37c-0003-7000-8000-000000000003',
               'transactions': [{'transaction_id': '019ab37c-0004-7000-8000-000000000004'}]}],
 'paid_on': '2026-03-10'}

response = httpx.post("https://api.ondayzero.com/api/v1/invoices/bulk-payments", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/invoices/bulk-mark-invoices-paid
- OpenAPI slice: https://www.ondayzero.com/docs/reference/invoices/bulk-mark-invoices-paid/openapi.json
- Other endpoints in **invoices**: https://www.ondayzero.com/docs/reference/invoices (markdown bundle: https://www.ondayzero.com/docs/reference/invoices.md, OpenAPI: https://www.ondayzero.com/docs/reference/invoices/openapi.json)
- Endpoint catalog: https://www.ondayzero.com/docs/reference/index.md
