Update Purchase Credit Memo

Prev Next
Patch
/softera/softeraEInvoice/v2.0/companies({companyId})/purchaseCreditMemos({purchaseCreditMemoId})

Updates a purchase credit memo. Only draft (not posted) credit memos can be changed. The id cannot be changed.

Security
OAuth
FlowClient Credentials
Token URLhttps://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token
Scopes:
https://api.businesscentral.dynamics.com/.defaultGrants the permissions assigned to the Microsoft Entra ID application in Business Central
Header parameters
If-Match
stringRequired

ETag for concurrency (use * to force update)

Path parameters
companyId
string (uuid) Required

GUID for targeted Company

Example54c4066e-2b2b-4118-ac75-7dfea25be205
purchaseCreditMemoId
string (uuid) Required

SystemId (GUID) of the purchase credit memo

Example7c41e2a9-5d1b-f011-9346-002248a0b478
Body parameters
dimensions

Change shortcut dimensions

{
  "shortcutDimension1Code": "PIRK",
  "shortcutDimension2Code": "222"
}
Expand All
object

Writable purchase credit memo fields. On create, vendorNumber or vendorId must be provided. purchaseCreditMemoLines and dimensionSetLines can be included for a deep insert.

creditMemoDate
string (date)
Example2025-04-23
postingDate
string (date)
Example2025-04-23
dueDate
string (date)
Example2025-05-02
vendorId
string (uuid)
vendorNumber
string
Max length20
ExampleT00001
vendorCrMemoNumber
string
Max length35
ExampleATI240014605-1
payToVendorId
string (uuid)
payToVendorNumber
string
Max length20
ExampleT00001
buyFromAddressLine1
string
ExampleGedimino pr. 1
buyFromAddressLine2
string
Example
buyFromCity
string
Max length30
ExampleVilnius
buyFromCountry
string
Max length10
ExampleLT
buyFromState
string
Max length30
Example
buyFromPostCode
string
Max length20
ExampleLT-01103
payToAddressLine1
string
ExampleGedimino pr. 1
payToAddressLine2
string
Example
payToCity
string
Max length30
ExampleVilnius
payToCountry
string
Max length10
ExampleLT
payToState
string
Max length30
Example
payToPostCode
string
Max length20
ExampleLT-01103
postingDescription
string
ExampleKreditinė sąskaita ATI240014605-1
shortcutDimension1Code
string
ExamplePIRK
shortcutDimension2Code
string
Example222
currencyId
string (uuid)
currencyCode
string
ExampleEUR
paymentTermsId
string (uuid)
paymentMethodCode
string
ExampleBANK
shipmentMethodId
string (uuid)
purchaser
string
Max length20
ExamplePJ
discountAmount
number
Example0
apiTotalAmountExclVAT
number

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.

Example196
apiTotalAmountInclVAT
number

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.

Example237.16
locationCode
string
ExampleCENTRINIS
documentLink
string

URL stored as a record link on the document.

Examplehttps://example.com/creditmemos/ATI240014605-1.pdf
documentNote
string

Text stored as a record note on the document.

Example
invoiceId
string (uuid)

SystemId of the posted purchase invoice to apply the credit memo to. Send an empty GUID to clear.

invoiceNumber
string

Number of the posted purchase invoice to apply the credit memo to. Must match invoiceId if both are sent.

Max length20
ExamplePPI0000185
vendorReturnReasonId
string (uuid)

SystemId of the reason code.

userId
string

Assigned User ID (BC user name, not a GUID).

ExamplePAULIUS
dimensionSetLines
Array of object (dimensionSetLine)
object

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.

id
string (uuid)

SystemId of the dimension (not of the line)

code
string
ExamplePADALINYS
valueId
string (uuid)
valueCode
string
ExampleADM
purchaseCreditMemoLines
Array of object (purchaseCreditMemoLineRequest)
object

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.

