Has anyone been able to find a way to migrate from a production version of HubSpot to a Sandbox while retaining all record IDs? We have some internal systems that work with HubSpot, and since the data in the Sandbox does not retain the IDs from the production environments, we have to perform a lengthy backfill in our systems to update with the new sandbox IDs each time. Hoping someone has had a similar issue before and knows of a method or workaround to this.
Hey @AlanGrace - thanks for posting in the Community!
I’d like to tag in some Sandbox experts here for best practice(s) - @johnelmer, @HubSpot_Corey, and @ChristinaKay - any insight for @AlanGrace on how they may be able to migrate from production to sandbox while retaining all record ID’s?
Shane, Community Manager
Hi @AlanGrace
You can’t preserve HubSpot record IDs when copying data from Production to Sandbox. HubSpot generates new IDs on creation, and they’re immutable.
The recommended way to handle this is to keep a mapping layer between the original Production IDs and the new Sandbox IDs.
Many teams do this by exporting records with their recordId from Production, storing them in a reference table, and then re-importing to Sandbox while maintaining an external key that links the two. More details here:
(Understanding the CRM APIs - HubSpot docs )
(Import records for multiple objects )
If you have internal systems tied tightly to HubSpot IDs, one workaround is to switch them over to rely on your own stable external ID property (like “erp_id” or “legacy_id”). That way, refreshes to Sandbox don’t break the connections since HubSpot will regenerate its IDs but your systems can still reconcile dataa against the external key.
On a related note, some teams sidestep the re mapping problem by using a sync layer that keeps Production and Sandbox (or another database) aligned in real-time. A platform like Stacksync does exactly this: it maintains two-way consistency so even if HubSpot regenerates IDs in Sandbox, your own reference IDs and associations still flow across without manual backfills.
Hope this helps.