Hi all,
I’m running into an issue with the Square Catalog API (Upsert Catalog Object) in n8n.
Problem:
When I try to upsert an ITEM, I get this error:
Bad request - please check your parameters
Object version does not match latest database version.
The weird part is, I am using the latest version.
My flow looks like this:
My Flow:
- Webhook: receives the updated price, description, and other fields.
- Square API → Get Catalog Object: I use the item ID to pull the latest object, including its
version. - Square API → Upsert Catalog Object: I pass the object ID and the
versiondirectly from the previous step. - Square API still returns the version mismatch error.
Example of my Upsert body:
{
"idempotency_key": "upsert-{{ Math.floor(Math.random() * 10000000) }}",
"object": {
"type": "ITEM",
"id": "{{ $json.items[0].id }}",
"version": {{ $json.items[0].version }},
"present_at_all_locations": true,
"item_data": {
"name": "{{ $('Webhook').item.json.body['Service Name'] }}",
"description": "{{ $('Webhook').item.json.body['Sales Description'] }}",
"category_id": "{{ $('Webhook').item.json.body['Category ID - Square - Charleston'] }}",
"is_taxable": true,
"variations": [
{
"type": "ITEM_VARIATION",
"id": "{{ $json.items[0].item_data.variations[0].id }}",
"present_at_all_locations": true,
"item_variation_data": {
"item_id": "{{ $json.items[0].id }}",
"name": "Regular",
"sku": "{{ $('Webhook').item.json.body.SKU }}",
"pricing_type": "FIXED_PRICING",
"price_money": {
"amount": {{ $('Webhook').item.json.body['New Price'] }},
"currency": "USD"
}
}
}
]
}
}
}
What I checked:
- Confirmed the
versionvalue is correct by checking it directly in the Get Catalog Object response. - Verified that no other processes are modifying the item between the Get and the Upsert.
- Ensured the
idmatches the correct item, and thecategory_id,sku, and other fields are correct.
Question:
- Has anyone run into a version mismatch when the version is correct?
- Could n8n be caching a stale version somehow?
- Is there a better pattern for updating Square catalog objects reliably?
Any ideas would be appreciated!
Thanks ![]()
(sorry for the chat gpt layout that was the best way to put my problems into words haha)
