> This page is for Unified.

> 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.

# Analyze spend

> How to aggregate and analyze spend from bills, expenses, and journal entries using the Merge Accounting API.

---

#### User authorizes access

Your user authorizes your application to access their accounting service (e.g., QuickBooks Online, NetSuite) via an OAuth or similar authorization flow through Merge Link.

#### Retrieve your user's accounting configuration data

The following steps will cover the business logic you will need to configure in your backend to interact with Merge's Unified API.
"Settings" or "Master" data refers to all information related to vendors, accounts, and (in some cases) tracking categories. To do this, we will access four endpoints:

* Sync your customer's chart of accounts by using the [**GET** /accounts](https://docs.merge.dev/accounting/accounts/#accounts_list) endpoint. You can use the `classification` and `parent_account` fields to compile account types and hierarchy!
* Follow the steps outlined in the [Sync Customers or Suppliers use case](https://docs.merge.dev/use-cases/sync-customers-or-suppliers/) to sync vendors in your system with the third party.
* If your customer has classes, locations, or departments configured, you can retrieve them from the accounting platform with [**GET** /Tracking Categories](https://docs.merge.dev/accounting/tracking-categories/#tracking_categories_list).
* Utilize the [**GET** /items](https://docs.merge.dev/accounting/items/#items_list) endpoint to pull in your customer's products, goods, and services.

#### Retrieve your customer's spend transactions

Retrieve all transactions in your customer's ERP/Accounting platform related to spend by compiling data from the below endpoints:

* Use the [**GET** /invoices](https://docs.merge.dev/accounting/invoices) endpoint to access all bills, and set the `type` query param = `ACCOUNTS_PAYABLE` to filter to only bills.
* Use the [**GET** /payments](https://docs.merge.dev/accounting/payments/#payments_list) endpoint to access all payments related to bills.
* Use the [**GET** /expenses](https://docs.merge.dev/accounting/expenses/#expenses_list) endpoint to access any direct purchases your customer makes, such as a credit card transaction or check purchase.
* In some cases, your customer may record purchases as direct entries against the ledger. You should utilize the [**GET** /journal-entries](https://docs.merge.dev/accounting/journal-entries/#journal_entries_list) endpoint to retrieve these transactions.
* (Optional) You can optionally pull in purchase orders to your application through the [**GET** /Purchase-Orders](https://docs.merge.dev/accounting/purchase-orders/#purchase_orders_list) endpoint.

#### Compile spend in your application

Using the transactions retrieved in the prior step, you'll be able to paint a full picture of your customer's spend. You'll be able to aggregate by Date, General Ledger Account, Vendor, Class, Department, Location, and more.

#### Refresh data regularly

After the initial pull of data, you'll need to keep your data up to date by regularly fetching data from Merge. The `modified_after` query parameter can be utilized on all of Merge's **GET** endpoints to keep these subsequent processes more efficient. For a full overview of Merge's syncing best practices, see our guide [here](/merge-unified/reading-data/syncing-best-practices)!

> **Note**
>
> [Webhooks](/merge-unified/reading-data/webhooks/merge-webhooks) can be utilized to make this process more efficient.

* [Webhooks](/merge-unified/reading-data/webhooks/merge-webhooks)

\
\