documentId
string (uuid)
sequence
integer
Example10000
itemId
string (uuid)
accountId
string (uuid)
lineType
string
Valid values[ "Comment", "Account", "Item", "Resource", "Fixed_x0020_Asset", "Charge", "Allocation_x0020_Account" ]
ExampleItem
lineObjectNumber
string
Max length20
ExampleBENZINAS95
description
string
Max length100
ExampleBenzinas 95
unitOfMeasureId
string (uuid)
unitOfMeasureCode
string
Max length10
ExampleL
unitCost
number
Example0.98
quantity
number
Example200
discountAmount
number
Example0
discountPercent
number
Example0
taxCode
string
Max length50
ExampleA PREK21
depreciationBookCode
string
Example
salvageValue
number
Example0
expectedReceiptDate
string (date)
Example2025-04-23
itemVariantId
string (uuid)
locationId
string (uuid)
locationCode
string
Max length10
ExampleCENTRINIS
deferralCode
string
ExampleTIESIOG
shortcutDimension1Code
string
ExamplePIRK
shortcutDimension2Code
string
Example222
dimensionSetLines
Array of object (dimensionSetLine)
object

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.

id
string (uuid)

SystemId of the dimension (not of the line)

code
string
ExamplePADALINYS
valueId
string (uuid)
valueCode
string
ExampleADM
Responses
200

OK

Expand All
object
id
string (uuid)
number
string
Max length20
ExamplePCM0000021
creditMemoDate
string (date)
Example2025-04-23
postingDate
string (date)
Example2025-04-23
dueDate
string (date)
Example2025-05-02
vendorId
string (uuid)
vendorNumber
string

Buy-from vendor number. Either vendorId or vendorNumber is required on create.

Max length20
ExampleT00001
vendorName
string
Max length100
ExampleSoftera Baltic, UAB
vendorCrMemoNumber
string
Max length35
ExampleATI240014605-1
payToVendorId
string (uuid)
payToVendorNumber
string
Max length20
ExampleT00001
payToName
string
Max length100
ExampleSoftera Baltic, UAB
buyFromAddressLine1
string
ExampleGedimino pr. 1
buyFromAddressLine2
string
Example
buyFromCity
string
Max length30
ExampleVilnius
buyFromCountry
string
Max length10
ExampleLT
buyFromState
string
Max length30
Example
buyFromPostCode
string
Max length20
ExampleLT-01103
payToAddressLine1
string
ExampleGedimino pr. 1
payToAddressLine2
string
Example
payToCity
string
Max length30
ExampleVilnius
payToCountry
string
Max length10
ExampleLT
payToState
string
Max length30
Example
payToPostCode
string
Max length20
ExampleLT-01103
postingDescription
string
ExampleKreditinė sąskaita ATI240014605-1
shortcutDimension1Code
string
ExamplePIRK
shortcutDimension2Code
string
Example222
currencyId
string (uuid)
currencyCode
string
ExampleEUR
paymentTermsId
string (uuid)
paymentMethodCode
string
ExampleBANK
shipmentMethodId
string (uuid)
purchaser
string
Max length20
ExamplePJ
pricesIncludeTax
boolean
discountAmount
number
Example0
discountAppliedBeforeTax
boolean
totalAmountExcludingTax
number
Example196
totalTaxAmount
number
Example41.16
totalAmountIncludingTax
number
Example237.16
apiTotalAmountExclVAT
number

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.

Example196
apiTotalAmountInclVAT
number

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.

Example237.16
status
string
Valid values[ "Draft", "In_x0020_Review", "Open", "Canceled", "Corrective", "Paid" ]
ExampleDraft
posted
boolean
locationCode
string
ExampleCENTRINIS
documentLink
string

URL stored as a record link on the document.

Examplehttps://example.com/creditmemos/ATI240014605-1.pdf
documentNote
string

Text stored as a record note on the document.

Example
lastModifiedDateTime
string (date-time)
invoiceId
string (uuid)

SystemId of the posted purchase invoice the credit memo is applied to (Applies-to Doc. No.).

invoiceNumber
string

Number of the posted purchase invoice the credit memo is applied to (Applies-to Doc. No.).

Max length20
ExamplePPI0000185
vendorReturnReasonId
string (uuid)

SystemId of the reason code.

userId
string

Assigned User ID (BC user name, not a GUID).

ExamplePAULIUS
dimensionSetLines
Array of object (dimensionSetLine)
object

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.

id
string (uuid)

SystemId of the dimension (not of the line)

