Production company synchronization – guidance on Batch APIs, rate limits, and caching
Hello HubSpot Support Team,
We are preparing a production synchronization of platform companies to HubSpot and would appreciate your recommendation on the safest API approach.
Our use case
- Initial synchronization of approximately 8,000–9,000 companies for Belgium.
- Other country portals will be processed afterward.
- After the initial migration, we will run smaller daily updates and single-company synchronization actions.
Synchronization flow
For each company, we:
- Search by the platform company hash.
- If no hash match exists, search by normalized Company Name + Street Address + Postal Code.
- Create or update the company.
- For customer companies, create/update their related leasing company.
- Associate the customer with the leasing company using the
Leasing bankassociation. - Set
platform_synchronization=trueonly after the required operations succeed.
Business-data conflicts are logged and not overwritten automatically.
Approaches being considered
Individual API calls
- Simpler to debug and retry.
- Easier to resume from a specific company.
- Requires more API requests and takes longer.
HubSpot Batch APIs
- Faster and requires fewer API requests.
- More complicated when only some records in a batch fail.
- Requires careful handling of retries, indexing delays, and associations.
Redis and caching
Our batch implementation uses Redis to:
- Lock leasing-company creation between queue workers.
- Temporarily share a leasing-company HubSpot ID between jobs.
- Prevent multiple workers from creating the same leasing company while HubSpot search indexing is delayed.
- Coordinate API rate limits.
During testing, we experienced this situation:
- A leasing company was created and its HubSpot ID was cached.
- The leasing company was manually deleted in HubSpot.
- Redis still contained the deleted ID.
- Customer association failed with:
COMPANY=<id> is not valid
We added recovery to remove the stale ID, recreate/find the leasing company, and retry the association once. However, we want to confirm the recommended production approach.
Other observations
- Newly created companies may not immediately appear in HubSpot search.
- Concurrent workers may search for the same leasing company before it is indexed.
- HubSpot hash searches appear case-insensitive, but our platform may contain distinct hashes that differ only by letter case.
- A batch request can partially succeed, requiring per-record error handling.
Questions
-
For an initial production migration of approximately 9,000 companies, do you recommend individual API calls or HubSpot Batch APIs?
-
What batch sizes and worker-concurrency limits do you recommend for company search, creation, update, and association?
-
Can we immediately associate a company using the ID returned by a batch-create response, or should we wait for HubSpot indexing?
-
What is the recommended way to prevent duplicate creation when a newly created company is not yet available through search?
-
Is caching HubSpot company IDs in Redis recommended? If yes, should we validate them before every association or only after receiving an invalid-ID error?
-
Can a HubSpot company ID become invalid due to deletion, archiving, or merging? Are webhooks available to notify us so we can invalidate our cache?
-
Are custom-property
EQandINsearches always case-insensitive? Is there a supported way to perform an exact case-sensitive hash match? -
What retry strategy do you recommend for partial batch failures, rate limits, timeouts, and temporary
5xxresponses? -
Can retrying a create request after a timeout create duplicates if HubSpot accepted the original request but the response did not reach us?
-
Would you recommend Batch APIs only for the initial migration and individual API calls for daily or single-record synchronization?
Our priority is data correctness and preventing duplicate, partially associated, or incorrectly marked successful records. Please suggest the safest production approach and any safeguards you recommend.