QuickBooks Online token API

Get a fresh access token for any connected company from your own scripts; SyncFreedom handles OAuth and refresh.

If you already have code that talks to the QuickBooks Online API, SyncFreedom can be just the OAuth layer. Create an API key under Dashboard → API keys with Allow writes checked, and send it as a bearer token. Write access is required because an Intuit access token can always write; a read-only key can list companies but not export tokens.

List companies

GET https://syncfreedom.com/api/v1/qbo/companies/
Authorization: Bearer sf_live_XXXXXXXX
{"companies": [{"realm_id": "4620816365170156840", "name": "Acme Hardware", "status": "connected"}]}

Get a token

GET https://syncfreedom.com/api/v1/qbo/companies/4620816365170156840/token/
Authorization: Bearer sf_live_XXXXXXXX
{
  "realm_id": "4620816365170156840",
  "access_token": "eyJ...",
  "expires_at": "2026-11-19T15:04:05Z",
  "base_url": "https://quickbooks.api.intuit.com",
  "minorversion": 75
}

The token is refreshed on your behalf when it has less than five minutes left. Cache it until expires_at and call again. Never ask for the refresh token; SyncFreedom holds it so that rotation stays consistent across your scripts and the MCP server.

Python example with python-quickbooks

import requests
from quickbooks import QuickBooks
from intuitlib.client import AuthClient

key = "sf_live_XXXXXXXX"
realm = "4620816365170156840"
token = requests.get(
    f"https://syncfreedom.com/api/v1/qbo/companies/{realm}/token/",
    headers={"Authorization": f"Bearer {key}"},
).json()

auth_client = AuthClient(client_id="", client_secret="", redirect_uri="", environment="production",
                         access_token=token["access_token"])
client = QuickBooks(auth_client=auth_client, company_id=realm, minorversion=token["minorversion"])

Status codes

  • 401: missing or revoked key.
  • 402: subscription inactive.
  • 403: the key is read-only. Create one with Allow writes checked.
  • 404: realm not connected under your account.
  • 409: the company needs re-authorization in the dashboard.
  • 503: Intuit could not refresh the token just now. Retry after the Retry-After seconds; the connection is not affected.

Python: syncfreedom-lib

The syncfreedom Python package (syncfreedom-lib 1.x) keeps working. It signs in with your SyncFreedom email as the username and your password:

[SYNCFREEDOM_CREDENTIALS]
username = you@example.com
password = your_syncfreedom_password
from syncfreedom.client import SyncFreedomQuickBooks
from quickbooks.objects.customer import Customer

qb = SyncFreedomQuickBooks(company_id="4620816365170156840", credentials=credentials)
customers = Customer.all(qb=qb)

Each token it receives is good for at least 30 minutes. SyncFreedom refreshes connections itself, so the library's refresh_token field holds a placeholder rather than Intuit's refresh token; for longer jobs, create a new SyncFreedomQuickBooks when the token is about to expire.

After 10 wrong passwords for one email from one network within 15 minutes, sign-ins for that email from that network are paused for up to 15 minutes (HTTP 429 with Retry-After). Correct sign-ins never count toward the limit.

View as Markdown