# D365 Recurring Integration: Enqueue, Dequeue and Ack Explained

> Source: https://netray.co/erp-help/dynamics-d365fo-recurring-integration-enqueue-dequeue-how-to
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: ERP Help

## Short answer

Create a recurring data job on a data project, register an Entra ID application and authorize it in D365, then POST files to api/connector/enqueue/{activityId} to import, or GET api/connector/dequeue/{activityId} followed by an ack call to export. The job's activity ID in the URL ties your calls to the data project.

## Kind

how-to

## System

dynamics

## Erp

Microsoft Dynamics 365 Finance and Supply Chain Management

## Module

Data management / Recurring integrations

## Query

D365 finance and operations recurring integration enqueue dequeue API how to

## Alternate Queries

- D365FO recurring data job REST API enqueue
- api/connector/enqueue activity id D365
- D365 dequeue ack recurring integration
- D365 import file via REST API data management

## Applies To

Dynamics 365 Finance and Supply Chain Management (cloud). Recurring integrations REST connector with Entra ID (Azure AD) OAuth client credentials.

## Steps

### How to set up and call a recurring integration

**Items:**

Register an application in Microsoft Entra ID with a client secret or certificate, and note the application (client) ID and tenant ID.

In D365 open System administration > Setup > Microsoft Entra ID applications, add the client ID and map it to a user with the roles needed for the entities involved.

Open Data management, create a data project and add the entity (for example Customers V3) with the source data format such as Package or CSV, and map the fields.

In the data project select Create recurring data job. Name it, set Application ID to your client ID, tick the Enable data package or enable the import/export option, and set the processing recurrence if needed. Note the Activity ID (a GUID) shown after saving.

Request an OAuth token using client credentials, with the environment URL as the resource, then call the connector endpoints using that Bearer token.

To import, POST the file to the enqueue endpoint with the entity query parameter, for example https://yourenv.operations.dynamics.com/api/connector/enqueue/{activityId}?entity=Customers+V3, and read the returned message ID.

To export, GET the dequeue endpoint, read the JSON with DownloadLocation and CorrelationId, download the file, then POST to the ack endpoint with the same correlation payload to mark it consumed.

Check progress under Data management > Recurring data jobs > Manage messages, and on the job's execution history for errors on specific records.

## Sections

### How the connector works

**Body:**

Recurring integrations place messages in a queue in D365. The enqueue endpoint adds an inbound file as a message tied to the recurring job's activity ID. A batch process then picks messages up, imports them using the data project definition and updates the message status. For export, a batch job produces files that sit in the queue until an external caller dequeues them.

Because the process is queue based, a successful HTTP response from enqueue only means the message was accepted. It does not mean records were imported. Always check the message status and the execution log, and design your integration to correlate on the message ID the enqueue call returns.

The data project determines the format, entity and staging behaviour. If you send a file that does not match the entity's field mapping, the call can still be accepted and the failure shows up later in staging or execution details.

**Code:**

POST https://yourenv.operations.dynamics.com/api/connector/enqueue/{activityId}?entity=Customers+V3
Authorization: Bearer <token>
Content-Type: text/xml  (or application/octet-stream for packages)

GET https://yourenv.operations.dynamics.com/api/connector/dequeue/{activityId}
Authorization: Bearer <token>

POST https://yourenv.operations.dynamics.com/api/connector/ack/{activityId}
Authorization: Bearer <token>
Body: the JSON returned by dequeue (CorrelationId, DownloadLocation, etc.)

### Authentication details

**Body:**

Use the client credentials flow against the Entra ID token endpoint with the resource set to your D365 base URL, with no trailing slash differences between what you request and what you call. A token issued for a different resource or tenant leads to 401 responses that look like a D365 problem but are an identity problem.

The application must also be listed in D365 under Microsoft Entra ID applications and mapped to a D365 user. A valid token for an application that D365 does not know yields an authorization failure. The mapped user needs security roles that grant access to the entities, because the integration runs as that user.

For production, prefer certificates or a managed secret store over long-lived client secrets, rotate them on a schedule, and keep separate app registrations for each environment so a test credential cannot reach production.

### Troubleshooting failures

**Body:**

A 401 or 403 almost always points to token or mapping problems: wrong resource, expired secret, or an application not registered in D365. A 404 on enqueue often means the activity ID is wrong or belongs to another environment, for example after a sandbox refresh where recurring jobs were recreated or restored with different IDs.

Messages that sit in Queued do not move without batch. Check that the Process recurring job messages batch is running and not withheld. If messages move to Failed, open the execution details to see the entity-level error, which is usually a mapping or validation issue.

If throttling is the problem, you may see HTTP 429 responses on high-volume enqueue calls. Slow the sender, batch records into packages rather than posting thousands of single-record files, and see the OData throttling guidance for the underlying priority-based limits.

## Pitfalls

- Treating a 200 response from enqueue as proof that records were imported.
- Using the wrong resource URL when requesting the token, producing 401 errors.
- Forgetting to register the application ID under Microsoft Entra ID applications in D365.
- Not calling ack after dequeue, so the same export file is returned repeatedly.
- Sending thousands of one-record files rather than a package, causing throttling.
- Copying an activity ID between environments after a refresh without verifying it.

## Ai Angle

An assistant grounded in the environment, such as ERPray in read-only mode, can summarize the state of a recurring job: which messages are queued, failed or processed, which entity errors repeat, and whether the batch job that consumes them is running. It shows the queries it used, and any change to the job definition stays a human decision.

## Faq

### What is the activity ID in the recurring integration URL?

**Answer:** It is the GUID assigned to the recurring data job when you save it. The connector uses it to route enqueue and dequeue calls to the right data project. You can see it on the recurring data job record in Data management.

### Should I use recurring integrations or the data package API?

**Answer:** Recurring integrations suit scheduled, queue-based exchange where you want D365 to manage messages. The package REST API suits on-demand import and export with explicit execution calls. Choose based on whether you need a managed queue or direct control over each run.

### Why does dequeue return nothing?

**Answer:** Nothing has been exported yet, or the export batch has not run. Check that the data project's recurring job is active and that its batch is processing. Previously dequeued messages not acknowledged may also be held until you call ack.

### Can I use OData instead?

**Answer:** Yes, for small, synchronous reads and writes. For bulk loads, file-based data management is more efficient and avoids OData request throttling limits, at the cost of asynchronous processing.

## Search terms

D365 recurring integration, api/connector/enqueue, dequeue ack D365, D365 data management REST, recurring data job activity ID, Entra ID application D365 integration, D365 import file API, D365FO integration endpoint

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
