Skip to content

Postman docs › QuickBooks API (proxy) › Cleanup

Cleanup: deactivate test data ​

Folder 12 retires the name-list records that the run created: three items, the customer, the vendor and the test account. QuickBooks does not delete name-list records; "They're simply marked 'inactive.'" Deactivating (Active: false) is the supported way to retire them, and it is also how Odoo "archives" a product, customer or vendor.

The transactions are already gone by the time folder 12 runs. Each transaction folder deletes what it created:

FolderDeletes
7. InvoicesThe invoice (after voiding it)
8. Customer paymentsThe payment, then the invoice it paid
9. Credit memosThe credit memo
10. Bills & bill paymentsThe bill payment, then the bill
11. Pagination, filtering, CDC & batchThe batch credit memo (in batch 2), then the batch invoice

Business rules

  • Delete the customer's open invoices first. A customer with an open balance cannot be deactivated: the update fails with fault 6220 "Delete List Has Balance Error". Void or delete its open invoices before you deactivate it. This is why folders 7, 8 and 11 delete their invoices.
  • Each deactivation is a sparse update, so it needs the record's current SyncToken. Every pair in folder 12 reads the record first and stores its SyncToken in cleanup_sync_token, then sends the update.
  • Inactive records are left out of queries unless you ask for them: use where Active = false or Active IN (true, false).
  • Folder 3b's tax agency, tax code and tax rate cannot be removed: the API has no delete or deactivate for them. They stay in the company. See Tax.

Postman folder: 12. Cleanup (deactivate test data).

Run order ​

#Postman requestWhat it doesDetails
1Read service itemStores the service item's SyncTokenDeactivate an item
2Deactivate service itemActive: false on item_idDeactivate an item
3Read non-inventory itemStores the non-inventory item's SyncTokenDeactivate an item
4Deactivate non-inventory itemActive: false on noninventory_item_idDeactivate an item
5Read inventory itemStores the inventory item's SyncTokenDeactivate an item
6Deactivate inventory itemActive: false on inventory_item_idDeactivate an item
7Read customerStores the customer's SyncTokenDeactivate a customer
8Deactivate customerActive: false on customer_idDeactivate a customer
9Read vendorStores the vendor's SyncTokenDeactivate a vendor
10Deactivate vendorActive: false on vendor_idDeactivate a vendor
11Read test accountStores the test account's SyncTokenDeactivate an account
12Deactivate test accountActive: false on account_idDeactivate an account
13Query inactive test itemsLists this run's deactivated itemsbelow

Each deactivate request checks the HTTP status and that the returned record has Active false.

Request body (every deactivate request, with its own id variable)

json
{
  "Id": "{{customer_id}}",
  "SyncToken": "{{cleanup_sync_token}}",
  "sparse": true,
  "Active": false
}

Returns (abridged)

json
{
  "Customer": {
    "Id": "64",
    "SyncToken": "2",
    "Active": false
  },
  "time": "2026-12-01T02:30:00.000-08:00"
}

Errors

FaultWhenWhat to do
6220 "Delete List Has Balance Error"Deactivate customer while the customer still has an open balance, for example after a run that stopped before folder 7, 8 or 11 deleted its invoice.Delete or void the customer's open invoices (find them with 7. Invoices › Query invoices by customer), then read and deactivate again.
5010 Stale Object ErrorThe SyncToken is older than the record's current version.Send the matching Read … request again, then the deactivation.

Query inactive test items ​

Lists the items this run deactivated. Without Active = false, the query would leave them out. The test checks the HTTP status.

Request
Request URLGET{{base_url}}/api/v1/qbo/v3/company/{{realm_id}}/query?query=select * from Item where Active = false and Name LIKE 'QBOC-TEST {{run_id}}%25'
Intuit operationGET/v3/company/<realmID>/query?query=<selectStatement>
Acceptapplication/json
Postman12. Cleanup › Query inactive test items

Sample query (decoded)

text
select * from Item where Active = false and Name LIKE 'QBOC-TEST mi4x2k%'

Returns (abridged)

json
{
  "QueryResponse": {
    "Item": [
      { "Id": "31", "Name": "QBOC-TEST mi4x2k Service", "Active": false },
      { "Id": "32", "Name": "QBOC-TEST mi4x2k NonInventory", "Active": false },
      { "Id": "33", "Name": "QBOC-TEST mi4x2k Inventory", "Active": false }
    ],
    "startPosition": 1,
    "maxResults": 3
  },
  "time": "2026-12-01T02:33:00.000-08:00"
}

What stays in the company ​

  • The deactivated items, customer, vendor and account, named QBOC-TEST <run_id> …. Queries leave them out unless they ask for inactive records.
  • Folder 3b's tax agency, tax code and tax rate, if allow_permanent_tax_writes was true.