Get_batch_by_utk API - how to associate a utk with a contact in the response?



If I send 10 utk’s to Hubspot’s get_batch_by_utk API and retrieve 5 contacts back, how can I tell which contact belongs to which utk? I’d like to use this batch API to save requests but need to be able to associate the two.



we have the same issue and would love to be able to do 100x fewer calls to the api.


@ehynds @matgillen currently there isn’t a way to determine which UTK goes with which returned contact, though it may be something we can add to the response.

Can you tell me more about how you’re using that endpoint?


@dadams - thanks for the response.

we’re currently not using it because, as-is, its pretty useless as a means of looking up contacts. our interest in this is primarily for non-realtime lookups of anonymous site visits for reporting purposes. ideally, we would like to enhance our reporting data by potentially identifying more of the anonymous traffic visits using the utks we have in access logs.

in order for the endpoint to be useful, it needs to associate the passed-in utks with the resulting contacts in some way. for instance, the contact objects could have the utks in them as properties. or, the result object could be keyed on utks instead of vids, etc.



We lookup contacts when they first hit our page and cache the result. Any interactions the user does while on our page are sync’d to hubspot via the timeline API, keying off of the contact ID. We also have a cron that runs nightly which tries to lookup the unknown utk’s to see if they have become known (by submitting a lead form for example) and if they have, re-sync the activity that we weren’t able to sync earlier. We would like to do this refresh process in batch but have to do it one-by-one since the response doesn’t tell us which contact belongs to which utk.

We care if the visitor is known or unknown for internal reporting purposes. It also lets us cut down on the number of API calls to HubSpot if we have seen the utk before.

@dadams just curious, what use cases was the get_batch_by_utk API designed to solve?