Business Central exposes many APIs that make it possible for other services to integrate with Business Central. This article explains how the endpoint URLs for these APIs are constructed and provides examples from different types of APIs.
The structure of API endpoint URLs
URLs for built-in or custom API endpoints all follow the same base pattern. They start with the following base.
Base URL
https://api.businesscentral.dynamics.com/v2.0
The v2.0
part of the base URL stems from the time when Business Central started supporting multiple environments.
Next, the URL needs to include, which Business Central environment to connect to. Here, you can choose to include the Microsoft Entra ID of the tenant you want to connect to in the URL:
Environment information
{Base URL}/{Entra ID}/{Environment name}
or
{Base URL}/{Environment name}
Then, you need to specify that the endpoint is for an API object (API page or API query). Notice that this part of the URL is different for other technologies, such as OData web services. This article doesn't cover these cases, as APIs are the recommended way of integrating Business Central with other systems.
{Base URL}/{Environment information}/api
After that, you need to specify the API route (also called API category). For partner-created APIs, the API route is constructed using the APIPublisher
, APIGroup
, and APIVersion
that you specify in your API object in AL. Learn more at aka.ms/BCCustomAPI.
Every Business Central environment comes with a standard set of commonly used APIs; for these, the API route is simply an APIVersion
(namely v2.0
), with no group or publisher.
API route For Microsoft Standard API, use this path:
{Base URL}/{Environment information}/api/v2.0
Other endpoints include API publisher, API group, and API version:
{Base URL}/{Environment information}/api/{API publisher}/{API group}/{API version}
The resulting URL points at the root of the APIs for the specific combination of parameters you used; in other words, this URL points at the OData Service Document. You have to append the specific endpoint to the URL to be able to access your data.
Endpoint {Base URL}/{Environment information}/api/{API route}/{endpoint}
To call most of the Business Central endpoints, you need to specify, which company you want to connect to. You can specify the company as part of the URL or as a query parameter.
Company
You can specify the company as a query parameter:
{Base URL}/{Environment information}/api/{API route}/{endpoint}?company=<companyGuid>
Alternatively, you can specify it as part of the endpoint:
{Base URL}/{Environment information}/api/{API route}/companies(<companyGuid>)/{endpoint}
Example: URLs for Business Central Standard API
To access any endpoint from the Microsoft Standard API 2.0, use this URL
https://api.businesscentral.dynamics.com/v2.0/{environment name}/api/v2.0/{endpoint}
Learn more in Business Central API (v2.0).
Example: URLs for Business Central automation API
To access any endpoint from the Business Central automation API, use this URL
https://api.businesscentral.dynamics.com/v2.0/{environment name}/api/microsoft/automation/v2.0/companies({companyId})/{endpoint}
Learn more in Automation API
Example: URLs for a custom API
Assume you have a custom API with the following API metadata
page 50101 "myAPIPage"
{
PageType = API;
APIVersion = 'v1.0';
APIPublisher = 'myPublisher';
APIGroup = 'myGroup';
// endpoint defined here
}
To access the endpoint from that API, use the following URL:
https://api.businesscentral.dynamics.com/v2.0/{environment name}/api/{API publisher}/{API group}/{API version}/{endpoint}
Learn more in Developing a custom API