# ForbiddenException: (403) when creating contacts

**URL:** <https://community.hubspot.com/t/forbiddenexception-403-when-creating-contacts/105787>\
**Category:** APIs & Integrations\
**Tags:** python, professional, contacts\
**Created:** [April 25, 2024, 2:38pm UTC](https://community.hubspot.com/t/forbiddenexception-403-when-creating-contacts/105787 "2024-04-25T14:38:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mobydick](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@Mobydick](https://community.hubspot.com/u/Mobydick)\
**Post date:** [April 25, 2024, 2:38pm UTC](https://community.hubspot.com/t/forbiddenexception-403-when-creating-contacts/105787/1 "2024-04-25T14:38:51Z")

</div>

Hello,  
I tried to batch create ~3k contacts. Successfully created 2,890 contacts but then the api failed with the error:

```lia-code-sample
ForbiddenException: (403)
Reason: Forbidden
HTTP response headers: HTTPHeaderDict({'Date': 'Thu, 25 Apr 2024 14:00:54 GMT', 'Content-Type': 'text/html; charset=UTF-8', 'Content-Length': '4512', 'Connection': 'keep-alive', 'X-Frame-Options': 'SAMEORIGIN', 'Referrer-Policy': 'same-origin', 'Cache-Control': 'max-age=15', 'Expires': 'Thu, 25 Apr 2024 14:01:09 GMT', 'Report-To': '{"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=NrpeFN%2B4eZENyg%2FDDHSxkPYn41CIbkSogb25Ouxv7fFcchRyJchWTL0Vu1NjXQTkijUO1ZHYk27CHc0nXfd%2FbvTX4AWJXI1fSUwcBUq8H7Al5FTs%2B8qr19ZLeQFLyKyp"}],"group":"cf-nel","max_age":604800}', 'NEL': '{"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}', 'Vary': 'Accept-Encoding', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains; preload', 'Server': 'cloudflare', 'CF-RAY': '879edcadcb7765d0-FRA'})
HTTP response body: <!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en-US"> <![en...

```

Please advise on how to handle this.  
The permissions that I have in the Private app are:  
crm.objects.contacts.write  
crm.schemas.contacts.write  
crm.objects.contacts.read  
crm.schemas.contacts.read

---

<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:** [April 25, 2024, 10:58pm UTC](https://community.hubspot.com/t/forbiddenexception-403-when-creating-contacts/105787/2 "2024-04-25T22:58:35Z")

</div>

Hi, @Mobydick 👋 I’d start by [checking your Private App logs](https://developers.hubspot.com/docs/api/private-apps#private-app-limits). You can also make a GET request to /account-info/v3/api-usage/daily/private-apps to [review the daily API usage for all private apps](https://developers.hubspot.com/docs/api/private-apps#private-app-limits) in your HubSpot account. Are you using the batch Contacts API? If not, you might consider it as it can help avoid hitting rate limits depending on your use case — **POST/crm/v3/objects/contacts/batch/create**

Best,

Jaycee

---

<div class="post-metadata">

**Author:** ![Mobydick](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@Mobydick](https://community.hubspot.com/u/Mobydick)\
**Post date:** [April 26, 2024, 8:24am UTC](https://community.hubspot.com/t/forbiddenexception-403-when-creating-contacts/105787/3 "2024-04-26T08:24:54Z")

</div>

Hi [@Jaycee\_Lewis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074)  
Yes, I am using the batch create **/crm/v3/objects/contacts/batch/create** and I also checked the daily usage which is not yet reached as you can see from the response:

```lia-code-sample
{
 "results": [
 {
 "name": "private-apps-api-calls-daily",
 "usageLimit": 500000,
 "currentUsage": 70,
 "collectedAt": "2024-04-26T08:19:58.603Z",
 "fetchStatus": "SUCCESS",
 "resetsAt": "2024-04-27T04:00:00Z"
 }
 ]
}

```

Also, in the private app logs, there is no log with the failed request. Why is that?  
I can also see the failed requests in my app logs because I catch and print the error in the implementation.  
Is it possible that the private app access token is expired?  
How do you suggest I can resolve this?

---

<div class="post-metadata">

**Author:** ![Mobydick](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@Mobydick](https://community.hubspot.com/u/Mobydick)\
**Post date:** [April 26, 2024, 1:08pm UTC](https://community.hubspot.com/t/forbiddenexception-403-when-creating-contacts/105787/4 "2024-04-26T13:08:52Z")

</div>

[@Jaycee\_Lewis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074)  
Do you think we can have a solution by end of the day? This is kinda urgent.  
Some updates to help:  
I tried again the batch create. The first batch with 100 entries failed with the above error, the second batch with 100 entries and the third batch with 5 entries successsfully created the contacts.  
Please advice as soon as possible.Thank you!
