There's a new version of the HubSpot API

As of November 30, 2022, HubSpot API keys are no longer a supported authentication method for accessing HubSpot APIs. Instead, you should use a private app access token or OAuth to authenticate API calls. Learn more about this change and how to migrate an API key integration to use a private app instead.

Get a batch of contacts by user token

Last updated May 12, 2023

GET /contacts/v1/contact/byUtk/batch/

Method Details

HTTP Methods:

GET

Response Format:

json

Requires Authentication?

Yes

Rate Limited?

Yes

Headers

User-Agent

Products:

Marketing & CRM

Required Scope:

crm.objects.contacts.read

This endpoint should be used instead of the older version. That version did not correlate the returned contacts with their Utks. This endpoint does that by using the contact's Utk as the object key.

For a given account, return information about a group of contacts by their user tokens. A visitor's user token is stored in the hubspotutk cookie. This cookie is created automatically by the HubSpot tracking code.

The endpoint accepts many query parameters that allow for customization based on a variety of integration use cases. By default, this endpoint will not return the history for properties, only the current value of any populated properties, but you can include the history using the parameters listed below.

Requests should be limited to 100 records in a single request.

Required Parameters How to use Description
OAuth access token or private app access token Authorization: Bearer {token} header Used to authenticate the request. Please see this page for more details about authentication.
Contact user token &utk=x
Used in the request URL
Each user token requires it's own query parameter (utk=xxx&utk=yyy). Requests should be limited to 100 or fewer user tokens. Any user tokens that are provided that are not associated with a contact record will be ignored.
Optional Parameters How to use Description
Property &property=x Specify the properties that should be returned for each ID. By default, the endpoint returns all valued properties for a contact. If this parameter is used, only the specified property or properties will be included.
Property Mode &propertyMode=x One of “value_only” or “value_and_history” to specify if the current value for a property should be fetched, or the value and all the historical values for that property. Default is “value_only”.
Form Submission Mode &formSubmissionMode=x One of “all”, “none”, “newest”, “oldest” to specify which form submissions should be fetched. Default is “newest”.
List Memberships &showListMemberships=x Boolean "true" or "false" to indicate whether current list memberships should be fetched for the contact. Default is false.
Include Deleted Contacts &includeDeletes=x Boolean true or false to indicate whether the return of deleted contacts is desired. Default is false.

Example URL:  https://api.hubapi.com/contacts/v1/contact/byUtk/batch/?utk=ea02a4db247fdc4c97e350a0d2124174&utk=6084e7de6a2b6f11f31d976090c49841