How To Get Hubspot Access Token

As a developer utilizing the HubSpot API, obtaining an access token is necessary for authentication and engagement with the API endpoints. This blog post provides a step-by-step guide on how to acquire a HubSpot access token.

What is a HubSpot Access Token?

In simple terms, a HubSpot Access Token is a unique string that grants permissions to access and interact with the HubSpot API. It’s your passkey to unlock the powerful features of the API, and without it, you won’t be able to perform any API requests.

Steps to Obtain a HubSpot Access Token

Step 1: Create a HubSpot App

To get an access token, you first need to create a HubSpot App. Visit the HubSpot Developer site, sign in and create a new application.

Step 2: Set up OAuth 2.0

Once you’ve created your app, you’ll need to set up OAuth 2.0. This involves specifying a redirect URL for the app (this is where users will be sent after they authorize your app) and selecting the scopes your app will need access to.

Step 3: Get Your Authorization URL

With the setup complete, it’s time to get your authorization URL. This URL will direct users to HubSpot’s authorization page where they can log in and authorize your app. Your URL will follow the following structure:

Replace the CLIENT_ID with your app’s client ID, SCOPES with a space-separated list of the scopes your app needs access to and REDIRECT_URI with your app’s redirect URL.

Step 4: Exchange the Authorization Code for an Access Token

After the user authorizes your app, they will be redirected to your specified URL with an authorization code appended to the URL. You will need to exchange this code for an access token.

Here’s an example of how to exchange the code for a token using a POST request to the HubSpot API:

        curl -X POST \
        -H 'Content-Type: application/x-www-form-urlencoded;charset=utf-8' \
        -d 'grant_type=authorization_code&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&redirect_uri=REDIRECT_URI&code=CODE' \

Replace the CLIENT_ID and CLIENT_SECRET with your app’s client ID and client secret, respectively. Replace REDIRECT_URI with your app’s redirect URL, and CODE with the authorization code you received.

Once you’ve successfully exchanged the code, you’ll receive a JSON response containing your access token which you can then use for authenticated requests to the HubSpot API.


And there you have it! The process of obtaining a HubSpot Access Token can seem tricky at first, but once you understand the steps, it’s a straightforward task. Remember to handle your access token securely to ensure the integrity and security of your HubSpot API interactions.