Update a vendor credit
Operation ID: updateVendorCredit
Group: Accounting › Vendor Credits
Open in the interactive reference
PATCH /accounting/vendor-credits/{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 vendor credit with the fields you send. A field you leave out keeps its current value. Line items change through three separate arrays, applied in this order: deleteLines, updateLines, createLines.
Leave out all three to keep the lines as they are. On an updateLines item, a field you leave out keeps its current value, and amortization schedules change through createAmortizationSchedules, updateAmortizationSchedules and deleteAmortizationSchedules.
The credit's main fields and its line items can change in one request. The vendor and the legal entity can't be changed. To move a credit to another vendor or legal entity, create a new credit.
One request can remove a line and add its replacement.
updateLines and deleteLines name each line by the id that GET accounting/vendor-credits/:id returns for it. Each line must belong to this credit.
The response is empty. To see the updated credit, use GET accounting/vendor-credits/: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 vendor credit you want to update. Example: "d52e1c69-3fa8-4b17-9e24-8c6fa0315bd7". |
Request body
Required, application/json: updateVendorCreditInput.
| Field | Type | Required | Description |
|---|---|---|---|
referenceNumber |
string | no | The vendor's credit memo reference number, as printed on the document. Omit to leave unchanged. Example: "CN-4471-A". |
creditDate |
date | no | The date on the vendor's credit memo. Use format YYYY-MM-DD. Omit to leave unchanged. |
currency |
string | no | The currency of the credit. Format ISO 4217, for example 'USD'. 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<object> | no | Lines to add to the credit, each with the same shape as on create and no id. Omit for no additions. |
createLines[].amount |
decimal | yes | The gross credit amount for the line, as a decimal in the credit currency. |
createLines[].description |
string | no | A description of the credit line. |
createLines[].accountId |
string | no | The general ledger account this line credits. See id on GET accounting/accounts/:id. |
createLines[].departmentId |
string | no | The department this line is allocated to. See id on GET people/departments/:id. |
createLines[].businessUnitId |
string | no | The business unit this line is allocated to. There is no endpoint for it. |
createLines[].vatPercentage |
decimal | no | The VAT rate applied, as a percentage. 19 means 19%, not 0.19. |
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 reverse-charge VAT posts to. See id on GET accounting/accounts/:id. |
createLines[].vatAmount |
decimal | no | The explicit VAT amount, as a decimal in the credit 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[].lineType |
string | no | The kind of line. Accepted values: 'expense' (a one-time credit) or 'prepaid' (a credit spread over several periods). Defaults to 'expense'. |
createLines[].amortizationSchedules |
array<object> | no | The amortization schedules to defer this line over, one per accounting book. A new line has nothing to change or remove, so this is a plain array, the same shape POST accounting/vendor-credits takes. |
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. |
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 each installment recognizes the expense into. 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 the id the credit publishes. Every field but the id is optional and left unchanged when omitted. Omit for no changes. Example: [{"id":"6b2a9f18-7c3d-4e5a-8b19-2d4e6f8a0c31","amount":"350.00"}]. |
updateLines[].id |
string | yes | The unique identifier for the line to change. It must belong to this credit. |
updateLines[].amount |
decimal | no | The gross credit amount for the line, as a decimal in the credit currency. Omit to leave unchanged. |
updateLines[].description |
string | no | A description of the credit line. Omit to leave unchanged. |
updateLines[].accountId |
string | no | The general ledger account this line credits. See id on GET accounting/accounts/:id. Omit to leave unchanged. |
updateLines[].departmentId |
string | no | The department this line is allocated to. See id on GET people/departments/:id. Omit to leave unchanged. |
updateLines[].businessUnitId |
string | no | The business unit this line is allocated to. There is no endpoint for it. Omit to leave unchanged. |
updateLines[].vatPercentage |
decimal | no | The VAT rate applied, as a percentage. 19 means 19%, not 0.19. Omit to leave unchanged. |
updateLines[].vatAccountId |
string | no | The general ledger account the VAT posts to. See id on GET accounting/accounts/:id. Omit to leave unchanged. |
updateLines[].reverseVatAccountId |
string | no | The general ledger account reverse-charge VAT posts to. See id on GET accounting/accounts/:id. Omit to leave unchanged. |
updateLines[].vatAmount |
decimal | no | The explicit VAT amount, as a decimal in the credit currency. Omit to derive it from vatPercentage. |
updateLines[].valueAllocationId |
string | no | The value-allocation rule distributing this line across dimensions. There is no endpoint for it. Omit to leave unchanged. |
updateLines[].lineType |
string | no | The kind of line. Accepted values: 'expense' (a one-time credit) or 'prepaid' (a credit spread over several periods). Omit to leave unchanged. |
updateLines[].createAmortizationSchedules |
array<object> | no | Amortization schedules to add to this line, each with no id. Omit for no additions. Send none of the three amortization arrays to leave this 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. |
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 accountId sent on this updateLines item. If that item doesn't send accountId, send deferredAccountId. |
updateLines[].createAmortizationSchedules[].recognitionAccountId |
string | yes | The general ledger account each installment recognizes the expense into. 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 the id the credit publishes. A schedule that has already started recognizing is refused with AMORTIZATION_SCHEDULE_POSTED. Omit for no changes. |
updateLines[].updateAmortizationSchedules[].id |
string | yes | The identifier of 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. Omit to leave unchanged. |
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. Omit to leave unchanged, unless this updateLines item also sends accountId, in which case it is set to that account. |
updateLines[].updateAmortizationSchedules[].recognitionAccountId |
string | no | The general ledger account each installment recognizes the expense into. See id on GET accounting/accounts/:id. Omit to leave unchanged. |
updateLines[].updateAmortizationSchedules[].amortizationMethod |
string | no | How the schedule spreads its total. Values include 'exactDays', 'pointInTime', 'straightLine', 'straightLineProRateFirstLast' and 'usageBased'. Omit to leave unchanged. |
updateLines[].updateAmortizationSchedules[].amortizationStartDate |
date | no | The first day the schedule amortizes over. Format YYYY-MM-DD. Omit to leave unchanged. |
updateLines[].updateAmortizationSchedules[].amortizationEndDate |
date | no | The last day the schedule amortizes over, inclusive. Format YYYY-MM-DD. Omit to leave unchanged. |
updateLines[].updateAmortizationSchedules[].term |
decimal | no | The number of months the schedule spreads over. Omit to leave unchanged. |
updateLines[].updateAmortizationSchedules[].description |
string | no | A note to record against the schedule. Omit to leave unchanged. |
updateLines[].deleteAmortizationSchedules |
array<string> | no | The identifiers of amortization schedules to remove from this line. Each must be one this line carries, and one that has not started recognizing. Removing a schedule leaves this line's other books untouched. |
deleteLines |
array<string> | no | The identifiers of lines to remove, applied before the updates and creates. Each must belong to this credit. Removing a line also removes the amortization schedules it carried. |
{
"referenceNumber": "CN-4471-A",
"creditDate": "2026-01-15",
"currency": "<currency>",
"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",
"vatPercentage": "19.99",
"vatAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"reverseVatAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"vatAmount": "19.99",
"valueAllocationId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"lineType": "<lineType>",
"amortizationSchedules": [
{
"bookId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"deferredAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"recognitionAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"amortizationMethod": "<amortizationMethod>",
"amortizationStartDate": "2026-01-15",
"amortizationEndDate": "2026-01-15",
"term": "19.99",
"description": "<description>"
}
]
}
],
"updateLines": [
{
"id": "6b2a9f18-7c3d-4e5a-8b19-2d4e6f8a0c31",
"amount": "350.00"
}
],
"deleteLines": [
"<deleteLines>"
]
}
Response
200 Success
{
"data": {},
"diagnostics": [
{
"code": "<code>",
"message": "<message>",
"severity": "error",
"path": [
"<path>"
],
"details": "<details>"
}
]
}
Response headers
Idempotency-Replayed— Present andtrueonly 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 asfalse.
Errors
| Code | Status |
|---|---|
NOT_FOUND |
400 |
REFERENCE_NOT_FOUND |
400 |
LINE_NOT_FOUND |
400 |
REFERENCE_NUMBER_NOT_UNIQUE |
400 |
TOO_MANY_LINES |
400 |
AMORTIZATION_SCHEDULE_NOT_FOUND |
400 |
AMORTIZATION_SCHEDULE_POSTED |
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 |
IDEMPOTENCY_KEY_CONFLICT |
409 |
IDEMPOTENCY_PAYLOAD_MISMATCH |
422 |
Statuses
400— Invalid request or business failure. Codes: NOT_FOUND, REFERENCE_NOT_FOUND, LINE_NOT_FOUND, REFERENCE_NUMBER_NOT_UNIQUE, TOO_MANY_LINES, AMORTIZATION_SCHEDULE_NOT_FOUND, AMORTIZATION_SCHEDULE_POSTED, AMORTIZATION_NOT_ALLOWED_ON_LINE, AMORTIZATION_DATE_RANGE_INVALID, AMORTIZATION_BOOK_NOT_CONFIGURED, DUPLICATE_AMORTIZATION_BOOK, AMORTIZATION_TERM_MISMATCH, AMORTIZATION_METHOD_INVALID401— The request carries no valid access token.403— Not authorized404— Not found409— 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 noRetry-Afterheader.500— Internal server error