> This page is for Agent Handler.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.merge.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.merge.dev/_mcp/server.

# Microsoft Dynamics 365 Business Central

**Authentication:** OAuth or access token. See [Magic Link](/merge-agent-handler/features/magic-link) for the runtime auth flow, or [Application credentials](/merge-agent-handler/admin-setup/add-oauth-credentials) to bring your own OAuth app.

## Sample use cases

* Create a sales order for customer `C00010` and ship and invoice it once it is picked
* List unposted purchase invoices from vendor `Fabrikam Inc.` and post the approved ones
* Add a general journal line for a month-end accrual and post the journal

## Available Tools

#### list_customers

List customers in a Business Central company. Use list_companies to find company_id. Supports OData $filter, $select...

#### get_customer

Get one customer by its GUID, including its '@odata.etag' for safe updates. Use list_customers to find customer_id.

#### create_customer

Create a customer. Only the name is required. Note the API cannot set Customer Posting Group, so a customer created...

#### update_customer

Update fields on an existing customer. Only the supplied fields change. Pass the etag from get_customer to fail...

#### delete_customer

Delete a customer. Business Central refuses this if the customer has ledger entries or open documents, which is...

#### list_companies

List the companies in the connected Business Central environment. Run this first: every other tool needs a...

#### list_entities

List the API entity sets this Business Central environment exposes, such as customers or salesInvoices. Use it to...

#### discover_entity_metadata

Inspect one entity set's fields and expandable relations by sampling a real record. Use before building a \$filter...

#### list_accounts

List the chart of accounts for a company. Only accounts whose account_type is 'Posting' can take journal entries...

#### get_account

Get one general ledger account by GUID, including its category, type and net change. Use list_accounts to find...

#### list_journals

List general journal batches in a company. A batch holds unposted journal lines until post_journal commits them. Use...

#### list_journal_lines

List the unposted lines in one journal batch. A journal GUID is required because Business Central cannot list...

#### create_journal_line

Add an unposted line to a journal batch. A positive amount debits the account and a negative amount credits it. The...

#### update_journal_line

Update an unposted journal line. Only the supplied fields change, and only while the line is unposted. Pass the etag...

#### delete_journal_line

Delete an unposted journal line. A posted entry cannot be deleted; it has to be reversed with a balancing entry...

#### post_journal

Post every line in a journal batch to the general ledger at once. The batch must balance, so debits and credits have...

#### list_payment_journals

List customer or vendor payment journal batches, selected with the party parameter. Use this to find journal_id for...

#### list_payments

List customer or vendor payment lines from one payment journal batch, selected with the party parameter. A journal...

#### list_records

List records from any Business Central entity set, for entities with no dedicated tool such as salesQuotes or...

#### get_record

Get one record by GUID from any Business Central entity set, including its '@odata.etag' for safe updates. Use...

#### create_record

Create a record in any Business Central entity set. Use discover_entity_metadata on the entity set first to see...

#### update_record

Update a record in any Business Central entity set. Only the supplied fields change. Pass the etag from get_record...

#### delete_record

Delete a record from any Business Central entity set. Business Central refuses this for records with ledger entries...

#### list_items

List items in a Business Central company. Use list_companies to find company_id. Supports OData $filter, $select and...

#### get_item

Get one item by its GUID, including its '@odata.etag' for safe updates. Use list_items to find item_id.

#### create_item

Create an item in a Business Central company. Only the name is required; pass any other writable field via 'fields'...

#### update_item

Update fields on an existing item. Only the supplied fields change. Pass the etag from get_item to fail safely if...

#### delete_item

Delete an item. Business Central refuses this if the item has ledger entries or appears on open documents, which is...

#### list_purchase_orders

List purchase orders in a Business Central company. Use list_companies to find company_id and list_vendors to filter...

#### get_purchase_order

Get one purchase order header by GUID, including its '@odata.etag' for safe updates. Use list_purchase_order_lines...

#### create_purchase_order

Create a purchase order header. Lines are added separately with create_purchase_order_line, because Business Central...

#### update_purchase_order

Update header fields on a purchase order. Only the supplied fields change. Pass the etag from get_purchase_order to...

#### delete_purchase_order

Delete a purchase order and its lines. Only unreceived orders can be deleted; once received and invoiced the...

#### list_purchase_order_lines

