Basic ID and field definitions for the QuickBooks Online Accounting API

Here are common IDs and data fields you may see during development. These appear frequently for various features and implementations.

Common fields
Common IDs
Realm ID

This identifies a unique, individual QuickBooks Online company file. We assign realm IDs when QuickBooks Online users create their company file.

Tip: Realm IDs and company IDs are the same number.

Realm IDs are specified in the URI of every API request. Here’s an example:

1
baseURL/company/1234/account

In this case, the realm ID is 1234.

At runtime, apps can retrieve realm IDs in the few ways:


Entity ID

This identifies individual instances of API entities such as an account, charge, or estimate. We assign this value to the entityID field.

To call entities by their entity ID, use the read operation and specify the entity ID in the URL. Use the following format and treat entity IDs as strings: baseURL/company/<realmId>/entityName/entityID.

Here’s an example:

1
baseURL/company/1234/customer/2123

In this case, the entity ID for this Customer entity is 2123.


Request ID

This identifies specific HTTP requests sent from apps to our servers. Request IDs let apps correlate requests and responses.

Request IDs are especially useful in cases where apps need to resend requests due to a dropped connection, or didn’t receive a response from the server.

We strongly recommend you use request IDs for requests that write, modify, or delete data. This guarantees idempotence. If our service receives another request with the same request ID, instead of performing the operation again or returning an error, it can recognize and send the same response for the original request. This prevents duplication.

Use query parameter requestid in the URI of requests to specify request IDs.

Here are a few things to keep in mind:

This example scenario demonstrates why request IDs are important:

  1. An app sends a request to create an invoice. It specifies “4957” for the request ID like this: baseURL/company/1234/invoice?requestid=4957
  2. Our service processes the request and sends a response.
  3. The app loses its connection and doesn’t receive a response.
  4. The app sends the same request again, specifying the same content and request ID.
  5. Our server already has the requestid. It can determine that the subsequent request is the same.
  6. Our server sends the same response as in step 2.
  7. The app receives the response and verifies it contains no errors.

If the app hadn’t specified a request ID, the server would create a duplicate invoice with a new entity ID.


Resource name

This is the name of the API entity, such as the account, customer, payments, or invoice entities. Learn more about QuickBooks Online Accounting API resources and entities.


DocNumber

Every transaction entity in the QuickBooks Online v3 API — Invoice, Payment, SalesReceipt, CreditMemo, Estimate, and others — includes a DocNumber field. This is the document number visible in the QuickBooks UI, for example “Invoice #1042”.

DocNumber is:

Note

Important

DocNumber is not a system-level idempotency key in the traditional sense. It does not silently return an existing record if you resend the same value. Understanding this distinction is critical for building reliable integrations.

What happens when you omit DocNumber on create

If you do not include DocNumber in a Create request, the platform follows this logic:

  1. Company has “Automatic Transaction Numbers” enabled (default for most companies): QuickBooks Online auto-assigns the next sequential number from that company’s counter. For example, if the last invoice was 1041, the new one gets 1042. Every Create request — including retried ones — gets a new unique number and creates a new transaction. There is no deduplication.
  2. Company has “Custom Transaction Numbers” enabled: DocNumber is left null. Every Create request creates a new transaction. No deduplication occurs.
Pattern 1: Always provide a stable, client-generated DocNumber

Generate a meaningful, stable DocNumber in your system before making the API call — for example, your internal order ID or invoice number.

1
2
3
4
5
POST /v3/company/{realmId}/invoice
{
  "DocNumber": "ORD-2024-98765",
  "Line": [...]
}
Pattern 2: Query before retry (the safe retry pattern)

Before retrying a failed Create, check whether the transaction already exists using a query:

1
GET /v3/company/{realmId}/query?query=SELECT * FROM Invoice WHERE DocNumber = 'ORD-2024-98765'

This is the most reliable way to implement idempotent behavior on top of the QuickBooks Online API.

Pattern 3: Use a prefixed, recognizable DocNumber scheme

Use a prefix that identifies your integration (for example, APP- or your app’s short name). This makes it easy to:

1
"DocNumber": "MYAPP-INV-20240315-001"