> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maesn.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Microsoft Business Central

> Integrate Microsoft Business Central easily with Maesn’s Unified API. See the documentation with detailed system coverage and setup prerequisites.

**TARGET\_SYSTEM:** `businesscentral`

| | Read | Create | Update | Delete | Webhook |
| - | :-: | :-: | :-: | :-: | :-: |
| Accounts | | | | | |
| Async task | | | | | |
| Bank accounts | | | | | |
| Bills | | | | | |
| Bill lines | | | | | |
| Booking proposals | | | | | |
| Contacts | | | | | |
| Customers | | | | | |
| Credit notes | | | | | |
| Currencies | | | | | |
| Dimensions | | | | | |
| Expenses | | | | | |
| Files | | | | | |
| Fiscal years | | | | | |
| Goods receipts | | | | | |
| Goods receipt lines | | | | | |
| Invoices | | | | | |
| Invoice lines | | | | | |
| Items | | | | | |
| Journals | | | | | |
| Journal entries | | | | | |
| Offers | | | | | |
| Offer lines | | | | | |
| Open items | | | | | |
| Payments | | | | | |
| Payment terms | | | | | |
| Projects | | | | | |
| Purchase orders | | | | | |
| Purchase order lines | | | | | |
| Reason codes | | | | | |
| Sales orders | | | | | |
| Sales order lines | | | | | |
| Suppliers | | | | | |
| Tax rates | | | | | |
| Tolerance limits | | | | | |
| Transactions | | | | | |
| Trial balance | | | | | |
| Units | | | | | |
| Users | | | | | |
| Vendor credits | | | | | |

&#x20;\= Supported by Maesn \

&#x20;\= On demand - contact us\

&#x20;\= Not supported by Business Central \


## How to connect to Microsoft Business Central

To allow your customers to link your application with their Business Central account, you need to set up a Microsoft Entra App and submit your application credentials to maesn.

> [!NOTE]
>
> When targeting Business Central endpoints, it is essential to fill in the *environmentName* and *companyId* query parameters.
> You can obtain these values by using the `GET Environments` and `GET Companies` endpoints available under the Authentication section.

> [!NOTE]
>
> If you’re experiencing issues with the **POST endpoints**, ensure that your **API Setup** is correctly configured in **Business Central**.
> In Business Central, search for **API Setup** and verify that there are templates available for the object you want to create.
> Some mandatory fields are automatically populated by these templates and cannot be set through the API.

**1. Prerequisites**

Before you begin, ensure you have the following:

* An active Azure account with a valid subscription.
* Cloud Application Administrator permissions on your Azure account.
* A Microsoft Entra tenant.
* An Admin-permissioned Business Central account.

**2. Set up a Multitenant Microsoft Entra Application**

