> ## 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. # List Companies > Gets all companies in Business Central environment ## OpenAPI ````json GET /v2.0/companies { "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": { "/v2.0/companies": { "summary": "Companies", "get": { "summary": "List Companies", "description": "Gets all companies in Business Central environment", "operationId": "getAllCompanies", "parameters": [ { "$ref": "#/components/parameters/top" }, { "$ref": "#/components/parameters/skip" }, { "$ref": "#/components/parameters/orderby" }, { "$ref": "#/components/parameters/filter" }, { "$ref": "#/components/parameters/select" }, { "$ref": "#/components/parameters/count" } ], "tags": [ "Companies" ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "title": "Response", "type": "object", "properties": { "@odata.context": { "type": "string", "format": "uri", "readOnly": true, "description": "OData context URL of the collection" }, "@odata.count": { "type": "integer", "readOnly": true, "description": "Total number of matching records, returned when $count=true" }, "@odata.nextLink": { "type": "string", "format": "uri", "readOnly": true, "description": "URL of the next page, present when more records are available" }, "value": { "type": "array", "items": { "$ref": "#/components/schemas/company" } } } } } } }, "401": { "$ref": "#/components/responses/401" } } } } }, "components": { "parameters": { "top": { "name": "$top", "in": "query", "schema": { "type": "integer", "minimum": 1 }, "description": "Maximum number of records to return. Without `$top`, Business Central returns the records page by page and adds `@odata.nextLink` to the response." }, "skip": { "name": "$skip", "in": "query", "schema": { "type": "integer", "minimum": 0, "default": 0 }, "description": "Number of records to skip." }, "orderby": { "name": "$orderby", "in": "query", "schema": { "type": "string" }, "description": "Sort order, e.g. `lastModifiedDateTime desc`." }, "filter": { "name": "$filter", "in": "query", "schema": { "type": "string" }, "description": "OData filter expression, e.g. `number eq '10000'`. See [Using filtering in API calls](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-connect-apps-filtering)." }, "select": { "name": "$select", "in": "query", "schema": { "type": "string" }, "description": "Comma-separated list of properties to return." }, "count": { "name": "$count", "in": "query", "schema": { "type": "boolean", "default": false }, "description": "When `true`, the response includes `@odata.count` with the total number of matching records." } }, "schemas": { "company": { "title": "Company", "type": "object", "required": [ "id", "name" ], "properties": { "id": { "type": "string", "format": "uuid" }, "systemVersion": { "type": "string" }, "timestamp": { "type": "integer", "minimum": 1000, "maximum": 2147483648 }, "name": { "type": "string" }, "displayName": { "type": "string" }, "businessProfileId": { "type": "string" }, "systemCreatedAt": { "type": "string", "format": "date-time" }, "systemCreatedBy": { "type": "string", "format": "uuid" }, "systemModifiedAt": { "type": "string", "format": "date-time" }, "systemModifiedBy": { "type": "string", "format": "uuid" } } }, "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" } } } } } }, "responses": { "401": { "description": "Unauthorized", "headers": { "WWW-Authenticate": { "schema": { "type": "string" } } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/unauthorizedRequest" } } } } }, "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" } } } } } } } ````