maesn
For developers

How to integrate with QuickBooks: From OAuth app to the first read and write

QuickBooks Online is integrated through a REST API that Intuit runs in a sandbox and in production. You register your own app, send each customer through OAuth 2.0 and receive the realm ID of the company they connected. This guide follows that path in order: environments, authentication, token lifetimes, the realm ID, reading, writing, rate limits, webhooks and the move to production.

Lennart Svensson, CTO and Co-Founder at maesn
Lennart Svensson
CTO and Co-Founder · · Updated
Illustration for How to Integrate with QuickBooks: OAuth App to First Request
The interface

The QuickBooks Online Accounting API in sandbox and production

The QuickBooks Online Accounting API is a REST API that exchanges JSON over HTTPS. Intuit runs it in two environments, the sandbox and production.

The sandbox is a QuickBooks Online company with sample data. You get one with your developer profile and can create up to 10. Each stays active for two years and is tied to the region chosen for it. Production is the environment of the live companies your customers connect.

The environments differ in the base URL, in the client ID and client secret, in the redirect URI registered for the app and in the webhook configuration. The request format is the same in both.

The two base URLs, and a request path that is the same in bothHTTP
Sandbox https://sandbox-quickbooks.api.intuit.com
Production https://quickbooks.api.intuit.com
 
GET /v3/company/<realmId>/customer/<entityId>?minorversion=75

The path contains the realm ID of the company, the name of the entity and the ID of the record. The parameter minorversion specifies the minor version of the schema.

Base URLs and the request format from Intuit’s guide to basic requests, the two sets of credentials from its credentials page, the sandbox figures from its sandbox guide and the two redirect URIs from its authorization FAQ, all checked 12 November 2026.

Intuit documents four URI formats for the basic operations. Create and update are both a POST to the resource. A single record is read with GET and its entity ID, and several records are read through the query endpoint. A delete is a POST with operation=delete appended to the URI.

Intuit groups its resources into categories, and two of them decide how a record is removed. List entities such as Account, Customer and Vendor are the lists that transactions refer to. They support a soft delete: an update sets the record to inactive. Transaction entities such as Invoice, Bill and Payment support a hard delete, which removes the record permanently.

Which of these objects can be read and written through maesn is listed on the QuickBooks API page.

Requests below minor version 75 receive version 75

Intuit ended support for minor versions 1 to 74 on 1 August 2025. A request that specifies a lower version receives version 75, and so does a request that specifies none. A lower value that is still set in existing code therefore has no effect.

The four URI formats from Intuit’s REST reference, the resource categories and delete rules from its API overview, the retirement date from its minor versions page, checked 12 November 2026.

Access

Authenticating with OAuth 2.0 and your own Intuit app

QuickBooks Online authenticates with the OAuth 2.0 authorization code flow. The app your customers connect is one you register yourself in the Intuit Developer Portal. It has a client ID and a client secret, and for accounting data it requests the scope com.intuit.quickbooks.accounting.

The flow has four steps. At the end your application holds an access token, a refresh token and the realm ID of the connected company.

The authorization code flowFour steps, three values to store
  1. 1

    Your application redirects the customer to Intuit

    client_idscoperedirect_uristate

    The redirect URI has to be one that is registered on your app.

  2. 2

    The customer grants access to one company

    Sign-in and consent take place on Intuit’s side.

  3. 3

    Intuit redirects to your redirect URI

    codestaterealmId

    The realm ID identifies the company the customer connected.

  4. 4

    Your server exchanges the code for tokens

    access_tokenrefresh_token

    One request to the token endpoint returns both tokens.

Store all three values together. The access token and the realm ID are part of every request, and the refresh token renews the access token.

The authorization code flow in four steps, with the parameters of each step.
The authorization request, and what comes back on the redirectHTTP
GET https://appcenter.intuit.com/connect/oauth2
?client_id=<clientId>
&response_type=code
&scope=com.intuit.quickbooks.accounting
&redirect_uri=https://app.example.com/callback
&state=<random value>
 
GET https://app.example.com/callback
?code=<authorization code>
&state=<random value>
&realmId=1231434565226279

The state value is returned unchanged, so you can match the response to the request you sent. The realmId is the ID of the company the customer connected.

The request that exchanges the authorization code for tokensHTTP
POST /oauth2/v1/tokens/bearer HTTP/1.1
Host: oauth.platform.intuit.com
Accept: application/json
Authorization: Basic <base64(client_id:client_secret)>
Content-Type: application/x-www-form-urlencoded
 
grant_type=authorization_code
&code=<authorization code>
&redirect_uri=https://app.example.com/callback

