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.

Testing the HubSpot APIs

Google's OAuth 2.0 Playground allows you test test any OAuth 2.0 compatible system (including HubSpot). It does most of the management for the OAuth part of the connection, allowing you to focus on the actual APIs.

By default, the OAuth 2.0 Playground is designed to work with Google APIs, but it can be configured to work with HubSpot APIs instead.

The playground allows you to store some of the settings in the URL. This URL will start you out with HubSpot's authorization and token URLs pre-populated:

The first time you go to that URL, you'll see a popup asking you to confirm the OAuth configuration. Click the green "OK!" button to continue. You can check the checkbox before clicking the button to prevent that popup from appearing again.

warningwindow.png

After closing the popup, you'll see the configuration window open on the right. You'll need your client ID and client secret from the HubSpot app that you've created specifically for using with the Google OAuth 2.0 playground. If you haven't created an app yet, you can find instructions for doing that here. Note that you'll have to set the redirect uri for this app to https://developers.google.com/oauthplayground for authorization to be successful.

oauthsettings.png

Now you'll need to enter the scopes you want to test. You can find a list of the scopes we support here. You'll need to manually enter the scopes into the text box (the selectable scopes will be for Google's APIs), separating each scope you want to request with a single space.

scopesbox.png

After entering your scopes, click the blue "Authorize APIs" button. This will direct you to HubSpot, where you'll see a list of accounts that you have access to. Select the account you want to test with and click the orange "Grant Access" button. You'll be brought back to the OAuth 2.0 Playground.

Step 2 should automatically be selected, and the authorization code from HubSpot should be populated in the text field. Click the blue button below the code to generate your access and refresh tokens, which will be populated in their respective fields. HubSpot access tokens are short lived; you should see a countdown below the tokens. You can check the auto-refresh checkbox to have the playground automatically refresh the token before it expires, otherwise you can use the refresh button to manually generate a new token.

tokens.png

Once you have the tokens, Step 3 should automatically open. At this point, you can enter the URL for a GET endpoint into the Request URI field, and click the blue "Send the request" button to make the API request against the account you're using to test.

As an example, if you requested the 'contacts' scope, you could use the Get all contacts endpoint.

requestdetails.png

If you're making a POST or PUT request, you can set the request body using the button between the Request URI field and the blue Send button.