* Sign in to your [Microsoft Entra](https://entra.microsoft.com/) account.
* In the sidebar, select Applications > App registrations.
* To set up a new application, select "New registration" and enter a name for your application.
* Select "Multitenant application".
* Under "Redirect URL", select "Web" and enter the following URL:
  `https://api.maesn.dev/auth/callback/businesscentral`
* Click "Register".

On the "Overview" page of your application, you will find all the information about your application. Note the "Application (client) ID," as it will be needed later.

**3. Set Permissions for Your Application**

In you Microsoft Entra application:

* Select API permissions in the sidebar > Add a permission > Microsoft APIs.
* Select Dynamics 365 Business Central.
* Select Application permissions, then click Add permissions.
  * Talk to us if you are unsure exactly what permissions you need for the endpoints you are using. During development you can choose AdminCenter.ReadWrite.All, to get access to all endpoints, but we strongly recommend not to use this in a production scenario, since it will deter customers from using your solution.

**Note:** For security reasons, we recommend always restricting scopes to only the objects and operations that your application actually requires.

* Add another permission by selecting Add a permission again.
* Select Microsoft APIs > Dynamics 365 Business Central > Delegated Permissions.
* Tick all boxes, then click Add permissions.
* When the permissions have been added, click Grant admin consent for \<company name> next to the Add permissions button.

**4. Generate Credentials**

In you Microsoft Entra application

* Select Certificates & secrets in the sidebar
* Select Client secrets > New client secret.
* Add a description for your client secret.
* Select an expiration period for the client secret or specify a custom duration. Note that the default expiration for a client secret is six months. You may extend the lifetime to minimize the need for frequent credential updates.
* Click Add.
* Copy and securely store the secret's *value* immediately, as it will not be accessible after you leave this page.

**5. Add the Application Credentials to Business Central**

In Business Central:

* Press the search bar and enter "Microsoft Entra Applications". If you dont find this page, please review your user permissions.
* Click "New"
* Add the application (client) ID of your application and enter a brief description for your application.

**6. Configure Your Integration in the maesn API**

Finally, set up your API tenant with your application's details. Contact your maesn representative to provide the following information:

* **Application (Client) ID** of your application
* **Client Secret** (ensure you provide the **value**, not the **ID**)

Additionally, please inform us if your client secret expires and you generate a new one.
If you are not sure who your technical contact is, do not hesitate to [reach out to us](https://www.maesn.com/contact).

## Webhooks

Business Central supports the following parameters for webhooks:

Resources:

* `ACCOUNT`
* `CREDIT_NOTE`
* `CUSTOMER`
* `DIMENSION`
* `EXPENSE`
* `ITEM`
* `INVOICE`
* `JOURNAL_ENTRY`
* `OFFER`
* `SALES_ORDER`
* `SUPPLIER`

Business Central only needs the resource and not the event type: you subscribe to a resource and get back all events for that resource.

The event types are `CREATED`,`UPDATED`, `DELETED` and `COLLECTION` types.
Collection events are special: Business Central waits for multiple events of a given resource type before sending them. Instead of sending individual IDs, a collection event provides a date range that represents when the events occurred.
When a collection event is received, the appropriate list endpoint must be called using the provided filterDate as `lastModifiedAt` filter.

The subscription is created **per customer**, which means for each customer, you will create a customized subscription for resources you want to be notified about.
To set this up, call Maesn's create webhook endpoint `POST /webhooks?companyId=<companyId>&environmentName=<environmentName>` (`companyId` and `environmentName` query parameters required if not using the interactive flow) with the following example body:

```javascript Example code snippet theme={null}
    const response = await axios.post(url, {
        "callbackUrl": callbackUrl,
        "resource": "CUSTOMER"
    }, {
        headers: {
            'X-API-KEY': apiKey,
            'X-ACCOUNT-KEY': accountKey
        }
    });
```

It will return the `id` associated with the subscription:

```json Example response theme={null}
{
    "data": {
        "id": "830251",
        "callbackUrl": "https://example.com/webhook-endpoint/12345",
        "createdDate": null,
        "expiresDate": "2026-01-29T08:48:40Z",
        "secret": "2f1fd5f883d4c0adf5b31b91e4d6ae2d2975620c67bac8fdb864c78047b1d522"
        "updatedDate": "2026-01-26T08:48:40Z",
    },
    "meta": {}
}
```

At this point, your system is ready to receive end-user–related events at the callback URL you provided. Business central retrieves a list of events.
The event response will be an array providing the following information:

```json Example event body theme={null}
[{
  "eventType": "UPDATED",
  "filterDate": null, //supported only for collection event types
  "resource": "CUSTOMER",
  "resourceId": "1605408d-ed88-4228-8a12-ab857a2972d8",
  "userId": null //not supported by business central
}]
```

To delete the webhook subscription, you can call the `DELETE` `/webhooks/{webhookId}?companyId=<companyId>&environmentName=<environmentName>` endpoint provinding both your `X-API-KEY` and the end user `X-ACCOUNT-KEY`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.