The Authorization header contains the client ID and the client secret, joined by a colon and Base64 encoded.

Send the exchange request once. Intuit’s guide says: “Only send one request to exchange the authorization code. Multiple requests may invalidate tokens.” After the exchange, every API request includes the access token as a bearer token in the Authorization header.

The scopes are fixed when the customer grants access. If you change the scopes of your app later, every customer has to go through the flow again.

Endpoints, parameters, both requests and the quotation from Intuit’s OAuth 2.0 guide, the scope rule from its authorization FAQ, checked 12 November 2026.

Access

How long access tokens and refresh tokens last

The token endpoint returns an access token and a refresh token. The access token is valid for 60 minutes. The refresh token is valid for 100 days, and that period starts again each time the token is used to obtain a new access token.

The lifetimes in the token response, in secondsJSON
{
"token_type": "bearer",
"access_token": "<access token>",
"expires_in": 3600,
"refresh_token": "<refresh token>",
"x_refresh_token_expires_in": 8640000,
"x_refresh_token_hard_expires_in": 157680000
}

expires_in is the lifetime of the access token, 60 minutes. x_refresh_token_expires_in corresponds to 100 days and x_refresh_token_hard_expires_in to five years. The third value is only returned when the request includes the header x-include-refresh-token-hard-expires-in: true.

When the access token has expired, your application sends a refresh request to the same endpoint.

The refresh requestHTTP
POST /oauth2/v1/tokens/bearer HTTP/1.1
Host: oauth.platform.intuit.com
Accept: application/json
Authorization: Basic <base64(client_id:client_secret)>
Content-Type: application/x-www-form-urlencoded
 
grant_type=refresh_token
&refresh_token=<latest refresh token>

The response has the same fields as the first token response, including a refresh token.

The refresh token itself is replaced at regular intervals. Intuit issues a new refresh token value every 24 hours, and its FAQ adds: “When you get a new refresh token, the previous refresh token value automatically expires.” Your application therefore stores the refresh token from each response and sends that one in the next refresh request.

One connection, four durationsFrom Intuit’s OAuth documentation
Access token
60 minutes
Sent as a bearer token with every request and renewed with the refresh token.
Refresh token value
24 hours
Intuit issues a new value, and the previous one expires.
Refresh token, rolling period
100 days
Starts again each time the token is used. After 100 days without use it expires.
Refresh token, hard limit
5 years
The remaining time is returned only on request. Afterwards the customer has to connect again.

Store the newest refresh token after every refresh. The value changes every 24 hours, and a refresh request with an old value fails. The five-year limit is the only duration you have to request explicitly.

The four durations that apply to one QuickBooks connection, all from Intuit’s OAuth documentation.
When the customer has to connect again

A connection ends when the customer disconnects your app, when the refresh token is not used for 100 days or when it reaches its hard limit of five years. The remaining time until that limit is returned in x_refresh_token_hard_expires_in, so you can ask a customer to reconnect before it is reached.

Field names, values, the refresh request and the optional header from Intuit’s OAuth 2.0 guide, the 24-hour change and the expiry cases from its authorization FAQ, checked 12 November 2026.

Access

What the realm ID is and why every request needs it

The realm ID is the unique identifier of one QuickBooks Online company. Intuit assigns it when the company is created, and QuickBooks users know the same number as their company ID.

Your application receives it during the authorization flow, as the realmId parameter on the redirect. The access token and the refresh token issued in that flow are valid for this company.

Every request needs it because every resource of the API sits below a company in the path. The URI starts with /v3/company/ followed by the realm ID, so a request without it has no valid address. Users commonly have several QuickBooks Online companies, each with a realm ID of its own. Store the realm ID together with the tokens issued for it.

The realm ID in a requestHTTP
GET /v3/company/1231434565226279/customer/2123 HTTP/1.1
Host: quickbooks.api.intuit.com
Authorization: Bearer <access token>
Accept: application/json

1231434565226279 is the realm ID, customer the entity and 2123 the entity ID. Intuit asks you to treat entity IDs as strings.

The realm ID is also the unit of Intuit’s request limits, and a webhook notification identifies the company in the field intuitaccountid.

Definition, origin and the path format from Intuit’s ID and field definitions, checked 12 November 2026. The same page states the rule in one sentence: “Realm IDs are specified in the URI of every API request.”

Data

Reading data with a SQL-like query language

A single record is read with GET and its entity ID. Several records are read with a query, which Intuit describes as “similar to a pared down SQL query select statement”. The statement is sent to the query endpoint of the company and selects from one entity.

The example reads the invoices dated after 1 August 2026, 100 per page.

