# Analytics API

**URL:** <https://community.hubspot.com/t/analytics-api/67295>\
**Category:** APIs & Integrations\
**Created:** [October 17, 2022, 4:43pm UTC](https://community.hubspot.com/t/analytics-api/67295 "2022-10-17T16:43:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TAfolabi4](https://avatars.discourse-cdn.com/v4/letter/t/eb8c5e/32.png) [@TAfolabi4](https://community.hubspot.com/u/TAfolabi4)\
**Post date:** [October 17, 2022, 4:43pm UTC](https://community.hubspot.com/t/analytics-api/67295/1 "2022-10-17T16:43:28Z")

</div>

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”

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [October 17, 2022, 10:49pm UTC](https://community.hubspot.com/t/analytics-api/67295/2 "2022-10-17T22:49:45Z")

</div>

Hi, @TAfolabi4👋 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

---

<div class="post-metadata">

**Author:** ![TAfolabi4](https://avatars.discourse-cdn.com/v4/letter/t/eb8c5e/32.png) [@TAfolabi4](https://community.hubspot.com/u/TAfolabi4)\
**Post date:** [October 19, 2022, 2:08pm UTC](https://community.hubspot.com/t/analytics-api/67295/3 "2022-10-19T14:08:06Z")

</div>

Hi [@Jaycee\_Lewis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074),

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](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)
