Create a debit memo
Operation ID: createDebitMemo
Group: Accounting › Debit Memos
Open in the interactive reference
POST /accounting/debit-memos
Retry-safe: A write that accepts Idempotency-Key: repeating a request with the same key replays the stored answer instead of executing twice.
Creates a debit memo, either to settle a source credit memo or standalone.
To settle a credit memo, send creditMemoId. The customer, legal entity, and currency come from that credit memo, not from the request, and every line names the credit memo line it debits in creditMemoLineId. debitMemoType, billToAddressId, and soldToAddressId default to the credit memo's values when you leave them out. The debit memo is approved as it's created, and its journal entry is created in the general ledger in the same request.
For a standalone debit memo, leave out creditMemoId and send customerId instead. The legal entity and currency come from the customer, and billToAddressId and soldToAddressId default to the customer's default addresses. Its type is always 'standaloneCharge'. A line that names a product, through productId or productLineId, needs quantity and unitPrice; any other line needs description and creditGlAccountId. On a legal entity that has VAT enabled and no tax engine, every line also needs vatAccountingType. A standalone debit memo is created as a draft: it has no number and no journal entry until it's approved.
The response contains the created debit memo, including its lines.
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. |
Request body
Required, application/json: createDebitMemoInput.
| Field | Type | Required | Description |
|---|---|---|---|
creditMemoId |
string | no | The source credit memo this debit memo settles. The customer, legal entity and currency come from this credit memo, not the request. Omit it to create a standalone debit memo, and send customerId instead. See id on GET accounting/credit-memos/:id. Example: "5a0f3e6d-81b7-4c8e-9b21-9c2a6a107d34". |
customerId |
string | no | The customer a standalone debit memo is issued to. Required when creditMemoId is omitted; the legal entity, currency and default addresses come from this customer. Sending it together with creditMemoId fails with FIELD_NOT_ALLOWED. See id on GET accounting/customers/:id. |
debitMemoDate |
date | yes | The date the debit memo is issued. Use format YYYY-MM-DD. Unless isMigrated is true, it must fall in an open accounting period, or the request fails with ACCOUNTING_PERIOD_CLOSED, or ACCOUNTING_PERIOD_NOT_FOUND when no period covers it. Example: "2026-08-01". |
paymentTerm |
string | yes | The payment-term key to apply. When dueDate is omitted, it is computed from debitMemoDate plus this term's days. An unknown key fails with PAYMENT_TERM_NOT_FOUND. See code on GET accounting/payment-terms. Example: "net30". |
debitMemoType |
string | no | The reason key for the charge, for example 'orderEntryError'. Omit to inherit the source credit memo's reason key; when neither supplies one the call fails with MISSING_REQUIRED_FIELD. The accepted keys are configured per tenant. A standalone debit memo is always 'standaloneCharge', and any other value fails with INVALID_ENUM_VALUE. Example: "orderEntryError". |
dueDate |
date | no | The date the debit memo falls due. Use format YYYY-MM-DD. Omit to compute it from debitMemoDate plus the payment term's days. Must not be before debitMemoDate, or the request fails with DUE_DATE_BEFORE_DEBIT_MEMO_DATE. |
taxDate |
date | no | The date to determine tax on. Use format YYYY-MM-DD. Omit to use debitMemoDate. |
billToAddressId |
string | no | The bill-to address for the document. Omit to inherit the source credit memo's, or the customer's default bill-to address on a standalone debit memo. When neither supplies one the call fails with MISSING_REQUIRED_FIELD. There is no endpoint for it. |
soldToAddressId |
string | no | The sold-to address for the document. Omit to inherit the source credit memo's, or the customer's default sold-to address on a standalone debit memo. When neither supplies one the call fails with MISSING_REQUIRED_FIELD. There is no endpoint for it. |
purchaseOrder |
string | no | The customer's own purchase-order reference to record on the document. Example: "PO-88213". |
customerMessage |
string | no | A free-text message to show the customer on the document. |
debitGlAccountId |
string | no | The general ledger account the journal entry debits for the debit memo's full amount. Omit to use the entity's customer receivables account. See id on GET accounting/accounts/:id. |
isMigrated |
boolean | no | Whether the debit memo was loaded from a previous system. When true, it is excluded from dunning, its journal entries are auto-reversed, and the open-accounting-period check on debitMemoDate is skipped. Defaults to false. |
externalIdentifiers |
array<object> | no | The debit memo's identifiers in other systems, one per configured field name. Each fieldName must be the fieldName of an existing debit-memo external-identifier configuration, or the request fails with UNKNOWN_EXTERNAL_IDENTIFIER. |
externalIdentifiers[].fieldName |
string | yes | The configured field name of the identifier, for example 'Maxio Invoice Key'. |
externalIdentifiers[].value |
string | yes | The identifier in the other system. |
externalIdentifiers[].externalUrl |
string | no | A link to the record in the other system. |
lines |
array<object> | yes | The lines of the debit memo. At least one is required, or the request fails with NO_LINES. Every amount is in the debit memo's currency: the source credit memo's, or the customer's on a standalone debit memo. Example: [{"creditMemoLineId":"7d34c8e9-b21f-4a5c-9f3e-6d81b7d0aec3","description":"Re-debit of over-credited licence fee","quantity":"2","unitOfMeasure":"license","unitPrice":"250.00","totalPrice":"500.00"}]. |
lines[].creditMemoLineId |
string | no | The source credit memo line this line debits. Required on a debit memo from a credit memo, and must be a line of the credit memo named by creditMemoId, or the request fails with CREDIT_MEMO_LINE_NOT_FOUND. The debit memo line inherits its tax-exclusion state from that source line. Not accepted on a standalone debit memo. See lines[].id on GET accounting/credit-memos/:id. |
lines[].totalPrice |
decimal | yes | The line total excluding tax, in the debit memo currency (see currency). Must be greater than 0. |
lines[].description |
string | no | A free-text line description, shown to the customer. Required on a standalone line that names no product. |
lines[].productId |
string | no | The product the line refers to. Omit on a free-text line, or on a standalone line that names its productLineId. See id on GET accounting/products/:id. |
lines[].productLineId |
string | no | The product line the line bills, on a standalone debit memo only. Its product, unit of measure and tax mode apply when you leave those out. Must be a line of productId when you send both, or the request fails with PRODUCT_LINE_NOT_FOUND. |
lines[].quantity |
decimal | no | The quantity debited. A count, not an amount, so it has no currency. Required on a standalone line that names a product. |
lines[].unitOfMeasure |
string | no | The unit-of-measure key, for example 'each'. An unrecognized value fails with INVALID_ENUM_VALUE. Defaults to the product line's on a standalone line that names one. |
lines[].unitPrice |
decimal | no | The price per unit, in the debit memo currency (see currency). Required on a standalone line that names a product. |
lines[].adjustedUnitPrice |
decimal | no | The price per unit after adjustment, in the debit memo currency (see currency). |
lines[].taxAmount |
decimal | no | The tax on the line, in the debit memo currency (see currency). Omit to have the tax engine determine it. |
lines[].taxCode |
string | no | The tax code to apply to the line. |
lines[].taxDate |
date | no | The date to determine the line's tax on. Use format YYYY-MM-DD. |
lines[].taxMode |
string | no | How the line's prices are quoted for tax. Defaults to the product line's on a standalone line that names one. One of: "taxInclusive", "taxExclusive". |
lines[].taxExemptCode |
string | no | The customer-level tax-exempt code to apply to the line. |
lines[].creditGlAccountId |
string | no | The line's credit general ledger account, the credit side of the journal entry. Required on a standalone line that names no product. See id on GET accounting/accounts/:id. |
lines[].vatAccountingType |
string | no | The VAT type of the line, on a standalone debit memo only. Required on every standalone line when the legal entity has VAT enabled and no tax engine. One of: "domesticStandardRate", "domesticReducedRate", "domesticSalesZeroRated", "domesticSalesExempt", "vatIntraEuStandardRate", "vatIntraEuReducedRate", "nonEuExempt", "reverseCharge". |
lines[].serviceStartDate |
date | no | The first day of the service period the line covers. Use format YYYY-MM-DD. |
lines[].serviceEndDate |
date | no | The last day of the service period the line covers, inclusive. Use format YYYY-MM-DD. |
lines[].externalIdentifiers |
array<object> | no | The line's identifiers in other systems, one per configured field name. Each fieldName must be the fieldName of an existing debit-memo-line external-identifier configuration, or the request fails with UNKNOWN_EXTERNAL_IDENTIFIER. |
lines[].externalIdentifiers[].fieldName |
string | yes | The configured field name of the identifier, for example 'Maxio Invoice Key'. |
lines[].externalIdentifiers[].value |
string | yes | The identifier in the other system. |
lines[].externalIdentifiers[].externalUrl |
string | no | A link to the record in the other system. |
{
"debitMemoDate": "2026-08-01",
"paymentTerm": "net30",
"lines": [
{
"creditMemoLineId": "7d34c8e9-b21f-4a5c-9f3e-6d81b7d0aec3",
"description": "Re-debit of over-credited licence fee",
"quantity": "2",
"unitOfMeasure": "license",
"unitPrice": "250.00",
"totalPrice": "500.00"
}
]
}
Response
200 Success
Under data (createDebitMemoOutput):
| Field | Type | Required | Description |
|---|---|---|---|
id |
string | yes | The unique identifier for the created debit memo. Example: "3b7d5e9c-1a24-4f80-9c6d-2e8f70b13a45". |
debitMemoNumber |
string | no | The debit memo number, for example 'DM-1'. A standalone debit memo that isn't approved yet carries a placeholder such as 'DRAFT-3' instead, and gets its number when it's approved. Absent while none has been assigned. Example: "DM-1042". |
creditMemoId |
string | no | The source credit memo this debit memo settles. See id on GET accounting/credit-memos/:id. Example: "5a0f3e6d-81b7-4c8e-9b21-9c2a6a107d34". |
creditMemoNumber |
string | no | The number of the source credit memo. Present whenever creditMemoId is. |
debitMemoDate |
date | yes | The date the debit memo was issued. Format YYYY-MM-DD. Example: "2026-08-01". |
dueDate |
date | no | The date the debit memo falls due. Format YYYY-MM-DD. As supplied, or computed from debitMemoDate plus the payment term's days. Example: "2026-08-31". |
taxDate |
date | no | The date the debit memo's tax was determined on. Format YYYY-MM-DD. Defaults to debitMemoDate. |
approvalStatus |
string | no | The approval status of the new debit memo: 'approved' for a debit memo from a credit memo, which is approved as it's created, and 'draft' for a standalone one. Example: "approved". |
debitMemoStatus |
string | no | The payment and credit coverage status. Possible values: 'unpaid', 'isOverdue', 'partiallyPaid', 'paidInFull', 'creditedInFull'. Absent before approval. Not refreshed daily: it is recomputed on approval, when an approved debit memo's date or due date changes, and whenever a payment or credit is applied to it or unapplied. So a partly covered debit memo stays 'partiallyPaid' past its due date, and 'isOverdue' appears on an uncovered one only once a recompute runs after the due date. |
debitMemoType |
string | yes | The reason key for the charge, as supplied or inherited from the source credit memo, for example 'orderEntryError'. Always 'standaloneCharge' on a standalone debit memo. Example: "orderEntryError". |
currency |
string | yes | The currency of the debit memo, taken from the source credit memo or, on a standalone debit memo, from the customer. Format ISO 4217, for example 'USD'. It governs every amount on the record. Example: "USD". |
customerId |
string | yes | The customer the debit memo is issued to: the source credit memo's, or the one sent for a standalone debit memo. See id on GET accounting/customers/:id. Example: "9c2a6a10-7d34-4c8e-9b21-5a0f3e6d81b7". |
customerName |
string | no | The display name of the customer. |
customerNumber |
string | no | The customer number. |
entityId |
string | yes | The legal entity that issued the debit memo, taken from the source credit memo or, on a standalone debit memo, from the customer. See id on GET base/entities. Example: "1a24d5e9-3b7d-4f80-9c6d-2e8f70b13a45". |
entityName |
string | no | The name of the issuing legal entity. |
paymentTerm |
string | yes | The payment-term key applied to the debit memo. See code on GET accounting/payment-terms. Example: "net30". |
purchaseOrder |
string | no | The customer's own purchase-order reference. |
customerMessage |
string | no | A free-text message shown to the customer on the document. |
externalDebitMemoId |
string | no | The identifier of this debit memo in an external source system. For identifiers owned by your other systems, use externalIdentifiers below. |
isMigrated |
boolean | no | Whether the debit memo was loaded from a previous system. When true, it is excluded from dunning and its journal entries are auto-reversed. |
debitGlAccountId |
string | no | The general ledger account the journal entry debits for the debit memo's full amount. Absent when you didn't send one. The journal entry then uses the entity's customer receivables account. See id on GET accounting/accounts/:id. |
billToAddressId |
string | yes | The bill-to address on the document. There is no endpoint for it. Example: "9f3e6d81-b7d0-4aec-8c3f-2e8f70b13a45". |
soldToAddressId |
string | yes | The sold-to address on the document. There is no endpoint for it. Example: "b7d0aec3-9f3e-4d81-8c3f-6d81b7d0aec3". |
subtotal |
decimal | no | The sum of the lines' pre-discount totals, in the debit memo currency. |
totalAmount |
decimal | no | The total including tax, in the debit memo currency. Example: "500.00". |
totalTax |
decimal | no | The total tax across all lines, in the debit memo currency. |
totalAmountDebited |
decimal | no | The gross amount debited, in the debit memo currency. |
lineDiscounts |
decimal | no | The sum of the prorated discount amounts across all lines, in the debit memo currency. |
unappliedCreditAmount |
decimal | no | The credit still unapplied on the source credit memo, in the debit memo currency. Absent on a standalone debit memo. |
lastModifiedDate |
date-time | yes | The date and time the debit memo record last changed, in UTC. Format YYYY-MM-DDTHH:mm:ss.sssZ. Example: "2026-08-01T09:12:44.000Z". |
lines |
array<object> | no | The lines of the created debit memo, each with its assigned id and line number. |
lines[].id |
string | yes | The unique identifier for the debit memo line. |
lines[].lineNumber |
string | no | The sequential line number within the debit memo. |
lines[].description |
string | no | A free-text line description, shown to the customer. |
lines[].productId |
string | no | The debited product. Absent on a free-text line. See id on GET accounting/products/:id. |
lines[].productLineId |
string | no | The product line the line bills. Absent unless a standalone line names one. |
lines[].creditMemoLineId |
string | no | The source credit memo line this line debits. Absent on a standalone debit memo. See lines[].id on GET accounting/credit-memos/:id. |
lines[].quantity |
decimal | no | The quantity debited. A count, not an amount, so it has no currency. |
lines[].unitOfMeasure |
string | no | The unit-of-measure key, for example 'each'. |
lines[].unitPrice |
decimal | no | The price per unit, in the debit memo currency. |
lines[].adjustedUnitPrice |
decimal | no | The price per unit after adjustment, in the debit memo currency. |
lines[].listPrice |
decimal | no | The list price per unit as it stood on the source credit memo line, in the debit memo currency. |
lines[].listPriceTotal |
decimal | no | The pre-discount line total, in the debit memo currency. |
lines[].discountAmount |
decimal | no | The discount from the source credit memo line, in the debit memo currency. |
lines[].discountPercentage |
decimal | no | The discount as a percentage of the list price. A percentage, not an amount, so it has no currency. |
lines[].totalPrice |
decimal | no | The line total excluding tax, in the debit memo currency. |
lines[].amountDebited |
decimal | no | The amount debited for the line, in the debit memo currency. |
lines[].totalAmountDue |
decimal | no | The amount of the source credit memo line still available to debit, in the debit memo currency. |
lines[].taxAmount |
decimal | no | The tax on the line, in the debit memo currency. |
lines[].taxCode |
string | no | The tax code applied to the line. |
lines[].taxDate |
date | no | The date the line's tax was determined on. Format YYYY-MM-DD. |
lines[].taxMode |
string | no | How the line's prices are quoted for tax. Possible values: 'TaxInclusive', 'TaxExclusive'. |
lines[].taxExemptCode |
string | no | The customer-level tax-exempt code applied to the line. |
lines[].creditGlAccountId |
string | no | The line's credit general ledger account, the credit side of the journal entry. See id on GET accounting/accounts/:id. |
lines[].vatAccountingType |
string | no | The VAT type of the line. Absent unless a standalone line carries one. One of: "domesticStandardRate", "domesticReducedRate", "domesticSalesZeroRated", "domesticSalesExempt", "vatIntraEuStandardRate", "vatIntraEuReducedRate", "nonEuExempt", "reverseCharge". |
lines[].serviceStartDate |
date | no | The first day of the service period the line covers. Format YYYY-MM-DD. |
lines[].serviceEndDate |
date | no | The last day of the service period the line covers, inclusive. Format YYYY-MM-DD. |
lines[].externalIdentifiers |
array<object> | no | The line's identifiers in other systems, one per configured field name. An empty array or absent when the line has none. |
lines[].externalIdentifiers[].fieldName |
string | yes | The configured field name of the identifier, for example 'Maxio Invoice Key'. |
lines[].externalIdentifiers[].value |
string | yes | The identifier in the other system. |
lines[].externalIdentifiers[].externalUrl |
string | no | A link to the record in the other system. Absent when none is set. |
externalIdentifiers |
array<object> | no | The debit memo's identifiers in other systems, one per configured field name. An empty array or absent when the debit memo has none. |
externalIdentifiers[].fieldName |
string | yes | The configured field name of the identifier, for example 'Maxio Invoice Key'. |
externalIdentifiers[].value |
string | yes | The identifier in the other system. |
externalIdentifiers[].externalUrl |
string | no | A link to the record in the other system. Absent when none is set. |
{
"data": {
"id": "3b7d5e9c-1a24-4f80-9c6d-2e8f70b13a45",
"debitMemoNumber": "DM-1042",
"creditMemoId": "5a0f3e6d-81b7-4c8e-9b21-9c2a6a107d34",
"creditMemoNumber": "<creditMemoNumber>",
"debitMemoDate": "2026-08-01",
"dueDate": "2026-08-31",
"taxDate": "2026-01-15",
"approvalStatus": "approved",
"debitMemoStatus": "<debitMemoStatus>",
"debitMemoType": "orderEntryError",
"currency": "USD",
"customerId": "9c2a6a10-7d34-4c8e-9b21-5a0f3e6d81b7",
"customerName": "<customerName>",
"customerNumber": "<customerNumber>",
"entityId": "1a24d5e9-3b7d-4f80-9c6d-2e8f70b13a45",
"entityName": "<entityName>",
"paymentTerm": "net30",
"purchaseOrder": "<purchaseOrder>",
"customerMessage": "<customerMessage>",
"externalDebitMemoId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"isMigrated": true,
"debitGlAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"billToAddressId": "9f3e6d81-b7d0-4aec-8c3f-2e8f70b13a45",
"soldToAddressId": "b7d0aec3-9f3e-4d81-8c3f-6d81b7d0aec3",
"subtotal": "19.99",
"totalAmount": "500.00",
"totalTax": "19.99",
"totalAmountDebited": "19.99",
"lineDiscounts": "19.99",
"unappliedCreditAmount": "19.99",
"lastModifiedDate": "2026-08-01T09:12:44.000Z",
"lines": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"lineNumber": "<lineNumber>",
"description": "<description>",
"productId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"productLineId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"creditMemoLineId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"quantity": "19.99",
"unitOfMeasure": "<unitOfMeasure>",
"unitPrice": "19.99",
"adjustedUnitPrice": "19.99",
"listPrice": "19.99",
"listPriceTotal": "19.99",
"discountAmount": "19.99",
"discountPercentage": "19.99",
"totalPrice": "19.99",
"amountDebited": "19.99",
"totalAmountDue": "19.99",
"taxAmount": "19.99",
"taxCode": "<taxCode>",
"taxDate": "2026-01-15",
"taxMode": "<taxMode>",
"taxExemptCode": "<taxExemptCode>",
"creditGlAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"vatAccountingType": "domesticStandardRate",
"serviceStartDate": "2026-01-15",
"serviceEndDate": "2026-01-15",
"externalIdentifiers": [
{
"fieldName": "<fieldName>",
"value": "<value>",
"externalUrl": "<externalUrl>"
}
]
}
],
"externalIdentifiers": [
{
"fieldName": "<fieldName>",
"value": "<value>",
"externalUrl": "<externalUrl>"
}
]
},
"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 |
|---|---|
CREDIT_MEMO_NOT_FOUND |
400 |
CREDIT_MEMO_LINE_NOT_FOUND |
400 |
CUSTOMER_NOT_FOUND |
400 |
PAYMENT_TERM_NOT_FOUND |
400 |
ACCOUNTING_PERIOD_NOT_FOUND |
400 |
ACCOUNTING_PERIOD_CLOSED |
400 |
DUE_DATE_BEFORE_DEBIT_MEMO_DATE |
400 |
PRODUCT_NOT_FOUND |
400 |
PRODUCT_LINE_NOT_FOUND |
400 |
FIELD_NOT_ALLOWED |
400 |
ACCOUNT_NOT_FOUND |
400 |
ADDRESS_NOT_FOUND |
400 |
INVALID_AMOUNT |
400 |
INVALID_ENUM_VALUE |
400 |
NO_LINES |
400 |
MISSING_REQUIRED_FIELD |
400 |
UNKNOWN_EXTERNAL_IDENTIFIER |
400 |
IDEMPOTENCY_KEY_CONFLICT |
409 |
IDEMPOTENCY_PAYLOAD_MISMATCH |
422 |
Statuses
400— Invalid request or business failure. Codes: CREDIT_MEMO_NOT_FOUND, CREDIT_MEMO_LINE_NOT_FOUND, CUSTOMER_NOT_FOUND, PAYMENT_TERM_NOT_FOUND, ACCOUNTING_PERIOD_NOT_FOUND, ACCOUNTING_PERIOD_CLOSED, DUE_DATE_BEFORE_DEBIT_MEMO_DATE, PRODUCT_NOT_FOUND, PRODUCT_LINE_NOT_FOUND, FIELD_NOT_ALLOWED, ACCOUNT_NOT_FOUND, ADDRESS_NOT_FOUND, INVALID_AMOUNT, INVALID_ENUM_VALUE, NO_LINES, MISSING_REQUIRED_FIELD, UNKNOWN_EXTERNAL_IDENTIFIER401— 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