One page of invoices, and the separate statement that returns the totalSQL
GET /v3/company/<realmId>/query?query=<statement>
 
SELECT * FROM Invoice
WHERE TxnDate > '2026-08-01'
STARTPOSITION 1 MAXRESULTS 100
 
SELECT COUNT(*) FROM Invoice WHERE TxnDate > '2026-08-01'

The statement is URL-encoded in the query parameter. For the second page STARTPOSITION is 101.

Pagination is part of the statement. STARTPOSITION is the position of the first record and MAXRESULTS the page size, which defaults to 100 and has a maximum of 1.000. The total number of records comes from a separate statement with COUNT(*).

The query operation does not support projections, OR in a WHERE clause, GROUP BY or JOIN, so data from two entities takes two queries. The ID field accepts only = and IN as operators. List entities are returned only while they are active, unless the statement filters on Active.

Syntax, the unsupported clauses, the ID field rule and both page sizes from Intuit’s page on query operations, checked 12 November 2026.

Data

Writing data with a SyncToken and a sparse update

A create and an update are the same request, a POST to the resource with the record as JSON. An update additionally contains the Id of the record and its current SyncToken.

The SyncToken is the version number of the record. QuickBooks increments it with every change and rejects an update with an older value, with error 5010, Stale Object. Each update therefore starts with a read that returns the current SyncToken.

An update is either full or sparse. A full update contains every writable field of the record as a read returns it, because Intuit’s reference states that “Writable fields omitted from the request body are set to NULL.” A sparse update is marked with "sparse": true and changes only the fields in the request.

A sparse update of one field, as Intuit documents itHTTP
POST /v3/company/<realmId>/customer HTTP/1.1
Host: quickbooks.api.intuit.com
Content-Type: application/json
 
{
"MiddleName": "Mark",
"SyncToken": "0",
"Id": "2",
"sparse": true
}

Id and SyncToken identify the record and its version. Without the last line the same body is a full update and sets every omitted writable field to NULL.

Names are another cause of rejected writes. DisplayName has to be unique across all Customer, Vendor and Employee records, and a duplicate is rejected with error 6240.

When a connection drops before the response arrives, the application cannot tell whether the write was applied. For this case Intuit provides the query parameter requestid, which makes a write idempotent: a request repeated with the same request ID returns the original response and creates no duplicate.

Your application generates the request ID, and it must be unique within the company.

SyncToken, both update forms, the name rule and the example from Intuit’s customer reference, the request ID from its ID and field definitions, both error codes from its error code list, checked 12 November 2026.

Limits

Rate limits per realm ID, per app and per month

QuickBooks applies several limits at the same time. Most are counted per realm ID, so each connected company has a limit of its own. The monthly quota is counted for your whole workspace, across all connected companies.

The limits that apply at the same time
LimitCounted against
500 requests per minuteOne realm ID
10 requests per secondOne realm ID and app
40 batch requests per minuteOne realm ID and app
30 payloadsOne batch request
120 seconds of execution timeOne request
500.000 CorePlus calls per monthOne workspace on the Builder tier

A throttled request returns HTTP 429, and Intuit’s instruction is to wait 60 seconds before retrying. Calls beyond the monthly CorePlus quota return a 429 as well. A batch request combines up to 30 operations in one call and has a limit of its own.

A 401 usually means that the access token has expired or was revoked. A 500 is a server error, and Intuit asks you to resubmit the request once.

Every figure from Intuit’s page on call limits and its batch reference, the status codes from its error code list, checked 12 November 2026.

Change notifications

How webhooks work, directly and through maesn

A webhook is a request QuickBooks sends to your application when data changes in a connected company. Webhooks are configured per app in the Intuit Developer Portal, separately for sandbox and production: an endpoint URL and the entities and operations you select. The configuration applies to every company connected to the app.

When a record changes, Intuit sends a POST to your endpoint. The body is a JSON array in the CloudEvents format, and each entry describes one change. According to Intuit’s configuration guide one array can contain changes for several companies, so a handler reads intuitaccountid for every entry.

The notification for an updated sales receipt, as Intuit documents itJSON
[
{
"specversion": "1.0",
"id": "…-SalesReceipt-150",
"source": "intuit.…",
"type": "qbo.salesreceipt.updated.v1",
"time": "2026-03-17T16:19:17Z",
"intuitentityid": "150",
"intuitaccountid": "9341455…"
}
]

The field type contains the entity and the operation, intuitentityid the ID of the record and intuitaccountid the company. Identifiers are shortened here, because Intuit masks them in its example.

The notification identifies the record that changed. The record itself is read with a second request. Some notifications include an additional data object, and its content depends on the entity and the operation.

