Theme
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:
| Folder | Deletes |
|---|---|
| 7. Invoices | The invoice (after voiding it) |
| 8. Customer payments | The payment, then the invoice it paid |
| 9. Credit memos | The credit memo |
| 10. Bills & bill payments | The bill payment, then the bill |
| 11. Pagination, filtering, CDC & batch | The 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 itsSyncTokenincleanup_sync_token, then sends the update. - Inactive records are left out of queries unless you ask for them: use
where Active = falseorActive 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 request | What it does | Details |
|---|---|---|---|
| 1 | Read service item | Stores the service item's SyncToken | Deactivate an item |
| 2 | Deactivate service item | Active: false on item_id | Deactivate an item |
| 3 | Read non-inventory item | Stores the non-inventory item's SyncToken | Deactivate an item |
| 4 | Deactivate non-inventory item | Active: false on noninventory_item_id | Deactivate an item |
| 5 | Read inventory item | Stores the inventory item's SyncToken | Deactivate an item |
| 6 | Deactivate inventory item | Active: false on inventory_item_id | Deactivate an item |
| 7 | Read customer | Stores the customer's SyncToken | Deactivate a customer |
| 8 | Deactivate customer | Active: false on customer_id | Deactivate a customer |
| 9 | Read vendor | Stores the vendor's SyncToken | Deactivate a vendor |
| 10 | Deactivate vendor | Active: false on vendor_id | Deactivate a vendor |
| 11 | Read test account | Stores the test account's SyncToken | Deactivate an account |
| 12 | Deactivate test account | Active: false on account_id | Deactivate an account |
| 13 | Query inactive test items | Lists this run's deactivated items | below |
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
| Fault | When | What 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 Error | The 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 URL | GET{{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 operation | GET/v3/company/<realmID>/query?query=<selectStatement> |
| Accept | application/json |
| Postman | 12. 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_writeswastrue.