# Update Vendor Bill

`PATCH /accounting/vendor-bills/{id}`

Group: Accounting › Vendor Bills · Operation ID: `updateVendorBill`

Updates the vendor bill with the given identifier. Only the fields in the request body change.

Only the fields in the request body change. Lines change through three arrays, applied in the order delete, then update, then create in one transaction, so one call can retire a line and add its replacement. updateLines and deleteLines address lines by the id the bill publishes, and a line id belonging to another bill is refused with LINE_NOT_FOUND. Omit all three to leave the lines untouched. currency governs the amounts on any line the call writes, and the stored currency is used when it is omitted. The response is empty. Read the record with GET accounting/vendor-bills/:id.

[Open in the interactive reference](https://docs.api.lensing.ai/?op=updateVendorBill)

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Api-Version` | header | `"v1"` | yes | The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version `v1`. |
| `Idempotency-Key` | header | string | no | An opaque caller-chosen string (1-255 characters) that makes this request safe to retry. Repeating the same key with an identical request body replays the original response instead of re-executing - but only once that original request succeeded; a failed attempt re-executes on retry. Repeating the key with a different body is answered with 422. A key still in flight is answered with 409 - as is a key whose original request was interrupted before it finished, for a few minutes afterwards, until that attempt is presumed dead. A completed response stays replayable for 24 hours. The key is scoped to the caller, not to the action: reusing it for a different action is answered with 409 or 422 rather than treated independently. On read actions this header is ignored. On write actions that cannot offer the guarantee it is answered with `400 IDEMPOTENCY_NOT_SUPPORTED` rather than silently ignored. |
| `id` | path | string | yes | The unique identifier for the vendor bill to update. |

## Request body

Required, `application/json`: updateVendorBillInput.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `billNumber` | string | no | The vendor-issued invoice number, as printed on the bill. It is not unique across vendors. Omit to leave unchanged. |
| `billDate` | string (date) | no | The date printed on the vendor's invoice. Use format YYYY-MM-DD. Omit to leave unchanged. |
| `dueDate` | string (date) | no | The date payment is due. Use format YYYY-MM-DD. Omit to leave unchanged. |
| `serviceDate` | string (date) | no | The date the goods or services were delivered. Use format YYYY-MM-DD. Omit to leave unchanged. |
| `currency` | string | no | The currency of the bill. Format ISO 4217, for example 'USD'. Omit to leave unchanged. |
| `paymentTerms` | string | no | The payment-terms key, for example 'net30', 'net60' or 'dueOnReceipt'. Omit to leave unchanged. |
| `vendorId` | string | no | The vendor the bill is from. See id on GET accounting/vendors/:id. Omit to leave unchanged. |
| `entityId` | string | no | The legal entity the bill is posted under. See id on GET base/entities. Omit to leave unchanged. |
| `markAsPaid` | boolean | no | Whether the bill is marked paid. Omit to leave unchanged. |
| `origin` | string | no | The source system this record came from, as free-form text, for example 'Ramp'. Omit it and it stays unset. The server does not set a value. |
| `createLines` | array of object | no | Lines to add to the bill, each with the same shape as on create and no id. Omit for no additions. |
| `createLines[].amount` | string (decimal) | yes | The total line amount, gross, including VAT where applicable, as a decimal in the bill currency. |
| `createLines[].description` | string | no | A description of the line item, typically copied from the vendor's invoice. |
| `createLines[].accountId` | string | no | The GL expense account this line posts to. See id on GET accounting/accounts/:id. |
| `createLines[].departmentId` | string | no | The department this line is charged to. See id on GET departments/:id. |
| `createLines[].businessUnitId` | string | no | The business unit this line is charged to. There is no endpoint for it. |
| `createLines[].customerId` | string | no | The customer this expense is rebilled to. See id on GET accounting/customers/:id. It is only meaningful alongside billableExpense. |
| `createLines[].vatPercentage` | string (decimal) | no | The VAT rate applied, as a percentage. 19 means 19%, not 0.19. |
| `createLines[].vatAccountId` | string | no | The GL account the VAT posts to. See id on GET accounting/accounts/:id. |
| `createLines[].reverseVatAccountId` | string | no | The GL account reverse-charge VAT posts to. See id on GET accounting/accounts/:id. |
| `createLines[].vatAmount` | string (decimal) | no | The explicit VAT amount, as a decimal in the bill currency. Omit to derive it from vatPercentage. |
| `createLines[].valueAllocationId` | string | no | The value-allocation rule distributing this line across dimensions. There is no endpoint for it. |
| `createLines[].purchaseOrderLineId` | string | no | The purchase-order line this line is matched against. There is no endpoint for it. |
| `createLines[].billableExpense` | string | no | The billable-expense status for this line. Values include 'yes', 'no' and 'skipped'. |
| `createLines[].lineType` | string | no | The kind of line. Values include 'expense' (a one-time cost) and 'prepaidExpense' (an upfront cost spread over several periods). Defaults to 'expense'. |
| `updateLines` | array of object | no | Lines to change, each addressed by the id the bill publishes. Every field but the id is optional and left unchanged when omitted. Omit for no changes. |
| `updateLines[].id` | string | yes | The unique identifier for the line to change. It must belong to this bill. |
| `updateLines[].amount` | string (decimal) | no | The total line amount, gross, as a decimal in the bill currency. Omit to leave unchanged. |
| `updateLines[].description` | string | no | A description of the line item. Omit to leave unchanged. |
| `updateLines[].accountId` | string | no | The GL expense account this line posts to. See id on GET accounting/accounts/:id. Omit to leave unchanged. |
| `updateLines[].departmentId` | string | no | The department this line is charged to. See id on GET departments/:id. Omit to leave unchanged. |
| `updateLines[].businessUnitId` | string | no | The business unit this line is charged to. There is no endpoint for it. Omit to leave unchanged. |
| `updateLines[].customerId` | string | no | The customer this expense is rebilled to. See id on GET accounting/customers/:id. Omit to leave unchanged. |
| `updateLines[].vatPercentage` | string (decimal) | no | The VAT rate applied, as a percentage. 19 means 19%, not 0.19. Omit to leave unchanged. |
| `updateLines[].vatAccountId` | string | no | The GL account the VAT posts to. See id on GET accounting/accounts/:id. Omit to leave unchanged. |
| `updateLines[].reverseVatAccountId` | string | no | The GL account reverse-charge VAT posts to. See id on GET accounting/accounts/:id. Omit to leave unchanged. |
| `updateLines[].vatAmount` | string (decimal) | no | The explicit VAT amount, as a decimal in the bill currency. Omit to leave unchanged. |
| `updateLines[].valueAllocationId` | string | no | The value-allocation rule distributing this line across dimensions. There is no endpoint for it. Omit to leave unchanged. |
| `updateLines[].purchaseOrderLineId` | string | no | The purchase-order line this line is matched against. There is no endpoint for it. Omit to leave unchanged. |
| `updateLines[].billableExpense` | string | no | The billable-expense status for this line. Values include 'yes', 'no' and 'skipped'. Omit to leave unchanged. |
| `updateLines[].lineType` | string | no | The kind of line. Values include 'expense' and 'prepaidExpense'. Omit to leave unchanged. |
| `deleteLines` | array of string | no | The identifiers of lines to remove, applied before the updates and creates. Each must belong to this bill. |

Example:

```json
{
  "billNumber": "<billNumber>",
  "billDate": "2026-01-15",
  "dueDate": "2026-09-15",
  "serviceDate": "2026-01-15",
  "currency": "<currency>",
  "paymentTerms": "<paymentTerms>",
  "vendorId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "entityId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "markAsPaid": true,
  "origin": "<origin>",
  "createLines": [
    {
      "amount": "19.99",
      "description": "<description>",
      "accountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "departmentId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "businessUnitId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "customerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "vatPercentage": "19.99",
      "vatAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "reverseVatAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "vatAmount": "19.99",
      "valueAllocationId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "purchaseOrderLineId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "billableExpense": "<billableExpense>",
      "lineType": "<lineType>"
    }
  ],
  "updateLines": [
    {
      "id": "7a1b2c3d-4e5f-6071-8293-a4b5c6d7e8f9",
      "amount": "1350.00"
    }
  ],
  "deleteLines": [
    "1f2e3d4c-5b6a-7089-9a8b-7c6d5e4f3a2b"
  ]
}
```

## Response

`200` Success

## Response headers

- `Idempotency-Replayed` — Present and `true` only when this response replays a previously stored one for the same Idempotency-Key, rather than reflecting a live execution. Absent on a live response - never sent as `false`.

## Errors

| Code | Status |
| --- | --- |
| `NOT_FOUND` | 400 |
| `REFERENCE_NOT_FOUND` | 400 |
| `LINE_NOT_FOUND` | 400 |
| `ACCOUNT_ENTITY_MISMATCH` | 400 |
| `TOO_MANY_LINES` | 400 |
| `IDEMPOTENCY_KEY_CONFLICT` | 409 |
| `IDEMPOTENCY_PAYLOAD_MISMATCH` | 422 |

## Statuses

- `400` — Invalid request or business failure. Codes: NOT_FOUND, REFERENCE_NOT_FOUND, LINE_NOT_FOUND, ACCOUNT_ENTITY_MISMATCH, TOO_MANY_LINES
- `401` — Missing or invalid access token
- `403` — Not authorized
- `404` — Not found
- `409` — The Idempotency-Key is still being processed by another request.
- `422` — The Idempotency-Key was already used with a different request payload.
- `429` — Too many requests
- `500` — Internal server error
