API specification for Softera.E-Invoice, the Business Central extension that exposes master data and
documents through custom REST APIs (API group softera/softeraEInvoice, version v2.0).
For the standard Business Central APIs see API v2.0 overview.
Request structure
https://api.businesscentral.dynamics.com/v2.0/{tenantId}/{environment}/api/softera/softeraEInvoice/v2.0/companies({companyId})/{endpoint}
| Part | Value |
|---|---|
{tenantId} |
Tenant ID |
{environment} |
Name of the environment |
softera/softeraEInvoice |
E-Invoice API group name |
v2.0 |
API version |
companies({companyId}) |
Id of the company, retrieved from the Companies endpoint |
{endpoint} |
Endpoint name |
| Header | Value |
|---|---|
| Authorization | Bearer {token}. Required. |
| Content-Type | application/json |
| 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. |
Authentication uses OAuth 2.0 client credentials with a Microsoft Entra application that is registered in Business Central (Microsoft Entra Applications) with the required permission sets. See Azure App registration.
Performance recommendations
- Use
$expandto create a master record together with related data (e.g. a customer withdefaultDimensions, or a sales invoice with its lines) in a single request. - Use
$batchwhen creating or updating many records at once (e.g. journal lines). Business Central allows up to 100 operations per$batchrequest. Each operation is evaluated on its own: a failure in one operation does not roll back the others, so check the status of every operation in the batch response. - For documents with hundreds of lines, post dimensions in a separate
$batchrequest instead of expanding both lines anddimensionSetLinesin one request. - See Operational limits for Business Central online.
Enum values
Fields based on an AL Enum are returned with OData name encoding: spaces and special characters are replaced
by their _xHHHH_ code, e.g. Sales Invoice is returned as Sales_x0020_Invoice, G/L Account as
G_x002F_L_x0020_Account and a blank value as _x0020_. Fields based on an AL Option (e.g. job queue entry
status, VAT posting setup unrealizedVATType) are returned as plain text, e.g. On Hold.
The schemas list the values exactly as they are returned; use the same values in request bodies.
E-Invoice Setup
The E-Invoice Setup page affects customers, vendors, sales and purchase documents:
- Check VAT Mismatch in API Request (Sales / Purchase): enables the check of the API totals
(
apiTotalAmountExclVAT,apiTotalAmountInclVAT) against the amounts calculated by Business Central. The check runs twice:- when the document is read through the API (the response to a create or update, and GET): the amount excluding VAT must match, and a VAT difference is corrected only when Allow VAT Auto Correction is enabled and the difference does not exceed Max. VAT Difference Allowed (General Ledger Setup);
- when the document is posted: both totals must match the document amounts, otherwise posting fails.
- Allow API Documents Edit: documents created via the API are marked "Created via API" and cannot be edited by users unless this is enabled.
- Check Duplicates by Reg. No. / Check Duplicates by Name: customer and vendor creation is rejected when a record with the same registration number or name exists.
- Assign Default Template and the Local / EU / Foreign templates: a customer or vendor template is assigned automatically by country.
See API Setup and API Process.
Common errors
| Error | Description |
|---|---|
| Amounts excl. VAT doesn't match. | apiTotalAmountExclVAT and the amount calculated by Business Central do not match, usually because unit prices differ between systems. |
| 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. |
| 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. |
| 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. |
| 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. |
| Invalid body. | The request body contains extra symbols, or a field name is incorrect or does not exist. |
A Postman collection with request examples is available on the API overview page.
|
License
|
|---|
|
Softera
https://www.softera.lt/en/license-agreement/ |
|
Servers
| ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
URL for Business Central cloud https://api.businesscentral.dynamics.com/v2.0/{tenantId}/{environment}/apiServer Variables
|
||||||||||||
|
URL for Business Central On-Prem https://{baseURL}:{port}/{serverInstance}/apiServer Variables
|
||||||||||||