# Access control error

**URL:** <https://community.hubspot.com/t/access-control-error/11483>\
**Category:** APIs & Integrations\
**Tags:** developer-preview\
**Created:** [October 5, 2018, 9:11am UTC](https://community.hubspot.com/t/access-control-error/11483 "2018-10-05T09:11:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [October 5, 2018, 9:11am UTC](https://community.hubspot.com/t/access-control-error/11483/1 "2018-10-05T09:11:35Z")

</div>

hi i’m on a project and i get the contacts that are registered on my site which are local to submit them to my hubspot app and i have this message in my console  
request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘null’ is therefore not allowed access. this is the code i use  
$.ajax({  
type: “POST”,  
url: api,  
crossDomain : true,  
xhrFields: {  
withCredentials: true  
},  
headers:{  
“content-type”:“json/application”,  
“Access-Control-Allow-Origin”:“\*”,  
“Access-Control-Allow-Headers”:“Origin, X-Requested-With, Content-Type, Accept”  
},  
data:data1  
})  
.done(function( data ) {  
console.log(“done”);  
})  
.fail( function(xhr, textStatus, errorThrown) {  
alert(xhr.responseText);  
alert(textStatus);  
});

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [October 5, 2018, 12:19pm UTC](https://community.hubspot.com/t/access-control-error/11483/2 "2018-10-05T12:19:42Z")

</div>

Hi [@maven](https://community.hubspot.com/u/maven),

Which endpoint are you using?

As [this documentation](https://developers.hubspot.com/docs/faq/do-hubspot-apis-support-ajax-request) states, most of HubSpot’s APIs do _not_ support CORS AJAX requests. The only `POST` method which supports AJAX is for the [Forms API](https://developers.hubspot.com/docs/methods/forms/submit_form_ajax).

If you are using the Forms API, please share an example request URL and body which failed.

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [October 5, 2018, 12:54pm UTC](https://community.hubspot.com/t/access-control-error/11483/3 "2018-10-05T12:54:24Z")

</div>

hi [@Isaac\_Takushi](https://community.hubspot.com/u/isaac_takushi)  
thank you I solved it using the API forms

---

<div class="post-metadata">

**Author:** ![MikeDao](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mikedao/32/64675_2.png) [@MikeDao](https://community.hubspot.com/u/MikeDao)\
**Post date:** [March 5, 2020, 11:31pm UTC](https://community.hubspot.com/t/access-control-error/11483/4 "2020-03-05T23:31:39Z")

</div>

@IsaacTakushi Hi Isaac!

I am a new one with hubspot. And I got the same problem as Maven. I am working on create a support form from my own website to allow the Users to create a tickets and send direct to my hubspot. But I am not able to using Ajax to post the data to create ticket api. As I understand after read your solution that you suggest to Maven. But I don not how to use it. Could you please send me an example using create ticket api? Thank you!

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [March 10, 2020, 6:12pm UTC](https://community.hubspot.com/t/access-control-error/11483/5 "2020-03-10T18:12:32Z")

</div>

Hi, @MikeDao.

Apologies for the delayed response.

At this time, it is not possible to create tickets via AJAX requests to the [Tickets API](https://developers.hubspot.com/docs/methods/tickets/tickets-overview).

[This undocumented workaround](https://community.hubspot.com/t5/Tickets-Conversations/Can-support-forms-be-submitted-via-the-forms-API/m-p/285507) uses the v3 Forms API, though, which supports AJAX. Please keep in mind that since it is as yet undocumented, it is subject to breaking changes without notice.
