purchaseInvoice resource type

Represents a purchase invoice in Business Central.

Note

For information about enabling APIs for Business Central see Enabling the APIs for Dynamics 365 Business Central.

Methods

MethodReturn TypeDescription
GET purchaseInvoicepurchaseInvoiceGets a purchase invoice object.
DELETE purchaseInvoicenoneDeletes a purchase invoice object.
POST purchaseInvoicepurchaseInvoiceCreates a purchase invoice object.
PATCH purchaseInvoicepurchaseInvoiceUpdates a purchase invoice object.

Bound actions

The purchaseInvoice resource type offers a bound action called post, which posts the corresponding purchaseInvoice batch. This is illustrated in the following example: POST https://<server address>:<server API port>/<server instance name>/api/v2.0/companies({id})/purchaseInvoices({id})/Microsoft.NAV.post

The response has no content; the response code is 204.

NavigationReturn TypeDescription
vendorvendorGets the vendor of the purchaseInvoice.
dimensionValuedimensionValueGets the dimensionvalue of the purchaseInvoice.
currencycurrencyGets the currency of the purchaseInvoice.
dimensionSetLinesdimensionSetLinesGets the dimensionsetlines of the purchaseInvoice.
purchaseInvoiceLinespurchaseInvoiceLinesGets the purchaseinvoicelines of the purchaseInvoice.
pdfDocumentpdfDocumentGets the pdfdocument of the purchaseInvoice.
attachmentsattachmentsGets the attachments of the purchaseInvoice.
documentAttachmentsdocumentAttachmentsGets the documentattachments of the purchaseInvoice.

Properties

PropertyTypeDescription
idGUIDThe unique ID of the purchase invoice. Non-editable.
numberstringSpecifies the number of the purchase invoice.
postingDatedateThe date that the purchase invoice is posted.
invoiceDatedateThe invoice date .
dueDatedateT he date the purchase invoice is due.
vendorInvoiceNumberstringThe vendor sales order reference for the purchase invoice.
vendorIdGUIDThe unique ID of vendor.
vendorNumberstringSpecifies vendor's number.
vendorNamestringSpecifies vendor's name.
payToNamestringPay to name of the purchase invoice.
payToContactstringPay to contact.
payToVendorIdGUIDPay to vendor id.
payToVendorNumberstringPay to vendor number.
shipToNamestringShip to name.
shipToContactstringShip to contact.
buyFromAddressLine1stringBuy from address line 1.
buyFromAddressLine2stringBuy from address line 2.
buyFromCitystringBuy from city.
buyFromCountrystringBuy from state.
buyFromStatestringBuy from state.
buyFromPostCodestringBuy from country.
shipToAddressLine1stringShip to address line 1.
shipToAddressLine2stringShip to address line 2.
shipToCitystringShip to city.
shipToCountrystringShip to country.
shipToStatestringShip to state.
shipToPostCodestringShip to post code.
payToAddressLine1stringPay to address line 1.
payToAddressLine2stringPay to address line 2.
payToCitystringPay to address line 2.
payToCountrystringPay to country.
payToStatestringPay to state.
payToPostCodestringPay to post code.
shortcutDimension1Codestring
shortcutDimension2Codestring
currencyIdGUIDSpecifies which currency the purchase invoice uses.
currencyCodestringThe default currency code for the purchase invoice.
orderIdGUIDThe id of the order to which the purchase invoice is associated to. Read-Only.
orderNumberstringThe number of the order to which the purchase invoice is associated to. Read-Only.
purchaserstringThe purchaser in the purchase invoice.
pricesIncludeTaxbooleanSpecifies whether the prices include Tax or not. Read-Only.
discountAmountdecimalThe purchase invoice discount amount.
discountAppliedBeforeTaxbooleanSpecifies whether the discount is applied before tax.
totalAmountExcludingTaxdecimalThe total amount excluding tax. Read-Only.
totalTaxAmountdecimalThe total tax amount for the purchase invoice. Read-Only.
totalAmountIncludingTaxdecimalThe total amount including tax. Read-Only.
statusNAV.invoiceEntityAggregateStatusThe status of the purchase invoice. It can be " ", "Draft", "In Review", "Open", "Paid", "Canceled" or "Corrective".
lastModifiedDateTimedatetimeThe last datetime the purchase invoice was modified. Read-Only.

JSON representation

Here's a JSON representation of the purchaseInvoice resource.

{
    "id": "GUID",
    "number": "string",
    "postingDate": "date",
    "invoiceDate": "date",
    "dueDate": "date",
    "vendorInvoiceNumber": "string",
    "vendorId": "GUID",
    "vendorNumber": "string",
    "vendorName": "string",
    "payToName": "string",
    "payToContact": "string",
    "payToVendorId": "GUID",
    "payToVendorNumber": "string",
    "shipToName": "string",
    "shipToContact": "string",
    "buyFromAddressLine1": "string",
    "buyFromAddressLine2": "string",
    "buyFromCity": "string",
    "buyFromCountry": "string",
    "buyFromState": "string",
    "buyFromPostCode": "string",
    "shipToAddressLine1": "string",
    "shipToAddressLine2": "string",
    "shipToCity": "string",
    "shipToCountry": "string",
    "shipToState": "string",
    "shipToPostCode": "string",
    "payToAddressLine1": "string",
    "payToAddressLine2": "string",
    "payToCity": "string",
    "payToCountry": "string",
    "payToState": "string",
    "payToPostCode": "string",
    "shortcutDimension1Code": "string",
    "shortcutDimension2Code": "string",
    "currencyId": "GUID",
    "currencyCode": "string",
    "orderId": "GUID",
    "orderNumber": "string",
    "purchaser": "string",
    "pricesIncludeTax": "boolean",
    "discountAmount": "decimal",
    "discountAppliedBeforeTax": "boolean",
    "totalAmountExcludingTax": "decimal",
    "totalTaxAmount": "decimal",
    "totalAmountIncludingTax": "decimal",
    "status": "NAV.invoiceEntityAggregateStatus",
    "lastModifiedDateTime": "datetime"
}

Note


The id property value in this API resource might be different than the systemId of the corresponding record because the systemId of the unposted invoices are carried to posted invoices in the API, but not to the record. Use the https://{businesscentralPrefix}/microsoft/automate/v1.0/companies({id})/postedPurchaseInvoices({systemId}) route and extract the apiId property to map the systemId of a posted purchase invoice record to the purchaseInvoice API resource.

GET purchaseInvoice
DELETE purchaseInvoice
POST purchaseInvoice
PATCH purchaseInvoice