I want to call Contacts API. I have integrated it with my angular application. I am getting a response with 200 status but also getting CORS error though I have set ‘Access-Control-Allow-Origin’ to ‘*’.
Hi @chandrakanthake,
Had this problem a while ago ?
If I understand correctly, you’re trying to make an API call from the web client ?
If so that won’t work, whatever you set the ‘Access-Control-Allow-Origin’ to, see Hubspot’s documentation :
For the most part, the HubSpot APIs do not support cross-origin (CORS) AJAX requests. Making the request client-side using JavaScript would expose any authentication you’re using for the request. In order to use JavaScript/AJAX, you would need to make the request (excluding any authentication) to an external server that could then add the needed authentication and make requests to HubSpot’s APIs server-side.
The exceptions to this rule are:
- The Submit form data (AJAX) endpoint, which accepts CORS AJAX form submissions.
- Most GET requests for published HubDB tables. See the HubDB API Overview for more details.
Also confirmed by this solution to another post.
I don’t think anything has changed in this regard.
Hope this helps !
If it does, please consider marking this answer as a solution ![]()
Best,
Ludwig