Creates a draft purchase credit memo. vendorNumber or vendorId is required.
You can include purchaseCreditMemoLines in the body.
Use $expand=purchaseCreditMemoLines to have the created lines included in the response.
To apply the credit memo to a posted purchase invoice, send invoiceId and/or invoiceNumber.
Available from Business Central version 22.2 and higher.
Send apiTotalAmountExclVAT and apiTotalAmountInclVAT with the totals calculated in your system. When Check VAT Mismatch in API Request
is enabled in E-Invoice Setup, the amount excluding VAT must match the amount calculated by Business Central (error "Amounts excl. VAT doesn't match.").
A VAT difference is corrected automatically only when Allow VAT Auto Correction is enabled and the difference does not exceed
Max. VAT Difference Allowed in General Ledger Setup; otherwise the request fails with "VAT amount mismatched by %1, which exceeds the maximum allowed.".
When the document is posted, both totals must match the document amounts, otherwise posting fails with "... must match.".
Documents created via the API are marked "Created via API" and cannot be edited by users unless Allow API Documents Edit is enabled.
GUID for targeted Company
OData $expand for purchase credit memos. Supported navigations:
dimensionSetLines, purchaseCreditMemoLines, pdfDocument, attachments, documentAttachments.
Line navigations can be nested, e.g. purchaseCreditMemoLines($expand=dimensionSetLines,location).
Header-only credit memo
{
"creditMemoDate": "2025-04-23",
"postingDate": "2025-04-23",
"dueDate": "2025-05-02",
"vendorNumber": "T00001",
"vendorCrMemoNumber": "ATI240014605-1",
"payToVendorNumber": "T00001",
"currencyCode": "EUR",
"invoiceNumber": "PPI0000185"
}Credit memo with lines (+$expand)
{
"creditMemoDate": "2025-04-23",
"postingDate": "2025-04-23",
"dueDate": "2025-05-02",
"vendorNumber": "T00001",
"vendorCrMemoNumber": "ATI240014605-1",
"payToVendorNumber": "T00001",
"currencyCode": "EUR",
"invoiceId": "bf415382-2a04-ee11-8f6e-000d3ab3a59d",
"invoiceNumber": "PPI0000185",
"purchaseCreditMemoLines": [
{
"lineType": "Comment",
"lineObjectNumber": "",
"description": "SF nr. PPI0000018",
"unitCost": 0,
"quantity": 0
},
{
"itemId": "54fb56ba-613a-ed11-97e8-000d3ab8d9cc",
"lineType": "Item",
"lineObjectNumber": "BENZINAS95",
"description": "Benzinas 95",
"unitOfMeasureCode": "L",
"unitCost": 0.98,
"quantity": 200,
"taxCode": "A PREK21",
"expectedReceiptDate": "2020-10-23",
"locationCode": "CENTRINIS"
}
]
}Writable purchase credit memo fields. On create, vendorNumber or vendorId must be provided.
purchaseCreditMemoLines and dimensionSetLines can be included for a deep insert.
Total excluding VAT as calculated by the external system. Compared with the amount calculated by Business Central when Check VAT Mismatch in API Request is enabled.
Total including VAT as calculated by the external system. Used for the VAT mismatch check and, when Allow VAT Auto Correction is enabled, to correct VAT differences within Max. VAT Difference Allowed.
URL stored as a record link on the document.
Text stored as a record note on the document.
SystemId of the posted purchase invoice to apply the credit memo to. Send an empty GUID to clear.
Number of the posted purchase invoice to apply the credit memo to. Must match invoiceId if both are sent.
SystemId of the reason code.
Assigned User ID (BC user name, not a GUID).
Dimension set line (standard page "APIV2 - Dimension Set Lines").
If the customer, vendor, G/L account or item has default dimensions, overriding them on a document line needs additional PATCH requests;
without default dimensions, send the dimensions with the line in the same request.
For documents with hundreds of lines, post dimensions in a separate $batch request.
SystemId of the dimension (not of the line)
Writable purchase credit memo line fields. documentId is filled automatically when the line is created
under a purchase credit memo. documentId, sequence and lineObjectNumber cannot be changed once set.
Dimension set line (standard page "APIV2 - Dimension Set Lines").
If the customer, vendor, G/L account or item has default dimensions, overriding them on a document line needs additional PATCH requests;
without default dimensions, send the dimensions with the line in the same request.
For documents with hundreds of lines, post dimensions in a separate $batch request.
SystemId of the dimension (not of the line)
Created
Buy-from vendor number. Either vendorId or vendorNumber is required on create.
Total excluding VAT as calculated by the external system. Compared with the amount calculated by Business Central when Check VAT Mismatch in API Request is enabled.
Total including VAT as calculated by the external system. Used for the VAT mismatch check and, when Allow VAT Auto Correction is enabled, to correct VAT differences within Max. VAT Difference Allowed.
URL stored as a record link on the document.
Text stored as a record note on the document.
SystemId of the posted purchase invoice the credit memo is applied to (Applies-to Doc. No.).
Number of the posted purchase invoice the credit memo is applied to (Applies-to Doc. No.).
SystemId of the reason code.
Assigned User ID (BC user name, not a GUID).
Dimension set line (standard page "APIV2 - Dimension Set Lines").
If the customer, vendor, G/L account or item has default dimensions, overriding them on a document line needs additional PATCH requests;
without default dimensions, send the dimensions with the line in the same request.
For documents with hundreds of lines, post dimensions in a separate $batch request.
SystemId of the dimension (not of the line)
The page has no ODataKeyFields, so a line is keyed by documentId + sequence
(e.g. purchaseCreditMemoLines(documentId=...,sequence=10000)), not by id.
Dimension set line (standard page "APIV2 - Dimension Set Lines").
If the customer, vendor, G/L account or item has default dimensions, overriding them on a document line needs additional PATCH requests;
without default dimensions, send the dimensions with the line in the same request.
For documents with hundreds of lines, post dimensions in a separate $batch request.
SystemId of the dimension (not of the line)
Location (standard page "APIV2 - Locations").
PDF of the document (standard page "APIV2 - PDF Document", read-only).
Download the file with GET .../pdfDocument/pdfDocumentContent.
The report and layout come from Report Selections for the document type; if more than one report is set up, the first in sequence is used.
Incoming document attachment (standard page "APIV2 - Attachments").
Upload or download the file content via .../attachments({id})/attachmentContent.
Document attachment (standard page "APIV2 - Document Attachments").
Upload or download the file content via .../documentAttachments({id})/attachmentContent.
When the attachment is created together with the document (e.g. a signed sales contract), the file content is sent in a separate PATCH request.
Bad Request
Unauthorized