List the lines on one purchase order. A purchase order GUID is required because Business Central cannot list order...

#### create_purchase_order_line

Add a line to a purchase order. Pass item_id when line_type is 'Item' and account_id when it is 'Account'. Note an...

#### receive_and_invoice_purchase_order

Receive and invoice a purchase order, creating posted receipt and invoice documents. Cannot be undone. Business...

#### list_purchase_invoices

List purchase invoices in a Business Central company. Supports OData $filter, $select and \$orderby; filter on status...

#### get_purchase_invoice

Get one purchase invoice header by GUID, including its '@odata.etag' for safe updates. Use...

#### create_purchase_invoice

Create a draft purchase invoice header. Lines are added separately with create_purchase_invoice_line. Set...

#### update_purchase_invoice

Update header fields on a draft purchase invoice. Only the supplied fields change. A posted invoice can no longer be...

#### delete_purchase_invoice

Delete a draft purchase invoice and its lines. A posted invoice cannot be deleted because it is in the general...

#### list_purchase_invoice_lines

List the lines on one purchase invoice. An invoice GUID is required because Business Central cannot list invoice...

#### create_purchase_invoice_line

Add a line to a draft purchase invoice. Pass item_id when line_type is 'Item' and account_id when it is 'Account'...

#### post_purchase_invoice

Post a draft purchase invoice to the general ledger. Posting renumbers the document and it can no longer be edited...

#### list_sales_invoices

List sales invoices in a Business Central company. Supports OData $filter, $select and \$orderby; filter on status to...

#### get_sales_invoice

Get one sales invoice header by GUID, including its '@odata.etag' for safe updates. Use list_sales_invoice_lines to...

#### create_sales_invoice

Create a draft sales invoice header. Lines are added separately with create_sales_invoice_line, because Business...

#### update_sales_invoice

Update header fields on a draft sales invoice. Only the supplied fields change. A posted invoice can no longer be...

#### delete_sales_invoice

Delete a draft sales invoice and its lines. A posted invoice cannot be deleted because it is in the general ledger...

#### list_sales_invoice_lines

List the lines on one sales invoice. An invoice GUID is required because Business Central cannot list invoice lines...

#### create_sales_invoice_line

Add a line to a draft sales invoice. Pass item_id when line_type is 'Item' and account_id when it is 'Account'. Use...

#### post_sales_invoice

Post a draft sales invoice to the general ledger. Posting renumbers the document, e.g. S-INV102311 becomes...

#### post_and_send_sales_invoice

Post a draft sales invoice and email it to the customer in one step. Use post_sales_invoice when the invoice should...

#### cancel_sales_invoice

Cancel a posted sales invoice by issuing a corrective credit memo. This is how a posted invoice is reversed, since...

#### list_sales_orders

List sales orders in a Business Central company. Use list_companies to find company_id. Supports OData \$filter...

#### get_sales_order

Get one sales order header by GUID, including its '@odata.etag' for safe updates. Use list_sales_order_lines to read...

#### create_sales_order

Create a sales order header. Lines are added separately with create_sales_order_line, because Business Central does...

#### update_sales_order

Update header fields on a sales order. Only the supplied fields change. Pass the etag from get_sales_order to fail...

#### delete_sales_order

Delete a sales order and its lines. Only unposted orders can be deleted; once shipped and invoiced the document is...

#### list_sales_order_lines

List the lines on one sales order. A sales order GUID is required because Business Central cannot list order lines...

#### create_sales_order_line

Add a line to a sales order. Pass item_id when line_type is 'Item' and account_id when it is 'Account'. Use...

#### ship_and_invoice_sales_order

Ship and invoice a sales order, creating posted shipment and invoice documents in the ledger. This cannot be undone...

#### list_vendors

List vendors in a Business Central company. Use list_companies to find company_id. Supports OData $filter, $select...

#### get_vendor

Get one vendor by its GUID, including its '@odata.etag' for safe updates. Use list_vendors to find vendor_id.

#### create_vendor

Create a vendor in a Business Central company. Only the name is required; pass any other writable field via...

#### update_vendor

Update fields on an existing vendor. Only the supplied fields change. Pass the etag from get_vendor to fail safely...

#### delete_vendor

Delete a vendor. Business Central refuses this if the vendor has ledger entries or open documents, which is expected...