Analytics API

Hi,

I am new to hubspot and api calls. I have looked at the analytics api documentation and I am trying to pull information based on the example shown. I have the enterprise account and I believe it allows me use the analytics api, but the issue I seem to be having is I am getting “Access forbidden”

Hi, @TAfolabi4 :waving_hand: Thanks for reaching out. Can you provide any additional details, code snippets, or screenshots to help provide our community with additional information, please? In this case, adding:

  • the specific endpoint you are using
  • if you are using the example from the documentation, please add your example request and response (it should remove your bearer token when you copy from the example)
  • the error body you are receiving

Providing specific examples helps the community to understand root issues and if they can assist.

Best,

Jaycee

Hi @Jaycee_Lewis,

Thank you for your response, the issues I had were I was not writing the code properly in python for the bearer authorization and I was expecting the URL link to work like it did with the hapikey; so what I ended up doing was printing out the response and getting the code 200 was sufficient to let me know that the call went through. This is the snippet of the api call using the private key:

hubspot_endpoint =‘https://api.hubapi.com/analytics/v2/reports/totals/summarize/daily
headers = {“Authorization”: "Bearer "+access_token}

# private key, this is how the request is approved. We want a response of 200
url = hubspot_endpoint

params = {‘start’:‘20200101’,‘end’:‘20221014’,‘offset’:offset,‘limit’:limit} # parameters you want to request fron hubspot
# make a request
r=requests.get(url=url,headers=headers,params=params)
w =json.loads(r.text)