# Update a credit card entry

Operation ID: `updateCreditCardEntry`

Group: Banking › Credit Card Entries

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

`PATCH /banking/credit-card-entries/{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 a credit card entry with the fields you send. A field you leave out keeps its current value.

Use the credit card entry's id, not its creditCardEntryNumber.

Lines change through three arrays: createLines, updateLines, and deleteLines. A line you don't name keeps its current values. deleteLines are applied first, then updateLines, then createLines.

After the changes, the entry must still have at least one line, no line of zero, and a total that isn't zero.

The response is empty. Read the result with GET banking/credit-card-entries/: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 credit card entry you want to update. Example: `"c41d0b58-2e97-4f6a-8d13-7b5e9c204af6"`. |

## Request body

Required, `application/json`: updateCreditCardEntryInput.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `entityId` | string | no | The legal entity the entry is posted under. See id on GET base/entities. |
| `creditCardAccountId` | string | no | The general-ledger account behind the credit card account this entry posts against. See id on GET accounting/accounts/:id. |
| `transactionDate` | date | no | The date the transaction took place. Use format YYYY-MM-DD. Changing it re-resolves the posting period. |
| `currency` | string | no | The currency of the entry. Format ISO 4217, for example 'USD'. When supplied it must match the account's currency. |
| `status` | string | no | The reconciliation status. Accepted values: 'Matched', 'Unmatched', 'Posted', 'Voided', 'Integrated'. |
| `name` | string | no | A short name for the entry. Example: `"February bank fees — revised"`. |
| `description` | string | no | A free-form description of the entry. |
| `serviceDate` | date | no | The date the goods or services were delivered. Use format YYYY-MM-DD. |
| `origin` | string | no | The system or process the entry originated from. |
| `externalUrl` | string | no | A link to the entry in the originating system. |
| `createLines` | array<object> | no | Lines to add. Each has the same shape as a line on create, with no id because the line does not exist yet. Example: `[{"accountId":"9994c3ed-f812-44c1-9454-7f36b2bfb0fb","amount":"-25.00","description":"Wire fee"}]`. |
| `createLines[].accountId` | string | yes | The general-ledger account this line posts to. It must not be a grouping account. See id on GET accounting/accounts/:id. |
| `createLines[].amount` | decimal | yes | The line amount, as a decimal in the entry currency. It must be non-zero. |
| `createLines[].description` | string | no | A free-form description of the line. |
| `createLines[].departmentId` | string | no | The department this line is attributed to. See id on GET people/departments/:id. |
| `createLines[].businessUnitId` | string | no | The business unit this line is attributed to. There is no endpoint for it. |
| `createLines[].businessPartnerId` | string | no | The business partner this line is attributed to. Required when vatPercentage is supplied. There is no endpoint for it. |
| `createLines[].lineType` | string | no | The kind of line. Accepted values: 'oneTime', 'prepaid'. Derived from the account's sub-type when omitted. |
| `createLines[].vatPercentage` | decimal | no | The VAT rate applied, as a percentage. For example, 19 means 19%. Supplying it requires businessPartnerId. |
| `createLines[].vatAccountId` | string | no | The general-ledger account the VAT posts to. See id on GET accounting/accounts/:id. |
| `createLines[].reverseVatAccountId` | string | no | The general-ledger account the reverse-charge VAT posts to. See id on GET accounting/accounts/:id. |
| `createLines[].vatAmount` | decimal | no | The VAT amount, as a decimal in the entry currency. Omit to derive it from vatPercentage. |
| `createLines[].netAmount` | decimal | no | The net amount, as a decimal in the entry currency. Omit to derive it from amount less VAT. |
| `createLines[].amortizationSchedules` | array<object> | no | The amortization schedules to defer this new line over, one per accounting book. A plain array because the line does not exist yet, so there is nothing to change or remove. Only a prepaid line may carry them. |
| `createLines[].amortizationSchedules[].bookId` | string | no | The accounting book this schedule posts into. See id on GET accounting/books/:id. Omit it on a single-book entity to use that entity's default transaction book; send one entry per book otherwise. Two entries for the same book are refused with DUPLICATE_AMORTIZATION_BOOK. |
| `createLines[].amortizationSchedules[].deferredAccountId` | string | no | The general ledger account the deferred balance sits on until it is recognized. See id on GET accounting/accounts/:id. Defaults to the line's own accountId. |
| `createLines[].amortizationSchedules[].recognitionAccountId` | string | yes | The general ledger account where each schedule line recognizes the expense. See id on GET accounting/accounts/:id. |
| `createLines[].amortizationSchedules[].amortizationMethod` | string | yes | How the schedule spreads its total. Values include 'exactDays', 'pointInTime', 'straightLine', 'straightLineProRateFirstLast' and 'usageBased'. |
| `createLines[].amortizationSchedules[].amortizationStartDate` | date | yes | The first day the schedule amortizes over. Format YYYY-MM-DD. It must not be after amortizationEndDate. |
| `createLines[].amortizationSchedules[].amortizationEndDate` | date | yes | The last day the schedule amortizes over, inclusive. Format YYYY-MM-DD. |
| `createLines[].amortizationSchedules[].term` | decimal | yes | The number of months the schedule spreads over. A count, not an amount, so it carries no currency. |
| `createLines[].amortizationSchedules[].description` | string | no | A note to record against the schedule. |
| `updateLines` | array<object> | no | Lines to change, each addressed by its id. Every field but the id is optional, and omitting one leaves that field unchanged. Example: `[{"id":"7a1b2c3d-4e5f-6071-8293-a4b5c6d7e8f9","amount":"-150.00"}]`. |
| `updateLines[].id` | string | yes | The unique identifier for the line to change. It must belong to this credit card entry. |
| `updateLines[].accountId` | string | no | The general-ledger account this line posts to. It must not be a grouping account. See id on GET accounting/accounts/:id. |
| `updateLines[].amount` | decimal | no | The line amount, as a decimal in the entry currency. It must be non-zero. |
| `updateLines[].description` | string | no | A free-form description of the line. |
| `updateLines[].departmentId` | string | no | The department this line is attributed to. See id on GET people/departments/:id. |
| `updateLines[].businessUnitId` | string | no | The business unit this line is attributed to. There is no endpoint for it. |
| `updateLines[].businessPartnerId` | string | no | The business partner this line is attributed to. Required when vatPercentage is supplied. There is no endpoint for it. |
| `updateLines[].lineType` | string | no | The kind of line. Accepted values: 'oneTime', 'prepaid'. Derived from the account's sub-type when omitted. |
| `updateLines[].vatPercentage` | decimal | no | The VAT rate applied, as a percentage. For example, 19 means 19%. Supplying it requires businessPartnerId. |
| `updateLines[].vatAccountId` | string | no | The general-ledger account the VAT posts to. See id on GET accounting/accounts/:id. |
| `updateLines[].reverseVatAccountId` | string | no | The general-ledger account the reverse-charge VAT posts to. See id on GET accounting/accounts/:id. |
| `updateLines[].vatAmount` | decimal | no | The VAT amount, as a decimal in the entry currency. Omit to derive it from vatPercentage. |
| `updateLines[].netAmount` | decimal | no | The net amount, as a decimal in the entry currency. Omit to derive it from amount less VAT. |
| `updateLines[].createAmortizationSchedules` | array<object> | no | Amortization schedules to add to this line, one per accounting book it does not already have one for. Omit all three amortization arrays to leave the line's schedules exactly as they are. |
| `updateLines[].createAmortizationSchedules[].bookId` | string | no | The accounting book this schedule posts into. See id on GET accounting/books/:id. Omit it on a single-book entity to use that entity's default transaction book. A book the line already has a schedule for is refused with DUPLICATE_AMORTIZATION_BOOK. |
| `updateLines[].createAmortizationSchedules[].deferredAccountId` | string | no | The general ledger account the deferred balance sits on until it is recognized. See id on GET accounting/accounts/:id. Defaults to the line's own accountId. |
| `updateLines[].createAmortizationSchedules[].recognitionAccountId` | string | yes | The general ledger account where each schedule line recognizes the expense. See id on GET accounting/accounts/:id. |
| `updateLines[].createAmortizationSchedules[].amortizationMethod` | string | yes | How the schedule spreads its total. Values include 'exactDays', 'pointInTime', 'straightLine', 'straightLineProRateFirstLast' and 'usageBased'. |
| `updateLines[].createAmortizationSchedules[].amortizationStartDate` | date | yes | The first day the schedule amortizes over. Format YYYY-MM-DD. It must not be after amortizationEndDate. |
| `updateLines[].createAmortizationSchedules[].amortizationEndDate` | date | yes | The last day the schedule amortizes over, inclusive. Format YYYY-MM-DD. |
| `updateLines[].createAmortizationSchedules[].term` | decimal | yes | The number of months the schedule spreads over. A count, not an amount, so it carries no currency. |
| `updateLines[].createAmortizationSchedules[].description` | string | no | A note to record against the schedule. |
| `updateLines[].updateAmortizationSchedules` | array<object> | no | Amortization schedules to change, each addressed by its id and belonging to this line. Every field but the id is optional. Changing the dates without the term, or the term without the dates, is refused with AMORTIZATION_TERM_MISMATCH when the two would disagree. |
| `updateLines[].updateAmortizationSchedules[].id` | string | yes | The unique identifier for the schedule to change. It must be one this line already carries. |
| `updateLines[].updateAmortizationSchedules[].bookId` | string | no | The accounting book this schedule posts into. See id on GET accounting/books/:id. |
| `updateLines[].updateAmortizationSchedules[].deferredAccountId` | string | no | The general ledger account the deferred balance sits on until it is recognized. See id on GET accounting/accounts/:id. |
| `updateLines[].updateAmortizationSchedules[].recognitionAccountId` | string | no | The general ledger account where each schedule line recognizes the expense. See id on GET accounting/accounts/:id. |
| `updateLines[].updateAmortizationSchedules[].amortizationMethod` | string | no | How the schedule spreads its total. Values include 'exactDays', 'pointInTime', 'straightLine', 'straightLineProRateFirstLast' and 'usageBased'. |
| `updateLines[].updateAmortizationSchedules[].amortizationStartDate` | date | no | The first day the schedule amortizes over. Format YYYY-MM-DD. |
| `updateLines[].updateAmortizationSchedules[].amortizationEndDate` | date | no | The last day the schedule amortizes over, inclusive. Format YYYY-MM-DD. |
| `updateLines[].updateAmortizationSchedules[].term` | decimal | no | The number of months the schedule spreads over. A count, not an amount, so it carries no currency. |
| `updateLines[].updateAmortizationSchedules[].description` | string | no | A note to record against the schedule. |
| `updateLines[].deleteAmortizationSchedules` | array<string> | no | The identifiers of amortization schedules to remove from this line. Each must be one this line already carries. The schedule is deleted, not merely unlinked. |
| `deleteLines` | array<string> | no | The identifiers of lines to remove. Each must belong to this credit card entry. Example: `["1f2e3d4c-5b6a-7089-9a8b-7c6d5e4f3a2b"]`. |

```json
{
  "entityId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "creditCardAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "transactionDate": "2026-01-15",
  "currency": "<currency>",
  "status": "<status>",
  "name": "February bank fees — revised",
  "description": "<description>",
  "serviceDate": "2026-01-15",
  "origin": "<origin>",
  "externalUrl": "<externalUrl>",
  "createLines": [
    {
      "accountId": "9994c3ed-f812-44c1-9454-7f36b2bfb0fb",
      "amount": "-25.00",
      "description": "Wire fee"
    }
  ],
  "updateLines": [
    {
      "id": "7a1b2c3d-4e5f-6071-8293-a4b5c6d7e8f9",
      "amount": "-150.00"
    }
  ],
  "deleteLines": [
    "1f2e3d4c-5b6a-7089-9a8b-7c6d5e4f3a2b"
  ]
}
```

## 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 |
| `LINE_NOT_FOUND` | 400 |
| `REFERENCE_NOT_FOUND` | 400 |
| `INVALID_FIELD_VALUE` | 400 |
| `POSTING_PERIOD_NOT_OPEN` | 400 |
| `CURRENCY_MISMATCH` | 400 |
| `ACCOUNT_ENTITY_MISMATCH` | 400 |
| `GROUPING_ACCOUNT_NOT_ALLOWED` | 400 |
| `BUSINESS_PARTNER_REQUIRED_FOR_VAT` | 400 |
| `AMORTIZATION_NOT_ALLOWED_ON_LINE` | 400 |
| `AMORTIZATION_DATE_RANGE_INVALID` | 400 |
| `AMORTIZATION_BOOK_NOT_CONFIGURED` | 400 |
| `DUPLICATE_AMORTIZATION_BOOK` | 400 |
| `AMORTIZATION_TERM_MISMATCH` | 400 |
| `AMORTIZATION_METHOD_INVALID` | 400 |
| `AMORTIZATION_SCHEDULE_NOT_FOUND` | 400 |
| `AMORTIZATION_SCHEDULE_POSTED` | 400 |
| `IDEMPOTENCY_KEY_CONFLICT` | 409 |
| `IDEMPOTENCY_PAYLOAD_MISMATCH` | 422 |

## Statuses

- `400` — Invalid request or business failure. Codes: NOT_FOUND, LINE_NOT_FOUND, REFERENCE_NOT_FOUND, INVALID_FIELD_VALUE, POSTING_PERIOD_NOT_OPEN, CURRENCY_MISMATCH, ACCOUNT_ENTITY_MISMATCH, GROUPING_ACCOUNT_NOT_ALLOWED, BUSINESS_PARTNER_REQUIRED_FOR_VAT, AMORTIZATION_NOT_ALLOWED_ON_LINE, AMORTIZATION_DATE_RANGE_INVALID, AMORTIZATION_BOOK_NOT_CONFIGURED, DUPLICATE_AMORTIZATION_BOOK, AMORTIZATION_TERM_MISMATCH, AMORTIZATION_METHOD_INVALID, AMORTIZATION_SCHEDULE_NOT_FOUND, AMORTIZATION_SCHEDULE_POSTED
- `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
