---
title: "Developer guide to fetch expense data from Microsoft Dynamics Business Central API"
url: "https://getknit.dev/blog/developer-guide-to-fetch-expense-data-from-microsoft-dynamics-business-central-api/"
date: "2026-01-09T07:10:15+00:00"
modified: "2026-04-11T05:22:12+00:00"
type: "post"
---

# Developer guide to fetch expense data from Microsoft Dynamics Business Central API

[Blog](https://getknit.dev/blog) / [Tutorials](https://getknit.dev/blogs/tutorials/) / Developer guide to fetch expense data from Microsoft Dynamics Business Central API [Tutorials](https://getknit.dev/blogs/tutorials/) · January 9, 2026 · Updated April 11, 2026 

Developer guide to fetch expense data from Microsoft Dynamics Business Central API
==================================================================================

 ![](https://storage.googleapis.com/knit-website-media/2026/08/64c34ca1e0546a9d333bb35a_Kunal-3-112x112.png)Kunal Mishra

3 min read

 

 

 [](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fgetknit.dev%2Fblog%2Fdeveloper-guide-to-fetch-expense-data-from-microsoft-dynamics-business-central-api%2F) [](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgetknit.dev%2Fblog%2Fdeveloper-guide-to-fetch-expense-data-from-microsoft-dynamics-business-central-api%2F&text=Developer%20guide%20to%20fetch%20expense%20data%20from%20Microsoft%20Dynamics%20Business%20Central%20API)  

 

 

 

  Table of Contents - [Introduction](#introduction)
- [Get Expense Data from Microsoft Dynamics Business Central API](#get-expense-data-from-microsoft-dynamics-business-central-api)
- [Prerequisites](#prerequisites)
- [API Endpoint](#api-endpoint)
- [Step-by-Step Process](#step-by-step-process)
- [Common Pitfalls](#common-pitfalls)
- [Frequently Asked Questions](#frequently-asked-questions)
- [Knit for Microsoft Dynamics Business Central API Integration](#knit-for-microsoft-dynamics-business-central-api-integration)
 
  Introduction
------------

This article is part of a deep-dive series on the **Microsoft Dynamics Business Central API**. The focus here is narrow and practical: pulling expense data from Business Central using its API.

If you’re looking for broader coverage, authentication models, rate limits, pagination patterns, or other supported use cases, refer to the complete Microsoft Dynamics Business Central API guide [here](/blog/microsoft-business-central-api-guide-in-depth/).

Get Expense Data from Microsoft Dynamics Business Central API
-------------------------------------------------------------

### Prerequisites

Before you touch code, get the basics right. Most failures happen here.

- API access must be enabled in your Business Central environment. This requires configuration via the Business Central Administration Shell and enabling OData and API services.
- You must have valid authentication credentials: a username and a web service access key.
- You should be familiar with Microsoft’s API terms of use to avoid compliance or access issues later.

### API Endpoint

All requests are routed through the Business Central OData v4 endpoint:

`https://api.businesscentral.dynamics.com/v2.0/{tenant_id}/sandbox/ODataV4/<br></br>`

The `{tenant_id}` and environment (`sandbox` vs `production`) must match your setup exactly. One mismatch and you’ll get hard failures.

### Step-by-Step Process

#### 1. Authentication

Business Central uses **Basic Authentication** with:

- Username
- Web service access key (used as the password)

This is straightforward but unforgiving—invalid credentials return immediate 401 errors.

#### 2. Fetch Expense Data

Expense data may not always live under a single logical entity, so you may need to query multiple endpoints depending on how expenses are modeled in your tenant.

```
import requests
from requests.auth import HTTPBasicAuth

# Define your credentials
username = 'your_username'
password = 'your_web_service_access_key'

# Define the endpoint
url = 'https://api.businesscentral.dynamics.com/v2.0/{tenant_id}/sandbox/ODataV4/Expenses'

# Make the request
response = requests.get(url, auth=HTTPBasicAuth(username, password))

# Check the response
if response.status_code == 200:
    expenses = response.json()
    print(expenses)
else:
    print('Failed to retrieve data:', response.status_code)
```

Common Pitfalls
---------------

These issues come up repeatedly in real-world implementations:

1. API access not enabled in the Business Central environment.
2. Incorrect tenant ID or malformed endpoint URLs.
3. Invalid username or web service access key.
4. No handling for API rate limits or throttling.
5. Breaking changes due to ignored API version updates.
6. SSL verification disabled or misconfigured.
7. Insufficient permissions on the underlying data entities.

Bottom line: most “API issues” are configuration or governance problems, not code problems.

Frequently Asked Questions
--------------------------

**How do I enable API access?**
Use the Business Central Administration Shell to enable OData and API services.

**What authentication method does Business Central use?**
Basic Authentication with a username and web service access key.

**Can I extend the API to include additional fields?**
No. Extending standard APIs with custom fields is not currently supported.

**What is the default port for OData services?**
The default port is 7048.

**How do I find my tenant ID?**
Your tenant ID is embedded in your Business Central URL.

**What causes a 401 Unauthorized error?**
Almost always incorrect credentials or missing permissions.

**How should I handle API rate limits?**
Implement retry logic, backoff strategies, and actively monitor API usage.

Knit for Microsoft Dynamics Business Central API Integration
------------------------------------------------------------

If you don’t want to babysit authentication, versioning, and long-term maintenance, Knit offers a cleaner path. Integrate once with [Knit](/integration/ms-dynamics-business-central/), and it abstracts away authentication, authorization, and ongoing API changes for Microsoft Dynamics Business Central.

This isn’t about convenience, it’s about reducing operational drag and keeping your integration stable as APIs evolve.

 

 ![](https://storage.googleapis.com/knit-website-media/2026/08/64c34ca1e0546a9d333bb35a_Kunal-3-112x112.png)Written by Kunal Mishra

Changing integration landscape, one organization at a time‍

 

 

 

 

 

  Keep Reading
------------

  ![How to Get an Okta API Token (Step-by-Step)](https://storage.googleapis.com/knit-website-media/2026/08/blog-banner-red-scaled-640x400.png) [Tutorials](https://getknit.dev/blogs/tutorials/) 

### [How to Get an Okta API Token (Step-by-Step)](https://getknit.dev/blog/okta-api-key/)

Generate an Okta API token in the Admin Console, add it as an SSWS Authorization header, and call the Okta…

 July 22, 2026 · 8 min read 

 

   ![Get Ticket Data from Freshdesk API using Python](https://storage.googleapis.com/knit-website-media/2026/08/blog-banner-red-scaled-640x400.png) [Tutorials](https://getknit.dev/blogs/tutorials/) 

### [Get Ticket Data from Freshdesk API using Python](https://getknit.dev/blog/get-ticket-data-from-freshdesk-api-using-python/)

Learn how to retrieve ticket data from the Freshdesk API with step-by-step instructions, endpoints, code examples, common pitfalls, and FAQs…

 April 11, 2026 · 5 min read 

 

   ![How to Retrieve Candidate Education Data from Bullhorn API using Python](https://storage.googleapis.com/knit-website-media/2026/08/blog-banner-yellow-scaled-640x400.png) [Tutorials](https://getknit.dev/blogs/tutorials/) 

### [How to Retrieve Candidate Education Data from Bullhorn API using Python](https://getknit.dev/blog/how-to-retrieve-candidate-education-data-from-bullhorn-api-using-python/)

Step-by-step guide to retrieving candidate education data from the Bullhorn API, including authentication, endpoints, common pitfalls, and FAQs.

 April 11, 2026 · 3 min read 

 

  

 

  \#1 in Ease of Integrations
---------------------------

![4.9 out of 5 stars](/wp-content/themes/knit/assets/images/g2/g2-star-rating.svg)

4.9 out of 5 stars on G2

![G2 Leader, Spring 2026](/wp-content/themes/knit/assets/images/g2/g2-leader.svg)![G2 Fastest Implementation, Spring 2026](/wp-content/themes/knit/assets/images/g2/g2-fastest-implementation.svg)![G2 High Performer, Spring 2026](/wp-content/themes/knit/assets/images/g2/g2-high-performer.svg)![G2 Best Est. ROI, Spring 2026](/wp-content/themes/knit/assets/images/g2/g2-best-roi.svg)

 

  Put Integrations on Autopilot. Talk to Experts.
-----------------------------------------------

Knit is loved by customers across the globe due to our seamless product and white glove support. You'll love us too!

 [Talk to a Human](/book-demo)