Intuit expects your endpoint to return HTTP 200 within three seconds. To validate a notification, you hash the payload with HMAC-SHA256, using the verifier token of your app as the key, and compare the result with the intuit-signature header.

Intuit also recommends a change data capture call to recover notifications that were missed. The delivery rules, the retry sequence and that recovery call are the subject of our article on QuickBooks Online webhooks.

Configuration, validation and the multi-company array from Intuit’s guide to configuring webhooks, the payload from its data object page, the three seconds and the recovery call from its webhook best practices, checked 12 November 2026.

Through maesn a webhook reaches your application in a different form. The CloudEvents envelope, the varying data object and the per-entity naming reach your code as the same event you already handle for every other system.

Go-live

Moving from sandbox to production

Development credentials work only with sandbox companies. To connect a live company your app needs production credentials. Intuit’s guide to publishing an app lists every step, and these are the ones that take preparation:

  • The app details for production. They include your contact data, the URLs of your End User License Agreement and privacy policy, the host domain and the launch, disconnect and reconnect URLs.
  • A test of the OAuth flow. Intuit asks you to connect, disconnect and reconnect your app from a sandbox company before you go live.
  • The app assessment questionnaire. The production client ID and client secret become accessible once it is completed and approved.

With production credentials you switch the base URL, the client ID and client secret and the redirect URI, and you configure the production webhooks.

Offering an integration with QuickBooks means joining Intuit’s App Partner Program. Its tiers, fees and regional eligibility are covered in our QuickBooks partnership guide.

Steps and the approval rule from Intuit’s guide to publishing an app and its credentials page, checked 12 November 2026.

Where maesn fits

QuickBooks through maesn: What the Unified API handles for you

The sections above describe what a direct integration implements for one system. Through maesn you reach QuickBooks with the same REST API and the same data model as every other supported system, and these parts are handled on our side:

  • The realm ID and the tokens. The ID is resolved during authentication and added to every request, the access token is refreshed per connection and the latest refresh token is the one we keep.
  • The query statement and its paging clause. Statement construction and the paging with STARTPOSITION and MAXRESULTS sit behind one paged interface with page sizes of 5, 10, 20, 50 and 100.
  • The read before the write. We fetch the current record for the SyncToken QuickBooks requires on every update, so your write contains the version it expects.
  • One error shape. The QuickBooks errors, including the 429, arrive in one shape through unified error handling.
  • The entity names. Vendor reaches you as SUPPLIER and Purchase as EXPENSE, the names of the common data model.

What stays in your product is the app itself. The QuickBooks app is registered in your product’s name, and the entities and operations for webhooks are selected inside it. The app assessment questionnaire belongs to the app as well.

Accounting rules by country
FAQ

Frequently asked questions

Where do I find the QuickBooks realm ID?

On the redirect of the OAuth 2.0 flow. Intuit appends it as the realmId parameter, next to code and state, and also calls it the company ID. An app that signs users in with OpenID Connect finds it in the ID token as well. Store it with the tokens of that connection.

Why does a QuickBooks refresh token stop working after 24 hours?

Because Intuit changes the value of the refresh token every 24 hours, and the previous value expires when the new one is issued. The connection itself stays valid. A refresh request with an old value returns the error invalid_grant, so Intuit’s troubleshooting steps ask you to check that your code sends the latest value instead of a cached one.

What happens if I omit a field when updating a QuickBooks record?

In a full update it is set to NULL. Intuit’s reference states that a full update must include every writable field as returned by a read. A sparse update changes only the fields you send. Read-only fields behave differently: a value you supply is overwritten by QuickBooks, and no error is returned.

Which minor version does QuickBooks use if I do not send one?

Version 75. Support for minor versions 1 to 74 ended on 1 August 2025, and a request that specifies anything below 75 still receives version 75. Intuit released version 75 on 16 December 2024, and it includes the changes of every earlier minor version.

What does the QuickBooks error Stale Object mean?

Error 5010 means the update was sent for an outdated version of the record. Another change was saved after you read it, so its SyncToken has increased. Read the record again, apply your change to that version and repeat the update with the current SyncToken.

Can I delete a customer in QuickBooks?

A customer is deactivated, which Intuit calls a soft delete. Customers, vendors and accounts are list entities, and you deactivate one with an update that sets Active to false. References to an inactive record remain intact, and it can be reactivated later. Transaction entities such as invoices support a hard delete, which is permanent.

Build once on the Unified API.

A realm ID in every path, a refresh token that changes its value and a SyncToken on every update: that is the contract of one system, and the next system you connect has a different one. Through maesn you build against one interface for all of them.