code
string
ExamplePADALINYS
consolidationCode
string
Example
parentId
string (uuid)
parentType
string
Valid values[ "_x0020_", "Journal_x0020_Line", "Sales_x0020_Order", "Sales_x0020_Order_x0020_Line", "Sales_x0020_Quote", "Sales_x0020_Quote_x0020_Line", "Sales_x0020_Credit_x0020_Memo", "Sales_x0020_Credit_x0020_Memo_x0020_Line", "Sales_x0020_Invoice", "Sales_x0020_Invoice_x0020_Line", "Purchase_x0020_Invoice", "Purchase_x0020_Invoice_x0020_Line", "General_x0020_Ledger_x0020_Entry", "Time_x0020_Registration_x0020_Entry", "Sales_x0020_Shipment", "Sales_x0020_Shipment_x0020_Line", "Purchase_x0020_Receipt", "Purchase_x0020_Receipt_x0020_Line", "Purchase_x0020_Order", "Purchase_x0020_Order_x0020_Line", "Purchase_x0020_Credit_x0020_Memo", "Purchase_x0020_Credit_x0020_Memo_x0020_Line" ]
ExampleSales_x0020_Invoice
displayName
string
ExamplePadalinys
valueId
string (uuid)
valueCode
string
ExampleADM
valueConsolidationCode
string
Example
valueDisplayName
string
ExampleAdministracija
purchaseCreditMemoLines
Array of object (purchaseCreditMemoLine)
object

The page has no ODataKeyFields, so a line is keyed by documentId + sequence (e.g. purchaseCreditMemoLines(documentId=...,sequence=10000)), not by id.

id
string (uuid)
documentId
string (uuid)
sequence
integer
Example10000
itemId
string (uuid)
accountId
string (uuid)
lineType
string
Valid values[ "Comment", "Account", "Item", "Resource", "Fixed_x0020_Asset", "Charge", "Allocation_x0020_Account" ]
ExampleItem
lineObjectNumber
string
Max length20
ExampleBENZINAS95
description
string
Max length100
ExampleBenzinas 95
unitOfMeasureId
string (uuid)
unitOfMeasureCode
string
Max length10
ExampleL
unitCost
number
Example0.98
quantity
number
Example200
discountAmount
number
Example0
discountPercent
number
Example0
discountAppliedBeforeTax
boolean
amountExcludingTax
number
Example196
taxCode
string
Max length50
ExampleA PREK21
taxPercent
number
Example21
totalTaxAmount
number
Example41.16
amountIncludingTax
number
Example237.16
invoiceDiscountAllocation
number
Example0
netAmount
number
Example196
netTaxAmount
number
Example41.16
netAmountIncludingTax
number
Example237.16
depreciationBookCode
string
Example
salvageValue
number
Example0
expectedReceiptDate
string (date)
Example2025-04-23
itemVariantId
string (uuid)
locationId
string (uuid)
locationCode
string
Max length10
ExampleCENTRINIS
deferralCode
string
ExampleTIESIOG
shortcutDimension1Code
string
ExamplePIRK
shortcutDimension2Code
string
Example222
dimensionSetLines
Array of object (dimensionSetLine)
object

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.

id
string (uuid)

SystemId of the dimension (not of the line)

code
string
ExamplePADALINYS
consolidationCode
string
Example
parentId
string (uuid)
parentType
string
Valid values[ "_x0020_", "Journal_x0020_Line", "Sales_x0020_Order", "Sales_x0020_Order_x0020_Line", "Sales_x0020_Quote", "Sales_x0020_Quote_x0020_Line", "Sales_x0020_Credit_x0020_Memo", "Sales_x0020_Credit_x0020_Memo_x0020_Line", "Sales_x0020_Invoice", "Sales_x0020_Invoice_x0020_Line", "Purchase_x0020_Invoice", "Purchase_x0020_Invoice_x0020_Line", "General_x0020_Ledger_x0020_Entry", "Time_x0020_Registration_x0020_Entry", "Sales_x0020_Shipment", "Sales_x0020_Shipment_x0020_Line", "Purchase_x0020_Receipt", "Purchase_x0020_Receipt_x0020_Line", "Purchase_x0020_Order", "Purchase_x0020_Order_x0020_Line", "Purchase_x0020_Credit_x0020_Memo", "Purchase_x0020_Credit_x0020_Memo_x0020_Line" ]
ExampleSales_x0020_Invoice
displayName
string
ExamplePadalinys
valueId
string (uuid)
valueCode
string
ExampleADM
valueConsolidationCode
string
Example
valueDisplayName
string
ExampleAdministracija
location
object (location)

