HubSpot offers a broad range of marketing, sales, and customer service software that works together with their core CRM product. Their various packages and platforms feature a significant degree of interoperability, creating a powerful business-focused ecosystem.
In this tutorial, you’ll learn how to connect the Hubspot REST API to Google Sheets in 5 steps using the Apipheny add-on:
Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.
1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install
2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.
In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.
Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new
1. In your HubSpot account, click the Settings icon in the main navigation bar:
2. In the left sidebar menu, navigate to Integrations > Private Apps:
3. In the Private Apps section click the Create a private app button:
4. Choose a name and a logo and write a description for your app:
5. Go to the Scopes tab, choose the scopes that you want for your app and then click the Create app button:
6. In the Create a new private app popup click the Continue creating button:
7. Your private app was created and your token was generated. You can copy the token to a safe location after you click the Show button link:
In this section, we’ll show you how to browse the Hubspot API documentation to find an endpoint that retrieves the specific information you need from your Hubspot account.
If you already know your URL, or you want to use the same example URL as us, just skip to Step 4.
First, open the Hubspot API documentation page: https://developers.hubspot.com/docs/api/overview
The menu on the left, starting with Analytics API, contains a list of the available APIs each with its own endpoints.
Clicking on an API takes you to that API’s section, containing a list of associated endpoints. If we click the Inbox and messages API it’s endpoints will be displayed:
One of the available endpoints, the one we’re using in this example, is Get a single actor:
https://api.hubapi.com/conversations/v3/conversations/actors/{actorId}
Each endpoint’s documentation contains the HTTP method used (GET), a short description of the endpoint’s purpose, example CURL request, accepted parameters and an example response:
All API calls to HubSpot should be made to the https://api.hubapi.com root domain:
https://api.hubapi.com
The Get all Landing Pages endpoint, which gets the list of landing pages:
Method: GET API URL Path: https://api.hubapi.com/cms/v3/pages/landing-pages Headers: Header 1 Key: Authorization Header 1 Value: Bearer your_token
your_token, is the value you previously obtain at Step 2.).
The Get all Landing Page Folders endpoint. which gets the list of Landing Page Folders:
Method: GET API URL Path: https://api.hubapi.com/cms/v3/pages/landing-pages/folders Headers: Header 1 Key: Authorization Header 1 Value: Bearer your_token
your_token, is the value you previously obtain at Step 2.).
The Get indexed properties endpoint, which for a given account and document ID (page ID, blog post ID, HubDB row ID, etc.), return all indexed data for that document:
Method: GET API URL Path: https://api.hubapi.com/cms/v3/site-search/indexed-data/ Headers: Header 1 Key: Authorization Header 1 Value: Bearer your_token
your_token, is the value you previously obtain at Step 2.).
Pagination is a process that is used to divide a large dataset into smaller chunks (pages). Usually the endpoints that return a list of resources support pagination.
Some of the Hubspot API endpoints use the pagination option. This means you need to add some of these parameters at the end of the URL:
Each endpoint that needs pagination will have in its documentation relevant information on which of these parameters you can use and how to do it.
Example: https://api.hubapi.com/crm/v4/objects/contacts/associations/?after=NTI1Cg%3D%3D&limit=500
In the example above, the data set will be divided in sets of 500 records per page, and only the page after last successfully read resource (after=NTI1Cg%3D%3D) will be displayed in Google Sheets. If this is the first call, then you don’t need the after parameter.
Now go back to your Google Sheet and make sure that the Apipheny add-on is open on the Import tab. With the Import tab open, enter these details into the add-on:
Method: At the top of the Apipheny sidebar, select the HTTP method (GET or POST) required by your API endpoint. For this example, we are using the GET method.
API URL: In Step 3, we explained how you can find the Hubspot REST API endpoint that you need. Now copy the complete URL (root domain + endpoint) into the Apipheny add-on, where it says API URL Path, followed by any GET parameters required for your query.
For this example, we are using the GET /account-info/v3/details endpoint, to get all contacts:
https://api.hubapi.com/account-info/v3/details
Headers: In the Headers section of the Apipheny add-on, add one row with the following key and value:
Header Key: Authorization Value: Bearer your_token
your_token, is the value you previously obtain at Step 2.). There should be a space between Bearer and your_token.
Here’s what our API request looked like:
Click the Run button at the bottom of the Apipheny add-on and then wait for the Hubspot API data to be added to your Google Sheet:
After making a successful request to the Hubspot API, try querying a different endpoint, or try using one of the more advanced features in the Apipheny add-on.
Crypto API Tutorials: