> ## Documentation Index > Fetch the complete documentation index at: https://instrukcijos.softera.lt/llms.txt > Use this file to discover all available pages before exploring further. # Update Purchase Invoice > Updates a purchase invoice. Only draft (not posted) invoices can be changed. The `id` cannot be changed. ## OpenAPI ````json PATCH /softera/softeraEInvoice/v2.0/companies({companyId})/purchaseInvoices({purchaseInvoiceId}) { "openapi": "3.1.2", "info": { "title": "Softera.E-Invoice", "version": "14.2", "description": "API specification for Softera.E-Invoice, the Business Central extension that exposes master data and\ndocuments through custom REST APIs (API group `softera/softeraEInvoice`, version `v2.0`).\nFor the standard Business Central APIs see [API v2.0 overview](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/).\n\n## Request structure\n\n`https://api.businesscentral.dynamics.com/v2.0/{tenantId}/{environment}/api/softera/softeraEInvoice/v2.0/companies({companyId})/{endpoint}`\n\n| Part | Value |\n| --- | --- |\n| `{tenantId}` | Tenant ID |\n| `{environment}` | Name of the environment |\n| `softera/softeraEInvoice` | E-Invoice API group name |\n| `v2.0` | API version |\n| `companies({companyId})` | Id of the company, retrieved from the Companies endpoint |\n| `{endpoint}` | Endpoint name |\n\n| Header | Value |\n| --- | --- |\n| Authorization | `Bearer {token}`. Required. |\n| Content-Type | `application/json` |\n| If-Match | Required for PATCH and DELETE. When the eTag provided does not match the current tag on the record, the record is not updated. Use `*` to skip the check. |\n\nAuthentication uses OAuth 2.0 client credentials with a Microsoft Entra application that is registered in\nBusiness Central (Microsoft Entra Applications) with the required permission sets. See\n[Azure App registration](https://instrukcijos.softera.lt/docs/azure-app-registration).\n\n## Performance recommendations\n\n- Use `$expand` to create a master record together with related data (e.g. a customer with `defaultDimensions`,\n or a sales invoice with its lines) in a single request.\n- Use `$batch` when creating or updating many records at once (e.g. journal lines). Business Central allows up to\n 100 operations per `$batch` request. Each operation is evaluated on its own: a failure in one operation does not\n roll back the others, so check the status of every operation in the batch response.\n- For documents with hundreds of lines, post dimensions in a separate `$batch` request instead of expanding\n both lines and `dimensionSetLines` in one request.\n- See [Operational limits for Business Central online](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/operational-limits-online).\n\n## Enum values\n\nFields based on an AL **Enum** are returned with OData name encoding: spaces and special characters are replaced\nby their `_xHHHH_` code, e.g. `Sales Invoice` is returned as `Sales_x0020_Invoice`, `G/L Account` as\n`G_x002F_L_x0020_Account` and a blank value as `_x0020_`. Fields based on an AL **Option** (e.g. job queue entry\n`status`, VAT posting setup `unrealizedVATType`) are returned as plain text, e.g. `On Hold`.\nThe schemas list the values exactly as they are returned; use the same values in request bodies.\n\n## E-Invoice Setup\n\nThe **E-Invoice Setup** page affects customers, vendors, sales and purchase documents:\n\n- **Check VAT Mismatch in API Request (Sales / Purchase)**: enables the check of the API totals\n (`apiTotalAmountExclVAT`, `apiTotalAmountInclVAT`) against the amounts calculated by Business Central. The check runs twice:\n - when the document is read through the API (the response to a create or update, and GET): the amount\n excluding VAT must match, and a VAT difference is corrected only when **Allow VAT Auto Correction** is\n enabled and the difference does not exceed **Max. VAT Difference Allowed** (General Ledger Setup);\n - when the document is posted: both totals must match the document amounts, otherwise posting fails.\n- **Allow API Documents Edit**: documents created via the API are marked \"Created via API\" and cannot be\n edited by users unless this is enabled.\n- **Check Duplicates by Reg. No.** / **Check Duplicates by Name**: customer and vendor creation is rejected\n when a record with the same registration number or name exists.\n- **Assign Default Template** and the Local / EU / Foreign templates: a customer or vendor template is\n assigned automatically by country.\n\nSee [API Setup](https://instrukcijos.softera.lt/docs/api-setup) and [API Process](https://instrukcijos.softera.lt/docs/api-process).\n\n## Common errors\n\n| Error | Description |\n| --- | --- |\n| Amounts excl. VAT doesn't match. | `apiTotalAmountExclVAT` and the amount calculated by Business Central do not match, usually because unit prices differ between systems. |\n| VAT amount mismatched by %1, which exceeds the maximum allowed. | VAT amounts do not match and the difference exceeds **Max. VAT Difference Allowed** in **General Ledger Setup**, or **Allow VAT Auto Correction** is disabled. |\n| Amount 100 and API Total Amount Excl. VAT (ESF) 99 must match. | Raised when the document is posted: the document amount (or amount including VAT) differs from the API total sent in the request. |\n| Sorry, the current permissions prevented the action. | The permission for the object and action is not assigned to the Microsoft Entra application or the user. |\n| No HTTP resource was found that matches the request URI. | The E-Invoice app is not installed, or the API group in the URL is incorrect. |\n| Invalid body. | The request body contains extra symbols, or a field name is incorrect or does not exist. |\n\nA Postman collection with request examples is available on the\n[API overview](https://instrukcijos.softera.lt/docs/api-overview) page.\n", "license": { "name": "Softera", "url": "https://www.softera.lt/en/license-agreement/" } }, "servers": [ { "url": "https://api.businesscentral.dynamics.com/v2.0/{tenantId}/{environment}/api", "description": "URL for Business Central cloud", "variables": { "tenantId": { "default": "tenantId", "description": "Business Central tenant Id" }, "environment": { "default": "environment", "description": "Business Central environment name" } } }, { "url": "https://{baseURL}:{port}/{serverInstance}/api", "description": "URL for Business Central On-Prem", "variables": { "baseURL": { "default": "baseURL", "description": "Base URL for Business Central server" }, "port": { "default": "7048", "description": "Port To access Business Central on the server" }, "serverInstance": { "default": "serverInstance", "description": "Server instance name of Business Central" } } } ], "security": [ { "OAuth2": [ "https://api.businesscentral.dynamics.com/.default" ] } ], "tags": [ { "name": "Entities", "description": "Lists of available standard and E-Invoice API entities." }, { "name": "Metadata", "description": "OData metadata of the E-Invoice API." }, { "name": "Companies", "description": "Companies in the Business Central environment. Use the company `id` in all E-Invoice requests." }, { "name": "Customers", "description": "Create and manage customer records. See also [Customers guide](https://instrukcijos.softera.lt/docs/api-customer)." }, { "name": "Vendors", "description": "Create and manage vendor records. See also [Vendors guide](https://instrukcijos.softera.lt/docs/api-vendor)." }, { "name": "Vendor Bank Accounts", "description": "Bank accounts linked to a vendor. See also [Vendor Bank Accounts guide](https://instrukcijos.softera.lt/docs/api-vendorbankaccount)." }, { "name": "Salespeople/Purchasers", "description": "Salespeople and purchasers. See also [Salespeople/Purchasers guide](https://instrukcijos.softera.lt/docs/api-salespersonpurchaser)." }, { "name": "Items", "description": "Item (product) master records. See also [Items guide](https://instrukcijos.softera.lt/docs/api-item)." }, { "name": "Dimensions", "description": "Dimension codes used for analysis (e.g. department, project). See also [Dimensions guide](https://instrukcijos.softera.lt/docs/api-dimension)." }, { "name": "Dimension Values", "description": "Values available for a given dimension. See also [Dimension Values guide](https://instrukcijos.softera.lt/docs/api-dimensionvalue)." }, { "name": "VAT Posting Setups", "description": "VAT posting group combinations used for tax calculation. See also [VAT Posting Setups guide](https://instrukcijos.softera.lt/docs/api-vatpostingsetup)." }, { "name": "Deferral Templates", "description": "Deferral templates used to spread revenue/expense recognition over periods. See also [Deferral Templates guide](https://instrukcijos.softera.lt/docs/api-deferraltemplate)." }, { "name": "Sales Orders", "description": "Create and manage sales orders. See also [Sales Orders guide](https://instrukcijos.softera.lt/docs/api-salesorder)." }, { "name": "Sales Order Lines", "description": "Lines of a sales order. See also [Sales Order Lines guide](https://instrukcijos.softera.lt/docs/api-salesorderline)." }, { "name": "Sales Invoices", "description": "Create and manage sales invoices. See also [Sales Invoices guide](https://instrukcijos.softera.lt/docs/api-salesinvoice)." }, { "name": "Sales Invoice Lines", "description": "Lines of a sales invoice. See also [Sales Invoice Lines guide](https://instrukcijos.softera.lt/docs/api-salesinvoiceline)." }, { "name": "Sales Credit Memos", "description": "Create and manage sales credit memos. See also [Sales Credit Memos guide](https://instrukcijos.softera.lt/docs/api-salescreditmemo)." }, { "name": "Sales Credit Memo Lines", "description": "Lines of a sales credit memo. See also [Sales Credit Memo Lines guide](https://instrukcijos.softera.lt/docs/api-salescreditmemoline)." }, { "name": "Purchase Invoices", "description": "Create and manage purchase invoices. See also [Purchase Invoices guide](https://instrukcijos.softera.lt/docs/api-purchaseinvoice)." }, { "name": "Purchase Invoice Lines", "description": "Lines of a purchase invoice. See also [Purchase Invoice Lines guide](https://instrukcijos.softera.lt/docs/api-purchaseinvoiceline)." }, { "name": "Purchase Credit Memos", "description": "Create and manage purchase credit memos. Available from Business Central 22.2. See also [Purchase Credit Memos guide](https://instrukcijos.softera.lt/docs/api-purchasecreditmemo)." }, { "name": "Purchase Credit Memo Lines", "description": "Lines of a purchase credit memo. Available from Business Central 22.2. See also [Purchase Credit Memo Lines guide](https://instrukcijos.softera.lt/docs/api-purchasecreditmemoline)." }, { "name": "Journals", "description": "General journal batches. See also [Journals guide](https://instrukcijos.softera.lt/docs/journals)." }, { "name": "Journal Lines", "description": "Lines of a general journal. Use `$batch` for bulk import. See also [Journal Lines guide](https://instrukcijos.softera.lt/docs/journallines)." }, { "name": "Fixed Assets", "description": "Fixed asset master records. See also [Fixed Assets guide](https://instrukcijos.softera.lt/docs/api-fixedassets)." }, { "name": "FA Depreciation Books", "description": "Depreciation books of a fixed asset. See also [FA Depreciation Books guide](https://instrukcijos.softera.lt/docs/api-fixedassets)." }, { "name": "Transfer Orders", "description": "Transfer stock between locations. See also [Transfer Orders guide](https://instrukcijos.softera.lt/docs/api-transferorder)." }, { "name": "Transfer Order Lines", "description": "Lines of a transfer order. See also [Transfer Order Lines guide](https://instrukcijos.softera.lt/docs/api-transferorderline)." }, { "name": "Item Tracking Lines", "description": "Serial/lot tracking information for transfer order lines. See also [Item Tracking Lines guide](https://instrukcijos.softera.lt/docs/api-itemtrackingline)." }, { "name": "Customer Ledger Entries", "description": "Posted customer ledger entries. See also [Customer Ledger Entries guide](https://instrukcijos.softera.lt/docs/api-customerledgerentries)." }, { "name": "Applied Customer Entries (deprecated)", "description": "Application records between customer entries. Deprecated, no longer maintained. See also [Applied Customer Entries (deprecated) guide](https://instrukcijos.softera.lt/docs/api-appliedcustomerentries)." }, { "name": "User Setups", "description": "User-specific setup and permissions. See also [User Setups guide](https://instrukcijos.softera.lt/docs/api-usersetup)." }, { "name": "Job Queue Entries", "description": "Scheduled background job entries. See also [Job Queue Entries guide](https://instrukcijos.softera.lt/docs/api-jobqueueentry)." } ], "paths": { "/softera/softeraEInvoice/v2.0/companies({companyId})/purchaseInvoices({purchaseInvoiceId})": { "summary": "Purchase Invoice", "parameters": [ { "$ref": "#/components/parameters/companyId" }, { "$ref": "#/components/parameters/purchaseInvoiceId" } ], "patch": { "operationId": "updatePurchaseInvoice", "tags": [ "Purchase Invoices" ], "summary": "Update Purchase Invoice", "description": "Updates a purchase invoice. Only draft (not posted) invoices can be changed. The `id` cannot be changed.\n", "parameters": [ { "$ref": "#/components/parameters/ifMatch" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/purchaseInvoiceRequest" }, "examples": { "dueDate": { "summary": "Change due date", "value": { "dueDate": "2025-04-01" } }, "dimensions": { "summary": "Change shortcut dimensions", "value": { "shortcutDimension1Code": "PIRK", "shortcutDimension2Code": "333" } } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/purchaseInvoice" } } } }, "400": { "$ref": "#/components/responses/400" }, "401": { "$ref": "#/components/responses/401" }, "404": { "$ref": "#/components/responses/404" } } } } }, "components": { "parameters": { "companyId": { "name": "companyId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "GUID for targeted Company", "example": "54c4066e-2b2b-4118-ac75-7dfea25be205" }, "purchaseInvoiceId": { "name": "purchaseInvoiceId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "SystemId (GUID) of the purchase invoice", "example": "1ef44eac-0700-4693-89c3-99e20ca6cb13" }, "ifMatch": { "name": "If-Match", "in": "header", "required": true, "description": "ETag for concurrency (use `*` to force update)", "schema": { "type": "string", "example": "*" } } }, "schemas": { "purchaseInvoiceRequest": { "title": "Purchase Invoice Request", "type": "object", "description": "Writable purchase invoice fields. On create, `vendorNumber` or `vendorId` must be provided.\n`purchaseInvoiceLines` and `dimensionSetLines` can be included for a deep insert.\n", "properties": { "invoiceDate": { "type": "string", "format": "date", "example": "2025-04-02" }, "postingDate": { "type": "string", "format": "date", "example": "2025-04-02" }, "dueDate": { "type": "string", "format": "date", "example": "2025-04-12" }, "vendorInvoiceNumber": { "type": "string", "maxLength": 35, "example": "KP50055" }, "vendorOrderNumber": { "type": "string", "maxLength": 35, "example": "PO12345" }, "postingDescription": { "type": "string", "example": "Pirkimo sąskaita faktūra KP50055" }, "vendorId": { "type": "string", "format": "uuid" }, "vendorNumber": { "type": "string", "maxLength": 20, "example": "T00001" }, "payToVendorId": { "type": "string", "format": "uuid" }, "payToVendorNumber": { "type": "string", "maxLength": 20, "example": "T00001" }, "shipToName": { "type": "string", "maxLength": 100, "example": "Elgerta Polska" }, "shipToContact": { "type": "string", "maxLength": 100, "example": "" }, "buyFromAddressLine1": { "type": "string", "example": "Gedimino pr. 1" }, "buyFromAddressLine2": { "type": "string", "example": "" }, "buyFromCity": { "type": "string", "maxLength": 30, "example": "Vilnius" }, "buyFromCountry": { "type": "string", "maxLength": 10, "example": "LT" }, "buyFromState": { "type": "string", "maxLength": 30, "example": "" }, "buyFromPostCode": { "type": "string", "maxLength": 20, "example": "LT-01103" }, "shipToAddressLine1": { "type": "string", "example": "Warsawa ul 154" }, "shipToAddressLine2": { "type": "string", "example": "" }, "shipToCity": { "type": "string", "maxLength": 30, "example": "Warsawa" }, "shipToCountry": { "type": "string", "maxLength": 10, "example": "PL" }, "shipToState": { "type": "string", "maxLength": 30, "example": "" }, "shipToPostCode": { "type": "string", "maxLength": 20, "example": "" }, "shortcutDimension1Code": { "type": "string", "example": "PIRK" }, "shortcutDimension2Code": { "type": "string", "example": "333" }, "currencyId": { "type": "string", "format": "uuid" }, "currencyCode": { "type": "string", "example": "EUR" }, "paymentMethodCode": { "type": "string", "example": "BANK" }, "pricesIncludeTax": { "type": "boolean", "example": false }, "userId": { "type": "string", "example": "PAULIUS", "description": "Assigned User ID (BC user name, not a GUID)." }, "purchaseInvoiceLines": { "type": "array", "items": { "$ref": "#/components/schemas/purchaseInvoiceLineRequest" } }, "dimensionSetLines": { "type": "array", "items": { "$ref": "#/components/schemas/dimensionSetLine" } }, "discountAmount": { "type": "number", "example": 0 }, "discountAppliedBeforeTax": { "type": "boolean", "example": true }, "totalAmountIncludingTax": { "type": "number", "example": 605 }, "apiTotalAmountExclVAT": { "type": "number", "example": 500, "description": "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." }, "apiTotalAmountInclVAT": { "type": "number", "example": 605, "description": "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." }, "locationCode": { "type": "string", "example": "CENTRINIS" }, "documentLink": { "type": "string", "example": "https://example.com/invoices/KP50055.pdf", "description": "URL stored as a record link on the document." }, "documentNote": { "type": "string", "example": "", "description": "Text stored as a record note on the document." } } }, "purchaseInvoice": { "title": "Purchase Invoice", "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "title": "SystemId", "readOnly": true }, "number": { "type": "string", "maxLength": 20, "readOnly": true, "example": "PIN00000134" }, "invoiceDate": { "type": "string", "format": "date", "example": "2025-04-02" }, "postingDate": { "type": "string", "format": "date", "example": "2025-04-02" }, "dueDate": { "type": "string", "format": "date", "example": "2025-04-12" }, "vendorInvoiceNumber": { "type": "string", "maxLength": 35, "example": "KP50055" }, "vendorOrderNumber": { "type": "string", "maxLength": 35, "example": "PO12345" }, "postingDescription": { "type": "string", "example": "Pirkimo sąskaita faktūra KP50055" }, "vendorId": { "type": "string", "format": "uuid" }, "vendorNumber": { "type": "string", "maxLength": 20, "example": "T00001", "description": "Buy-from vendor number. Either vendorId or vendorNumber is required on create." }, "vendorName": { "type": "string", "maxLength": 100, "readOnly": true, "example": "Softera Baltic, UAB" }, "payToName": { "type": "string", "maxLength": 100, "readOnly": true, "example": "Softera Baltic, UAB" }, "payToContact": { "type": "string", "maxLength": 100, "readOnly": true, "example": "" }, "payToVendorId": { "type": "string", "format": "uuid" }, "payToVendorNumber": { "type": "string", "maxLength": 20, "example": "T00001" }, "shipToName": { "type": "string", "maxLength": 100, "example": "Elgerta Polska" }, "shipToContact": { "type": "string", "maxLength": 100, "example": "" }, "buyFromAddressLine1": { "type": "string", "example": "Gedimino pr. 1" }, "buyFromAddressLine2": { "type": "string", "example": "" }, "buyFromCity": { "type": "string", "maxLength": 30, "example": "Vilnius" }, "buyFromCountry": { "type": "string", "maxLength": 10, "example": "LT" }, "buyFromState": { "type": "string", "maxLength": 30, "example": "" }, "buyFromPostCode": { "type": "string", "maxLength": 20, "example": "LT-01103" }, "shipToAddressLine1": { "type": "string", "example": "Warsawa ul 154" }, "shipToAddressLine2": { "type": "string", "example": "" }, "shipToCity": { "type": "string", "maxLength": 30, "example": "Warsawa" }, "shipToCountry": { "type": "string", "maxLength": 10, "example": "PL" }, "shipToState": { "type": "string", "maxLength": 30, "example": "" }, "shipToPostCode": { "type": "string", "maxLength": 20, "example": "" }, "payToAddressLine1": { "type": "string", "readOnly": true, "example": "Gedimino pr. 1" }, "payToAddressLine2": { "type": "string", "readOnly": true, "example": "" }, "payToCity": { "type": "string", "maxLength": 30, "readOnly": true, "example": "Vilnius" }, "payToCountry": { "type": "string", "maxLength": 10, "readOnly": true, "example": "LT" }, "payToState": { "type": "string", "maxLength": 30, "readOnly": true, "example": "" }, "payToPostCode": { "type": "string", "maxLength": 20, "readOnly": true, "example": "LT-01103" }, "shortcutDimension1Code": { "type": "string", "example": "PIRK" }, "shortcutDimension2Code": { "type": "string", "example": "333" }, "currencyId": { "type": "string", "format": "uuid" }, "currencyCode": { "type": "string", "example": "EUR" }, "orderId": { "type": "string", "format": "uuid", "readOnly": true }, "orderNumber": { "type": "string", "maxLength": 20, "readOnly": true, "example": "" }, "paymentMethodCode": { "type": "string", "example": "BANK" }, "pricesIncludeTax": { "type": "boolean", "example": false }, "userId": { "type": "string", "example": "PAULIUS", "description": "Assigned User ID (BC user name, not a GUID)." }, "purchaseInvoiceLines": { "type": "array", "items": { "$ref": "#/components/schemas/purchaseInvoiceLine" } }, "dimensionSetLines": { "type": "array", "items": { "$ref": "#/components/schemas/dimensionSetLine" } }, "pdfDocument": { "$ref": "#/components/schemas/pdfDocument" }, "discountAmount": { "type": "number", "example": 0 }, "discountAppliedBeforeTax": { "type": "boolean", "example": true }, "totalAmountExcludingTax": { "type": "number", "readOnly": true, "example": 500 }, "totalTaxAmount": { "type": "number", "readOnly": true, "example": 105 }, "totalAmountIncludingTax": { "type": "number", "example": 605 }, "apiTotalAmountExclVAT": { "type": "number", "example": 500, "description": "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." }, "apiTotalAmountInclVAT": { "type": "number", "example": 605, "description": "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." }, "status": { "type": "string", "readOnly": true, "enum": [ "_x0020_", "Draft", "In_x0020_Review", "Open", "Paid", "Canceled", "Corrective" ], "example": "Draft" }, "posted": { "type": "boolean", "readOnly": true }, "locationCode": { "type": "string", "example": "CENTRINIS" }, "documentLink": { "type": "string", "example": "https://example.com/invoices/KP50055.pdf", "description": "URL stored as a record link on the document." }, "documentNote": { "type": "string", "example": "", "description": "Text stored as a record note on the document." }, "closed": { "type": "boolean", "readOnly": true, "description": "Posted invoice is fully applied (closed). Always false for drafts. The page accepts a value but ignores it." }, "lastModifiedDateTime": { "type": "string", "format": "date-time", "readOnly": true }, "attachments": { "type": "array", "items": { "$ref": "#/components/schemas/attachment" } }, "documentAttachments": { "type": "array", "items": { "$ref": "#/components/schemas/documentAttachment" } } } }, "purchaseInvoiceLineRequest": { "title": "Purchase Invoice Line Request", "type": "object", "description": "Writable purchase invoice line fields. `documentId` is filled automatically when the line is created\nunder a purchase invoice. `documentId`, `sequence` and `lineObjectNumber` cannot be changed once set.\n", "properties": { "documentId": { "type": "string", "format": "uuid" }, "sequence": { "type": "integer", "example": 10000 }, "itemId": { "type": "string", "format": "uuid" }, "accountId": { "type": "string", "format": "uuid" }, "lineType": { "type": "string", "enum": [ "Comment", "Account", "Item", "Resource", "Fixed_x0020_Asset", "Charge", "Allocation_x0020_Account" ], "example": "Item" }, "lineObjectNumber": { "type": "string", "maxLength": 20, "example": "Z0000001" }, "locationCode": { "type": "string", "maxLength": 10, "example": "CENTRINIS" }, "description": { "type": "string", "maxLength": 100, "example": "Sulankstoma kėdė" }, "unitOfMeasureId": { "type": "string", "format": "uuid" }, "unitOfMeasureCode": { "type": "string", "maxLength": 10, "example": "VNT" }, "taxCode": { "type": "string", "maxLength": 50, "example": "A PREK21" }, "unitCost": { "type": "number", "example": 100.1234 }, "quantity": { "type": "number", "example": 20 }, "discountAmount": { "type": "number", "example": 0 }, "discountPercent": { "type": "number", "example": 0 }, "discountAppliedBeforeTax": { "type": "boolean" }, "amountExcludingTax": { "type": "number", "example": 2002.47 }, "amountIncludingTax": { "type": "number", "example": 2422.99 }, "invoiceDiscountAllocation": { "type": "number", "example": 0 }, "netAmount": { "type": "number", "example": 2002.47 }, "netTaxAmount": { "type": "number", "example": 420.52 }, "netAmountIncludingTax": { "type": "number", "example": 2422.99 }, "expectedReceiptDate": { "type": "string", "format": "date", "example": "2025-04-02" }, "itemVariantId": { "type": "string", "format": "uuid" }, "deferralCode": { "type": "string", "example": "1Y" }, "shortcutDimension1Code": { "type": "string", "example": "PIRK" }, "shortcutDimension2Code": { "type": "string", "example": "333" }, "dimensionSetLines": { "type": "array", "items": { "$ref": "#/components/schemas/dimensionSetLine" } } } }, "dimensionSetLine": { "title": "Dimension Set Line", "type": "object", "description": "Dimension set line (standard page \"APIV2 - Dimension Set Lines\").\nIf the customer, vendor, G/L account or item has default dimensions, overriding them on a document line needs additional PATCH requests;\nwithout default dimensions, send the dimensions with the line in the same request.\nFor documents with hundreds of lines, post dimensions in a separate `$batch` request.\n", "properties": { "id": { "type": "string", "format": "uuid", "description": "SystemId of the dimension (not of the line)" }, "code": { "type": "string", "example": "PADALINYS" }, "consolidationCode": { "type": "string", "readOnly": true, "example": "" }, "parentId": { "type": "string", "format": "uuid", "readOnly": true }, "parentType": { "type": "string", "readOnly": true, "enum": [ "_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" ], "example": "Sales_x0020_Invoice" }, "displayName": { "type": "string", "readOnly": true, "example": "Padalinys" }, "valueId": { "type": "string", "format": "uuid" }, "valueCode": { "type": "string", "example": "ADM" }, "valueConsolidationCode": { "type": "string", "readOnly": true, "example": "" }, "valueDisplayName": { "type": "string", "readOnly": true, "example": "Administracija" } } }, "purchaseInvoiceLine": { "title": "Purchase Invoice Line", "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "readOnly": true }, "documentId": { "type": "string", "format": "uuid" }, "sequence": { "type": "integer", "example": 10000 }, "itemId": { "type": "string", "format": "uuid" }, "accountId": { "type": "string", "format": "uuid" }, "lineType": { "type": "string", "enum": [ "Comment", "Account", "Item", "Resource", "Fixed_x0020_Asset", "Charge", "Allocation_x0020_Account" ], "example": "Item" }, "lineObjectNumber": { "type": "string", "maxLength": 20, "example": "Z0000001" }, "locationCode": { "type": "string", "maxLength": 10, "example": "CENTRINIS" }, "description": { "type": "string", "maxLength": 100, "example": "Sulankstoma kėdė" }, "unitOfMeasureId": { "type": "string", "format": "uuid" }, "unitOfMeasureCode": { "type": "string", "maxLength": 10, "example": "VNT" }, "taxCode": { "type": "string", "maxLength": 50, "example": "A PREK21" }, "unitCost": { "type": "number", "example": 100.1234 }, "quantity": { "type": "number", "example": 20 }, "discountAmount": { "type": "number", "example": 0 }, "discountPercent": { "type": "number", "example": 0 }, "discountAppliedBeforeTax": { "type": "boolean" }, "amountExcludingTax": { "type": "number", "example": 2002.47 }, "taxPercent": { "type": "number", "readOnly": true, "example": 21 }, "totalTaxAmount": { "type": "number", "readOnly": true, "example": 420.52 }, "amountIncludingTax": { "type": "number", "example": 2422.99 }, "invoiceDiscountAllocation": { "type": "number", "example": 0 }, "netAmount": { "type": "number", "example": 2002.47 }, "netTaxAmount": { "type": "number", "example": 420.52 }, "netAmountIncludingTax": { "type": "number", "example": 2422.99 }, "expectedReceiptDate": { "type": "string", "format": "date", "example": "2025-04-02" }, "itemVariantId": { "type": "string", "format": "uuid" }, "deferralCode": { "type": "string", "example": "1Y" }, "shortcutDimension1Code": { "type": "string", "example": "PIRK" }, "shortcutDimension2Code": { "type": "string", "example": "333" }, "dimensionSetLines": { "type": "array", "items": { "$ref": "#/components/schemas/dimensionSetLine" } }, "location": { "$ref": "#/components/schemas/location" } } }, "pdfDocument": { "title": "PDF Document", "type": "object", "description": "PDF of the document (standard page \"APIV2 - PDF Document\", read-only).\nDownload the file with GET `.../pdfDocument/pdfDocumentContent`.\nThe 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.\n", "properties": { "id": { "type": "string", "format": "uuid", "readOnly": true }, "parentId": { "type": "string", "format": "uuid", "readOnly": true }, "parentType": { "$ref": "#/components/schemas/parentType", "readOnly": true }, "pdfDocumentContent@odata.mediaReadLink": { "type": "string", "format": "uri", "readOnly": true } } }, "attachment": { "title": "Attachment", "type": "object", "description": "Incoming document attachment (standard page \"APIV2 - Attachments\").\nUpload or download the file content via `.../attachments({id})/attachmentContent`.\n", "properties": { "id": { "type": "string", "format": "uuid", "readOnly": true }, "parentId": { "type": "string", "format": "uuid" }, "fileName": { "type": "string", "example": "Test.pdf" }, "byteSize": { "type": "integer", "example": 0 }, "attachmentContent@odata.mediaEditLink": { "type": "string", "format": "uri", "readOnly": true }, "attachmentContent@odata.mediaReadLink": { "type": "string", "format": "uri", "readOnly": true }, "lastModifiedDateTime": { "type": "string", "format": "date-time", "readOnly": true }, "parentType": { "type": "string", "enum": [ "_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" ], "example": "Sales_x0020_Invoice" } } }, "documentAttachment": { "title": "Document Attachment", "type": "object", "description": "Document attachment (standard page \"APIV2 - Document Attachments\").\nUpload or download the file content via `.../documentAttachments({id})/attachmentContent`.\nWhen the attachment is created together with the document (e.g. a signed sales contract), the file content is sent in a separate PATCH request.\n", "properties": { "id": { "type": "string", "format": "uuid", "readOnly": true }, "fileName": { "type": "string", "example": "Test.pdf" }, "byteSize": { "type": "integer", "readOnly": true, "example": 0 }, "attachmentContent@odata.mediaEditLink": { "type": "string", "format": "uri", "readOnly": true }, "attachmentContent@odata.mediaReadLink": { "type": "string", "format": "uri", "readOnly": true }, "parentType": { "$ref": "#/components/schemas/parentType" }, "parentId": { "type": "string", "format": "uuid" }, "lineNumber": { "type": "integer", "example": 0 }, "documentFlowSales": { "type": "boolean" }, "documentFlowPurchase": { "type": "boolean" }, "lastModifiedDateTime": { "type": "string", "format": "date-time", "readOnly": true } } }, "badRequest": { "title": "Bad Request", "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "example": "BadRequest" }, "message": { "type": "string", "example": "The 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." } } } } }, "unauthorizedRequest": { "title": "Unauthorized Request", "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "default": "Unauthorized" }, "message": { "type": "string", "default": "The credentials provided are incorrect" } } } } }, "notFoundRequest": { "title": "Not Found Request", "type": "object", "properties": { "error": { "type": "object", "properties": { "code": { "type": "string", "example": "BadRequest_ResourceNotFound" }, "message": { "type": "string", "example": "Resource not found for the segment 'dimensionValues'. CorrelationId: fc7b9039-73d9-48d2-a9d3-9a8e0f8b91da." } } } } }, "location": { "title": "Location", "type": "object", "description": "Location (standard page \"APIV2 - Locations\").", "properties": { "id": { "type": "string", "format": "uuid", "readOnly": true }, "code": { "type": "string", "example": "CENTRINIS" }, "displayName": { "type": "string", "example": "Centrinis sandėlis" }, "contact": { "type": "string", "example": "Vardas Pavarde" }, "addressLine1": { "type": "string", "example": "Savanorių pr. 1" }, "addressLine2": { "type": "string", "example": "" }, "city": { "type": "string", "example": "Vilnius" }, "state": { "type": "string", "example": "" }, "country": { "type": "string", "example": "LT" }, "postalCode": { "type": "string", "example": "LT-03116" }, "phoneNumber": { "type": "string", "example": "+370 5 2000000" }, "email": { "type": "string", "format": "email" }, "website": { "type": "string", "example": "" }, "lastModifiedDateTime": { "type": "string", "format": "date-time", "readOnly": true } } }, "parentType": { "type": "string", "enum": [ "_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" ], "example": "Sales_x0020_Invoice" } }, "responses": { "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/badRequest" } } } }, "401": { "description": "Unauthorized", "headers": { "WWW-Authenticate": { "schema": { "type": "string" } } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/unauthorizedRequest" } } } }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/notFoundRequest" } } } } }, "securitySchemes": { "OAuth2": { "type": "oauth2", "flows": { "clientCredentials": { "tokenUrl": "https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token", "scopes": { "https://api.businesscentral.dynamics.com/.default": "Grants the permissions assigned to the Microsoft Entra ID application in Business Central" } } } } } } } ````