Unlocking Dynamics 365 Business Central APIs: Mastering Customer Endpoints with CRUD Examples

(Image: A conceptual banner for Business Central APIs—feel free to replace with your own.)
Introduction
In the world of ERP systems, Dynamics 365 Business Central stands out for its robust web services and APIs, enabling seamless integrations with custom apps, e-commerce platforms, or CRM tools. If you're a developer, IT pro, or business analyst, understanding the API endpoint structure is essential for automating tasks like managing customer data.
This guide dives deep into Business Central's API structure, focusing exclusively on the customers entity. We'll cover CRUD operations (Create, Read, Update, Delete) with practical examples, including code snippets and a ready-to-use Postman collection. By the end, you'll be equipped to build reliable integrations.
All examples are based on Microsoft's official documentation [learn.microsoft.com](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/webservices/api-endpoint-structure?wt.mc_id=DX-MVP-5004336). Let's get started!
Understanding the API Endpoint Structure
Business Central APIs follow a consistent URL pattern, making them predictable and easy to work with. The base structure is:
https://api.businesscentral.dynamics.com/v2.0/{tenantId}/{environmentName}/api/{publisher}/{group}/{version}/companies({companyId})/{entityName}
- {tenantId}: Your Azure Active Directory tenant ID (e.g., a GUID like 12345678-1234-1234-1234-1234567890ab
).
- {environmentName}: The environment, such as 'Production' or 'Sandbox'.
- {publisher}/{group}/{version}: Typically 'microsoft/automation/v1.0' or 'v2.0' for standard APIs.
- {companyId}: The GUID of your specific Business Central company.
- {entityName}: The resource you're targeting, e.g., 'customers' for this guide.
Authentication requires OAuth 2.0 tokens—register an app in Azure AD and use client credentials flow to get a bearer token. Always include it in the Authorization
header.
Pro Tip: Use OData query parameters for advanced filtering, like $filter=displayName eq 'Acme Corp'
or $top=10
for pagination. Rate limits apply (e.g., 600 requests per minute), so handle errors gracefully.
Customer-Focused CRUD Examples
Let's apply this to the customers
entity. These operations allow you to manage customer records, such as syncing from external systems or updating contact details.
1. GET: Retrieve Customers
Fetch a list of all customers or a single one by ID.
- GET All Customers:
GET https://api.businesscentral.dynamics.com/v2.0/{tenantId}/Production/api/v2.0/companies({companyId})/customers
Headers:
- Authorization: Bearer {your-token}
- Accept: application/json
Expected Response: A JSON array like:
{
"value": [
{
"id": "guid-here",
"number": "CUST001",
"displayName": "Acme Corp",
"email": "info@acme.com"
}
]
}
- GET Single Customer (by ID):
GET https://api.businesscentral.dynamics.com/v2.0/{tenantId}/Production/api/v2.0/companies({companyId})/customers({customerId})
2. POST: Create a New Customer
Add a new customer record.
POST https://api.businesscentral.dynamics.com/v2.0/{tenantId}/Production/api/v2.0/companies({companyId})/customers
Headers:
- Authorization: Bearer {your-token}
- Content-Type: application/json
Body (JSON):
{
"number": "CUST001",
"displayName": "Acme Corp",
"type": "Company",
"email": "info@acme.com",
"currencyCode": "USD"
}
This is ideal for integrations like pulling leads from a CRM into Business Central.
3. PATCH: Update an Existing Customer
Modify specific fields of a customer (partial updates).
PATCH https://api.businesscentral.dynamics.com/v2.0/{tenantId}/Production/api/v2.0/companies({companyId})/customers({customerId})
Headers:
- Authorization: Bearer {your-token}
- Content-Type: application/json
Body (JSON):
{
"email": "updated@acme.com"
}
Use this for scenarios like updating addresses or payment terms.
4. DELETE: Remove a Customer
Permanently delete a customer (caution: this can't be undone and may affect linked data).
DELETE https://api.businesscentral.dynamics.com/v2.0/{tenantId}/Production/api/v2.0/companies({companyId})/customers({customerId})
Headers:
- Authorization: Bearer {your-token}
Hands-On Testing with Postman
To experiment without writing code, use this Postman collection. Copy the JSON below, save it as BusinessCentralCustomerAPI.json
, and import it into Postman. Set the variables (e.g., in the collection's Variables tab) with your real values.
{
"info": {
"_postman_id": "business-central-customer-api-examples",
"name": "Business Central Customer API Examples",
"description": "Example CRUD calls for Dynamics 365 Business Central Customers API. Set variables: tenantId, environmentName, companyId, customerId, accessToken.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "GET All Customers",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"url": {
"raw": "https://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/{{environmentName}}/api/v2.0/companies({{companyId}})/customers",
"protocol": "https",
"host": [
"api",
"businesscentral",
"dynamics",
"com"
],
"path": [
"v2.0",
"{{tenantId}}",
"{{environmentName}}",
"api",
"v2.0",
"companies({{companyId}})",
"customers"
]
}
}
},
{
"name": "GET Single Customer",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"url": {
"raw": "https://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/{{environmentName}}/api/v2.0/companies({{companyId}})/customers({{customerId}})",
"protocol": "https",
"host": [
"api",
"businesscentral",
"dynamics",
"com"
],
"path": [
"v2.0",
"{{tenantId}}",
"{{environmentName}}",
"api",
"v2.0",
"companies({{companyId}})",
"customers({{customerId}})"
]
}
}
},
{
"name": "POST New Customer",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"number\": \"CUST001\",\n \"displayName\": \"Acme Corp\",\n \"type\": \"Company\",\n \"email\": \"info@acme.com\",\n \"currencyCode\": \"USD\"\n}"
},
"url": {
"raw": "https://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/{{environmentName}}/api/v2.0/companies({{companyId}})/customers",
"protocol": "https",
"host": [
"api",
"businesscentral",
"dynamics",
"com"
],
"path": [
"v2.0",
"{{tenantId}}",
"{{environmentName}}",
"api",
"v2.0",
"companies({{companyId}})",
"customers"
]
}
}
},
{
"name": "PATCH Update Customer",
"request": {
"method": "PATCH",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"updated@acme.com\"\n}"
},
"url": {
"raw": "https://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/{{environmentName}}/api/v2.0/companies({{companyId}})/customers({{customerId}})",
"protocol": "https",
"host": [
"api",
"businesscentral",
"dynamics",
"com"
],
"path": [
"v2.0",
"{{tenantId}}",
"{{environmentName}}",
"api",
"v2.0",
"companies({{companyId}})",
"customers({{customerId}})"
]
}
}
},
{
"name": "DELETE Customer",
"request": {
"method": "DELETE",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}",
"type": "text"
}
],
"url": {
"raw": "https://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/{{environmentName}}/api/v2.0/companies({{companyId}})/customers({{customerId}})",
"protocol": "https",
"host": [
"api",
"businesscentral",
"dynamics",
"com"
],
"path": [
"v2.0",
"{{tenantId}}",
"{{environmentName}}",
"api",
"v2.0",
"companies({{companyId}})",
"customers({{customerId}})"
]
}
}
}
],
"variable": [
{
"key": "tenantId",
"value": "your-tenant-id-here"
},
{
"key": "environmentName",
"value": "Production"
},
{
"key": "companyId",
"value": "your-company-guid-here"
},
{
"key": "customerId",
"value": "your-customer-guid-here"
},
{
"key": "accessToken",
"value": "your-oauth-token-here"
}
]
}
Best Practices and Common Challenges
- Security: Never hardcode tokens—use secure storage.
- Error Handling: Watch for 429 (rate limit) or 404 (not found) errors.
- Testing: Start in a Sandbox environment to avoid disrupting production data.
- Extensions: For custom fields, use AL extensions and bound actions.
Common challenges include authentication setup and handling large datasets—plan for batching if needed.
Conclusion
Mastering Business Central's customer APIs opens doors to powerful automations. Try the examples in Postman, and adapt them to your needs. Have questions or built something cool? Comment below—I'd love to hear!
#Dynamics365 #BusinessCentral #API #Integration #Postman #MicrosoftDynamics
Originally published on www.midego.net. Last updated: July 2025.