# Update an outbound payment

Operation ID: `updateOutboundPayment`

Group: Accounting › Outbound Payments

[Open in the interactive reference](https://docs.api.lensing.ai/lensing/v1/endpoints/updateOutboundPayment)

`PATCH /accounting/outbound-payments/{id}`

Retry-safe: A write that accepts Idempotency-Key: repeating a request with the same key replays the stored answer instead of executing twice.

Updates an outbound payment with the fields you send. A field you leave out keeps its current value.

Use the outbound payment's id, not its outboundPaymentNumber.

Payment items change through three separate arrays, applied in this order: deletePaymentItems, updatePaymentItems, createPaymentItems. Leave out all three to keep the items as they are. When the payment currency differs from the bank account's currency, leaving out actualExchangeRate sets it to systemExchangeRate. If you leave that out too, both are set to the system rate for the payment date. This doesn't apply to a draft payment.

Only a payment that hasn't been executed can be changed. Its payment items can change too.

For a payment that isn't a draft, the status must be 'manuallyRecorded', 'scheduled', 'unknown', 'rejected', or 'cancelled'. For any other status, the request fails with PAYMENT_NOT_EDITABLE. To withdraw a payment that is 'successful', 'partiallySuccessful', or 'processing', use POST accounting/outbound-payments/:id/void.

The payment must keep at least one item. New and changed items are checked the same way as on create.

When an item's amount changes, its old amount is credited back first, so sending the same amount again doesn't count as a second payment.

The response is empty. To see the updated payment, use GET accounting/outbound-payments/:id.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Api-Version` | header | string · 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 of the outbound payment you want to update. Example: `"e93b7d15-2c48-4a60-9f31-5b7c8d9e0a12"`. |

## Request body

Required, `application/json`: updateOutboundPaymentInput.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `accountId` | string | no | The bank or cash account the payment is made from. See id on GET accounting/accounts/:id. |
| `paymentDate` | date | no | The date the payment is made. Use format YYYY-MM-DD. Example: `"2026-08-28"`. |
| `paymentCurrency` | string | no | The currency of the payment. Format ISO 4217, for example 'USD'. Governs each item's amount unless the item names its own currency. |
| `commonDescription` | string | no | A description applied to the payment as a whole. Example: `"August vendor run (revised)"`. |
| `externalUrl` | string | no | A link back to the payment in the upstream system. |
| `origin` | string | no | The source system this payment came from. |
| `senderAccountId` | string | no | A bank account identifier for the sender, supplied by an integration. It is free-form text, not a reference to an account record. |
| `actualExchangeRate` | decimal | no | The exchange rate the bank actually applied, as a decimal. |
| `systemExchangeRate` | decimal | no | The exchange rate the system derived, as a decimal. |
| `skipJournalEntry` | boolean | no | Whether to skip journal-entry creation for this payment. |
| `createPaymentItems` | array<object> | no | Documents to add to this payment. Each has the same shape as on create, without an id. |
| `createPaymentItems[].documentId` | string | yes | The document being paid, of the kind this payment already pays. See id on GET accounting/vendor-bills/:id or GET accounting/expense-reports/:id. |
| `createPaymentItems[].entityId` | string | yes | The legal entity the document is posted under. See id on GET base/entities. |
| `createPaymentItems[].amount` | decimal | yes | The amount applied to this document, as a decimal. |
| `createPaymentItems[].currency` | string | no | The currency for this item. Format ISO 4217, for example 'USD'. Omit to use the payment's currency. |
| `createPaymentItems[].description` | string | yes | What this item pays for. Required. |
| `updatePaymentItems` | array<object> | no | Payment items to change, each addressed by the id the payment publishes. |
| `updatePaymentItems[].id` | string | yes | The unique identifier for the payment item to change. It must belong to this payment. |
| `updatePaymentItems[].documentId` | string | no | The document being paid. See id on GET accounting/vendor-bills/:id or GET accounting/expense-reports/:id. |
| `updatePaymentItems[].entityId` | string | no | The legal entity the document is posted under. See id on GET base/entities. |
| `updatePaymentItems[].amount` | decimal | no | The amount applied to this document, as a decimal. |
| `updatePaymentItems[].currency` | string | no | The currency for this item. Format ISO 4217, for example 'USD'. |
| `updatePaymentItems[].description` | string | no | What this item pays for. |
| `deletePaymentItems` | array<string> | no | The identifiers of payment items to remove, applied before the updates and creates. Each must belong to this payment. Removing them all is refused, so delete the payment instead. |

```json
{
  "accountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "paymentDate": "2026-08-28",
  "paymentCurrency": "<paymentCurrency>",
  "commonDescription": "August vendor run (revised)",
  "externalUrl": "<externalUrl>",
  "origin": "<origin>",
  "senderAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "actualExchangeRate": "19.99",
  "systemExchangeRate": "19.99",
  "skipJournalEntry": true,
  "createPaymentItems": [
    {
      "documentId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "entityId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "amount": "19.99",
      "currency": "<currency>",
      "description": "<description>"
    }
  ],
  "updatePaymentItems": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "documentId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "entityId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "amount": "19.99",
      "currency": "<currency>",
      "description": "<description>"
    }
  ],
  "deletePaymentItems": [
    "<deletePaymentItems>"
  ]
}
```

## Response

`200` Success

```json
{
  "data": {},
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}
```

## 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 |
| `PAYMENT_NOT_EDITABLE` | 400 |
| `REFERENCE_NOT_FOUND` | 400 |
| `ITEM_NOT_FOUND` | 400 |
| `NO_PAYMENT_ITEMS` | 400 |
| `DOCUMENT_NOT_PAYABLE` | 400 |
| `PAYMENT_AMOUNT_EXCEEDS_OPEN_AMOUNT` | 400 |
| `DOCUMENT_CURRENCY_MISMATCH` | 400 |
| `IDEMPOTENCY_KEY_CONFLICT` | 409 |
| `IDEMPOTENCY_PAYLOAD_MISMATCH` | 422 |

## Statuses

- `400` — Invalid request or business failure. Codes: NOT_FOUND, PAYMENT_NOT_EDITABLE, REFERENCE_NOT_FOUND, ITEM_NOT_FOUND, NO_PAYMENT_ITEMS, DOCUMENT_NOT_PAYABLE, PAYMENT_AMOUNT_EXCEEDS_OPEN_AMOUNT, DOCUMENT_CURRENCY_MISMATCH
- `401` — The request carries no valid 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 from this client address. The response has no body and no `Retry-After` header.
- `500` — Internal server error
