Hi, I’ve been looking through the API for hubspot, specifically looking at the company object, and I’m having a hard time finding an endpoint with the capabilities i’m looking for. I’m looking to look up companies and get the associated contacts for the filtered entities. I understand that the API doesn’t support directly querying association properties from another object, and I’m trying to most efficiently find a way to get company + contact information where company’s creation date is after a certain time
Potential options:
company search: (POST: /crm/v3/objects/companies/search)
- Doesn’t allow for association returns (unless undocumented)
- Allows filtering
- Multiple companies returned
List company: (GET:/crm/v3/objects/companies)
- doesn’t allow filtering
- allows querying associations
- multiple companies returned
- (Is the after property persistent and able to be leveraged later, similar to a kafka cursor?)
Batch Query (POST: /crm/v3/objects/companies/batch/read)
- Allows querying by ID (perhaps by property, unclear what idProperty means)
- multiple companies returned
- Does not allow for association returns
Singular query (GET: /crm/v3/objects/companies/{companyId})
- Shows associations
- singular company returned
- requires multiple calls, one per company. Demanding on API call limit
Potential call combinations:
Search → looped singular query
- Requires N calls + N/100 where N is the number of results of search.
- getting contacts requires parsing associations, deduplicating, and making an additional M calls where M is the number of unique contacts found among N.
- If N is over 400, will take over 1 second to return due to rate limits
List → batch contact query
- Requires in-memory filtering, does NOT scale to large data sets.
- Requires N/100 calls to list, M/100 calls to batch query
- Not subject to limited search rate limit
- No filtering means this is only viable on small data sets.
Is there an approach I’m missing, or a parameter on one of these endpoints that will allow simultaneous filtering and association querying? Thanks in advance.
EDIT: Is the best way to handle this export companies (with filter) → parse export → batch query contact?