Fetch report data

PieterJanPollie
Member

Hello,

 

We currently have quite a lot of reports in Hubspot that we use to measure several things. We would like to be able fetch the results of these reports through the API.

If that's important, most of our reports are companies but filtered.

 

I have digged a little in the API but am a little confused.

I have tried the following endpoint: 

GET /analytics/v2/reports/:object_type/:time_period

But I received the following:
Insufficient scopes, requires one of: [event-analytics-api-access]

 

From my understanding, scopes are relevant for OAuth integrations. We're not using OAuth. It's not an app that we're making for in the marketplace. We're making our own integration purely with our own Hubspot account. So I'm unsure how to give the API key this extra scope.

 

Besides this, I'm also unsure if this is the right endpoint. Looking at :object_type it needs to be one of: event-completions, forms, pages, social-assists.

Neither of these looks like the one I need. I quite simply need the results of the reports which should be (in our case) monthly count of companies (different reports have different filters on the companies and thereby give different counts).

 

If anyone could point me towards the right direction to retrieve this information it'd be highgly appreciated.

 

Kind regards

0 Upvotes
2 Replies 2
Teun
Guide | Diamond Partner

Hi @PieterJanPollie ,

 

Do you have an Enterprise account? The docs describe the following regarding access:
"Note: Only accounts with an Enterprise subscription will be able to access the Analytics API using an API key. All accounts will be able to access certain features of the Analytics API using OAuth based on the table below."

 

If you do not have an Enterprise subscribtion, you will have to switch to OAuth authentication. If you do have an Enterprise subscribtion, the breakdown in the docs should give you enough insight on how to fetch the relevant data.



Did my answer solve your issue? Help the community by marking it as the solution.
0 Upvotes
PieterJanPollie
Member

Hey @Teun,

 

Thank you very much for the information. We indeed do not have an Enterprise account and must have missed that piece of information. I am able to fetch information with the use of OAuth instead of a simple API token.

 

However, I'm still unable to fetch the required information. If I look at your provided information it is all regarding analytics of our website. Which is not what I'm looking for.

 

We have a couple of custom reports (on https://app.hubspot.com/reports-list/[ID HERE]/).

These are reports like "Trials", "Leads", "Leads that requested a demo" and so on. So our report is more a list of companies which fullfill a couple of requirements (some of them are custom properties on the company).

Am I still able to fetch that information through the breakdown analytics API?

 

To give you a clear view on the data I'm looking for, this is how one of the reports is build up:

Screenshot 2021-09-28 at 23.42.50.png

This gives a count per month. And I'm purely looking to fetch this count per month through the API.

 

I have also tried to call the "/analytics/v2/views" endpoint, but this gives the same result as I had with the API key.
It gives me 1 item with something related to "no_subdomain", but I'm unsure what that is. We have nothing with subdomains in our reports.

 

Thanks in advance for your time.

0 Upvotes