Location (standard page "APIV2 - Locations").

id
string (uuid)
code
string
ExampleCENTRINIS
displayName
string
ExampleCentrinis sandėlis
contact
string
ExampleVardas Pavarde
addressLine1
string
ExampleSavanorių pr. 1
addressLine2
string
Example
city
string
ExampleVilnius
state
string
Example
country
string
ExampleLT
postalCode
string
ExampleLT-03116
phoneNumber
string
Example+370 5 2000000
email
string (email)
website
string
Example
lastModifiedDateTime
string (date-time)
pdfDocument
object (pdfDocument)

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.

id
string (uuid)
parentId
string (uuid)
parentType
string
Valid values[ "_x0020_", "Journal", "Sales_x0020_Order", "Sales_x0020_Quote", "Sales_x0020_Credit_x0020_Memo", "Sales_x0020_Invoice", "Purchase_x0020_Invoice", "Purchase_x0020_Order", "Employee", "Job", "Item", "Customer", "Vendor", "Purchase_x0020_Credit_x0020_Memo", "Customer_x0020_Statement" ]
ExampleSales_x0020_Invoice
pdfDocumentContent@odata.mediaReadLink
string (uri)
attachments
Array of object (attachment)
object

Incoming document attachment (standard page "APIV2 - Attachments"). Upload or download the file content via .../attachments({id})/attachmentContent.

id
string (uuid)
parentId
string (uuid)
fileName
string
ExampleTest.pdf
byteSize
integer
Example0
attachmentContent@odata.mediaEditLink
string (uri)
attachmentContent@odata.mediaReadLink
string (uri)
lastModifiedDateTime
string (date-time)
parentType
string
Valid values[ "_x0020_", "Journal", "Sales_x0020_Order", "Sales_x0020_Quote", "Sales_x0020_Credit_x0020_Memo", "Sales_x0020_Invoice", "Purchase_x0020_Invoice", "Purchase_x0020_Order", "Employee", "Job", "Item", "Customer", "Vendor", "Purchase_x0020_Credit_x0020_Memo", "Customer_x0020_Statement" ]
ExampleSales_x0020_Invoice
documentAttachments
Array of object (documentAttachment)
object

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.

id
string (uuid)
fileName
string
ExampleTest.pdf
byteSize
integer
Example0
attachmentContent@odata.mediaEditLink
string (uri)
attachmentContent@odata.mediaReadLink
string (uri)
parentType
string
Valid values[ "_x0020_", "Journal", "Sales_x0020_Order", "Sales_x0020_Quote", "Sales_x0020_Credit_x0020_Memo", "Sales_x0020_Invoice", "Purchase_x0020_Invoice", "Purchase_x0020_Order", "Employee", "Job", "Item", "Customer", "Vendor", "Purchase_x0020_Credit_x0020_Memo", "Customer_x0020_Statement" ]
ExampleSales_x0020_Invoice
parentId
string (uuid)
lineNumber
integer
Example0
documentFlowSales
boolean
documentFlowPurchase
boolean
lastModifiedDateTime
string (date-time)
400

Bad Request

Expand All
object
error
object
code
string
ExampleBadRequest
message
string
ExampleThe field Customer No. of table Sales Header contains a value (P9999999) that cannot be found in the related table (Customer). CorrelationId: fc7b9039-73d9-48d2-a9d3-9a8e0f8b91da.
401

Unauthorized

Headers
WWW-Authenticate
string
Expand All
object
error
object
code
string
Default"Unauthorized"
message
string
Default"The credentials provided are incorrect"
404

Not Found

Expand All
object
error
object
code
string
ExampleBadRequest_ResourceNotFound
message
string
ExampleResource not found for the segment 'dimensionValues'. CorrelationId: fc7b9039-73d9-48d2-a9d3-9a8e0f8b91da.