How to fetch expense data from QuickBooks API with Python
Learn how to fetch expense data from the QuickBooks API using Python. This guide covers prerequisites, endpoints, step-by-step implementation, common pitfalls, and FAQs
Not just QuickBooks tools: Knit runs each call. It handles the QuickBooks sign-in, refreshes the token, retries failures and paces requests to QuickBooks's rate limits. No signup: 2,000 free calls over 30 days.
Opens Claude with Knit filled in: click Continue. Claude web and desktop share one connector list. Or paste this link in Settings > Connectors > Add custom connector.
curl -fsSL https://raw.githubusercontent.com/knitapi/knit-plugin/main/plugins/knit/skills/knit/scripts/install.sh | bash -s -- --agents claude
Run in your own terminal, then restart Claude Code. Adds the server, the Knit skill and a CLAUDE.md note.
Turn on developer mode, then create a connector named Knit with this link and No Auth.
curl -fsSL https://raw.githubusercontent.com/knitapi/knit-plugin/main/plugins/knit/skills/knit/scripts/install.sh | bash -s -- --agents codex
Run in your own terminal (not through Codex), then start a new Codex session.
curl -fsSL https://raw.githubusercontent.com/knitapi/knit-plugin/main/plugins/knit/skills/knit/scripts/install.sh | bash -s -- --agents antigravity
Run in your own terminal, then reload MCP servers (/mcp in the CLI, refresh in the IDE).
curl -fsSL https://raw.githubusercontent.com/knitapi/knit-plugin/main/plugins/knit/skills/knit/scripts/install.sh | bash -s -- --agents cursor
Run in your own terminal, restart Cursor, then paste the note it prints into User Rules.
Your agent asks for something in QuickBooks, in plain language.
Knit picks the QuickBooks endpoint, prebuilt tool or not, and builds the request.
The QuickBooks account owner signs in once through a Knit link. Knit keeps the tokens.
Knit refreshes the token, retries failures and paces calls to QuickBooks's rate limits.
The QuickBooks data, or QuickBooks's error as data the agent can read.
Who handles each step of that call.
| Step | The job | Tools-only QuickBooks server | Knit |
|---|---|---|---|
| 02 | An endpoint with no tool | Not covered | Knit finds it |
| 03 | QuickBooks sign-in | You set it up | Knit sends a link |
| 04 | Token refresh | Varies | Knit |
| 04 | QuickBooks rate limits | You, or the agent | Knit paces + retries |
| — | Other apps your agent needs | Another server each | Same connection |
| — | The call as code | You write it | Knit returns the curl |
Under the hood
Your agent calls a small set of Knit MCP tools; Knit runs the hard part underneath each one.
The exact QuickBooks request to make, prebuilt tool or not.
A link the QuickBooks account owner opens once. Reuse connections you already have.
Runs the request against the connected QuickBooks account. QuickBooks's errors come back as data the agent can read.
Options on execute_api that return the exact QuickBooks request as curl.
Request a sync between QuickBooks and another app, and track it.
For AI agentsTo read or change QuickBooks data, use Knit's MCP server at https://integrations.getknit.dev/mcp: list_supported_apps → find_apis_for_use_case → create_integration_link → execute_api. Knit handles QuickBooks sign-in, token refresh, retries and rate limits.
Ready-made QuickBooks actions, plus any other endpoint Knit finds in QuickBooks's API docs.
This API endpoint allows the creation of a payment in the accounting system. It supports various applications such as Xero, Zohobooks, Microsoft Dynamics 365, Sage Intacct, Quickbooks, Netsuite, and Freshbooks. The request requires headers specifying 'accept' and 'content-type' as 'application/json'. The body must include 'accountId', 'contactId', 'amount', 'invoiceId', 'paymentLinkedTo', and 'linkedInvoices'. Optional fields include 'date', 'description', 'currency', 'exchangeRate', and 'metaData'. The response returns a success status and the 'paymentId' if successful, or an error message if failed.
The Create Accounting Expense API allows users to create a new expense record in the accounting system. The request requires a transaction date, total amount, and line items as mandatory fields. Optional fields include employee ID, contact ID, company ID, description, currency, and metadata. The response returns a success status and the ID of the created expense if successful, or an error message if the request fails.
This API endpoint allows the creation of an accounting account. It supports various applications like Xero, Zohobooks, Microsoft Dynamics 365, Sage Intacct, Quickbooks, Netsuite, and Freshbooks. The request requires a JSON body with 'name' and 'category' as mandatory fields. The 'category' can be either 'BANK_ACCOUNT' or 'LEDGER_ACCOUNT'. Additional optional fields include 'type', 'subType', 'accountCode', 'accountNumber', 'description', and 'metaData'. The response returns a success status and the unique 'accountId' of the created account. In case of an error, a descriptive error message is provided.
This API endpoint allows the creation of a journal entry with specified details. The request must include headers specifying 'accept' and 'content-type' as 'application/json'. The body of the request requires 'date', 'lineItems', and 'description' as mandatory fields. 'lineItems' is an array of objects, each containing 'accountId', 'amount', 'notes', 'transactionType', 'contactType', and 'contactId'. Optional fields include 'currency', 'referenceNumber', and 'metaData'. The response returns a success status and a 'journalId' if successful, or an error message if unsuccessful.
This API endpoint retrieves tracking categories used for financial reporting purposes. It supports various applications such as Xero, Microsoft Dynamics 365, Quickbooks, Netsuite, and Freshbooks. The request requires an 'accept' header with 'application/json' and optionally a 'categoryId' query parameter to specify a particular tracking category. The response includes a success flag and data containing an array of tracking categories with details such as id, name, creation and update timestamps, category type, status, description, and parent category information.
This API endpoint retrieves tax rates from an accounting application. It supports various apps such as Xero, Zohobooks, Microsoft Dynamics 365, Sage Intacct, Quickbooks, Netsuite, and Freshbooks. The API method is GET, and it requires an 'accept' header with 'application/json'. Optionally, a 'taxRateId' can be provided as a query parameter to fetch details of a specific tax rate. The response includes a success flag, and if successful, a list of tax rates with details such as id, name, code, type, creation and update timestamps, status, description, effective and total tax rates, and components. In case of an error, an error message is returned.
The Update Accounting Invoice API allows users to update an existing invoice in various supported applications such as Xero, Zohobooks, Microsoft Dynamics 365, Sage Intacct, Quickbooks, Netsuite, and Freshbooks. The API requires a POST request with headers specifying 'accept' and 'content-type' as 'application/json'. The request body must include 'type', 'invoiceId', 'contactId', and 'lineItems'. Additional optional fields include 'invoiceNumber', 'status', 'issueDate', 'dueDate', 'paidOnDate', 'currency', 'exchangeRate', 'description', 'totalAmount', 'totalTax', 'totalDiscount', and 'metaData'. The response will indicate success or failure, with a success response containing a 'success' boolean and a failure response containing an 'error' object with a descriptive message.
This API endpoint allows the creation of a new accounting contact. The request requires a POST method to the specified URL with headers indicating 'accept' and 'content-type' as 'application/json'. The request body must include 'name' and 'contactType' as required fields, with optional fields such as 'contactPersonFirstName', 'contactPersonLastName', 'email', 'phoneNumber', 'taxNumber', 'addresses', and 'metaData'. The response will return a success status with a 'contactId' if successful, or an error message if unsuccessful.
This API endpoint allows you to retrieve basic information about companies related to your accounting app. It supports various apps such as Xero, Zohobooks, Microsoft Dynamics 365, Quickbooks, Freshbooks, and Netsuite. The request is made using the GET method and requires an 'accept' header with 'application/json'. You can optionally provide a 'companyId' as a query parameter to fetch details for a specific company. The response includes a success flag and data containing an array of company details such as id, name, legal name, tax number, fiscal year start month and day, creation date, active status, currency, URLs, addresses, phone numbers, and contact information.
The Update Payment Details API allows updating payment information linked to invoices or bills. It requires parameters such as paymentId, accountId, contactId, amount, invoiceId, and paymentLinkedTo. Optional fields include date, description, currency, exchangeRate, linkedInvoices, and metaData. The response indicates success or failure with an optional error message.
The Create Accounting Invoice API allows users to create an invoice or bill in the accounting system. The request requires a JSON body with the type of document (INVOICE or BILL), a contact ID, and at least one line item. Additional optional fields include status, invoice number, issue date, due date, paid on date, currency, exchange rate, description, total amount, total tax, total discount, and metadata. The response returns a success status and the created invoice ID if successful, or an error message if the request fails.
The Get Accounting Items API allows customers to retrieve records of products and services they buy and sell. It supports various applications such as Xero, Zohobooks, Microsoft Dynamics 365, Quickbooks, Netsuite, and Freshbooks. The API accepts a query parameter 'itemId' to fetch details of a specific item. The response includes details such as item ID, name, code, type, creation and update timestamps, status, description, total quantity, unit price, sales details, and purchase details. In case of an error, a descriptive error message is returned.
The Update Accounting Account API allows users to update details of an existing accounting account. The API requires the accountId and category as mandatory fields in the request body. The category can be either BANK_ACCOUNT or LEDGER_ACCOUNT. The API supports various accounting applications such as Xero, Zohobooks, Microsoft Dynamics 365, Sage Intacct, Quickbooks, Netsuite, and Freshbooks. The response indicates whether the update was successful or not, and in case of an error, a descriptive message is provided.
The Update Accounting Contact API allows users to update contact information in supported accounting applications such as Xero, Zohobooks, Microsoft Dynamics 365, Sage Intacct, Quickbooks, Netsuite, and Freshbooks. The API requires a POST request with headers specifying 'accept' and 'content-type' as 'application/json'. The request body must include 'name', 'contactType', and 'contactId' as required fields, along with optional fields such as 'contactPersonFirstName', 'contactPersonLastName', 'email', 'phoneNumber', 'taxNumber', 'addresses', and 'metaData'. The response will indicate success with a boolean and may include additional data or an error message if applicable.
Ask in plain language. Knit picks the QuickBooks endpoint from its API docs, prebuilt tool or not.
See how teams put QuickBooks to work as part of a bigger workflow.
Connect your AR/AP automation platform to QuickBooks, Xero, NetSuite, Sage, and 12+ accounting and ERP systems. Enable your…
Connect your FP&A platform to Oracle, SAP, Microsoft Dynamics, and 100+ ERPs and data sources. Enable finance teams…
Pull credit scores/KYC data, import borrower bank statements, and push repayment schedules into accounting alongside chart-of-accounts and AP/AR…
See how leading technology firms are scaling their operations
Amazing Product With Exceptional Support from the team. By using Knit we managed to speed up our development by orders of magnitude.
A brilliant tool to let you seamlessly integrate with many different systems. It is very easy to integrate with and customer support is next level.
Seamless integration experience. Well-documented, self-explanatory APIs, and excellent service and support.
Easy to integrate. Knit's dashboard is intuitive for setting up and testing integrations, and the sandbox is extremely useful during development.
Knit shipped a brand-new Timesheet API in a week and handed us a ready-to-use NetSuite sandbox. That velocity is priceless when you're running payroll in 40+ countries.
Click Add to Claude on this page and confirm in Claude, or copy the one-line command or link for ChatGPT, Cursor, Codex, Claude Code and other agents. There's no signup: the first call starts a free trial of 2,000 calls over 30 days. When your agent first needs QuickBooks, it gives you a link to connect your QuickBooks account.
Knit. The QuickBooks account owner connects through a Knit link; your agent only sees an integration ID.
Knit paces requests and retries failed calls. If QuickBooks still refuses, the agent gets the error as data.
Yes. Ask for the request and Knit returns the exact curl, with the same managed sign-in.
Yes. The Knit connection isn't tied to one app: the same server gives your agent QuickBooks and 155 apps in all, so you add it once.
Yes, within what the connected QuickBooks account is allowed to do. Knit runs the QuickBooks API call your agent asks for, reads and writes alike.
Yes. Any MCP client can connect, whichever model drives the agent.
Learn how to fetch expense data from the QuickBooks API using Python. This guide covers prerequisites, endpoints, step-by-step implementation, common pitfalls, and FAQs
Learn about the common Quickbooks API endpoints to build you Quickbooks integration
The QuickBooks Online API uses OAuth 2.0 via Intuit. Covers app registration, token flow, key entities (invoices, customers, payments), webhooks, and rate limit handling.