# PUT /api/v1/invoices/{invoice_id}

> Update invoice

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

## Description

Update invoice details. Optionally include 'recurring' config to create a recurring template.

## Authentication

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

## Parameters

- `invoice_id` (path, string · uuid, required)

## Request body

Schema: `InvoiceUpdateRequest`

- `id` (string · required) — UUID of the invoice to update.
- `customer_id` (string) — Change the customer.
- `line_items` (array · LineItemRequest) — Replace line items (draft invoices only).
- `due_date` (string) — New due date (YYYY-MM-DD).
- `invoice_date` (string) — New invoice (issue) date, YYYY-MM-DD. This is the date the invoice is shown and reported under, and the date its finalization journal entry is posted on — changing it on a finalized invoice re-dates that entry so the ledger keeps matching the invoice. Mainly for backdating invoices imported from another system.
- `invoice_number` (string) — Set the invoice number, e.g. to keep the number an imported invoice had in its previous system. Must be unique within the business. Not available on Stripe-issued invoices, whose number belongs to Stripe.
- `description` (string) — Update description/notes.
- `fulfillment_location_id` (string) — Update the default warehouse for inventory deductions. Ignored once the invoice has been delivered.
- `project_id` (string) — Link (or, when set to null, unlink) the project this invoice is attributed to for profitability. Changing it after finalization does not retroactively re-tag already-posted journal entries.
- `contract_id` (string) — Link (or, when set to null, unlink) the contract this invoice bills against. The contract must belong to the same business and the same customer as the invoice. Linking a finalized (open/paid) invoice adds its total to the contract's billed amount and can activate billing; unlinking symmetrically removes it. Draft invoices move nothing until sent.
- `revenue_treatment` (string) — Manual revenue-tracking label ('earned' or 'deferred'), or an empty string / null to clear it. Informational only — posts NO journal entry. Works on any invoice, existing or draft.
- `recurring` (InvoiceRecurringConfig) — If provided, creates a recurring template from this invoice.

## Responses

### 200 — Successful Response

Schema: `SuccessEnvelope_InvoiceResponse_`

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

### 400 — Bad Request - Invalid input

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 404 — Not Found - Resource does not exist

### 422 — Validation Error - Invalid data format

## Code samples

### cURL

```bash
curl -X PUT 'https://api.ondayzero.com/api/v1/invoices/{invoice_id}' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "string"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/invoices/{invoice_id}', {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "id": "string"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {
  "id": "string"
}

response = httpx.put("https://api.ondayzero.com/api/v1/invoices/{invoice_id}", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/invoices/update-invoice
- OpenAPI slice: https://www.ondayzero.com/docs/reference/invoices/update-invoice/openapi.json
- Other endpoints in **invoices**: https://www.ondayzero.com/docs/reference/invoices
