There's a new version of the HubSpot API

As of November 30, 2022, HubSpot API Keys are being deprecated and are no longer supported. Continued use of HubSpot API Keys is a security risk to your account and data. Your API Keys could be deactivated at any time after Nov. 30th, and we recommend that you migrate to Private Apps as soon as possible so you do not lose business-critical functionality.

Using OAuth 2.0 access tokens

OAuth 2.0 access tokens are provided as a bearer token in the Authorization HTTP header.

  • HubSpot access tokens will fluctuate in size as we change the information that is encoded the tokens. We recommend allowing for tokens to be up to 300 characters to account for any changes we may make.
  • If you're using OAuth 2.0 access tokens, you should not include hapikey= in the request URL. The Authorization header is used in place of that query parameter.

The header format is:

Authorization: Bearer {token}

Here's an example that using cURL to get contacts with the Authorization header, including an access token with a value of CJSP5qf1KhICAQEYs-gDIIGOBii1hQIyGQAf3xBKmlwHjX7OIpuIFEavB2-qYAGQsF4:

➜ /~curl --header "Authorization: Bearer CJSP5qf1KhICAQEYs-gDIIGOBii1hQIyGQAf3xBKmlwHjX7OIpuIFEavB2-qYAGQsF4"\?count\=1