# filemanager upload cors issue

**URL:** <https://community.hubspot.com/t/filemanager-upload-cors-issue/14873>\
**Category:** APIs & Integrations\
**Tags:** developer-tools\
**Created:** [June 19, 2019, 6:28pm UTC](https://community.hubspot.com/t/filemanager-upload-cors-issue/14873 "2019-06-19T18:28:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jradcliff](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jradcliff/32/95715_2.png) [@jradcliff](https://community.hubspot.com/u/jradcliff)\
**Post date:** [June 19, 2019, 6:28pm UTC](https://community.hubspot.com/t/filemanager-upload-cors-issue/14873/1 "2019-06-19T18:28:15Z")

</div>

I have a template on our hubspot account in which I have a form that accepts a file which I wish to load into a folder on our hubspot account using jquery. I am using the below code and I have confirmed that the formData for the files has correctly loaded.

```auto
		var documentData = new FormData();
		var file = $("input#cardSatements.upload")[0].files[0];
		documentData.append("files", file);
		documentData.append("folder_paths", "Fullsteam/Statements");
		$.ajax({
			url: "https://api.hubapi.com/filemanager/api/v2/files?hapikey={myApiKey}",
			data: documentData,
			contentType: "multipart/form-data",
			processData: false,
			cache: false,
			dataType: "JSON",
			method: "POST",
			success: function (results) {
				console.log("results", results);
			},
			error: function (xhr, statusText, errorThrown) {
				console.log("xhr", xhr);
				console.log("statusText", statusText);
				console.log("errorThrown", errorThrown);
			}
		});

```

When this runs I get this error.  
Access to XMLHttpRequest at ‘[https://api.hubapi.com/filemanager/api/v2/files?hapikey={myApiKey}](https://api.hubapi.com/filemanager/api/v2/files?hapikey=%7BmyApiKey%7D)’ from origin ‘[https://preview.hs-sites.com](https://preview.hs-sites.com)’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.  
If I run it from a webpage created from the template I get the exact same error only the origin changes to our typical “[https://www.partycentersoftware.com](https://www.partycentersoftware.com/)” address.

---

<div class="post-metadata">

**Author:** ![jradcliff](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jradcliff/32/95715_2.png) [@jradcliff](https://community.hubspot.com/u/jradcliff)\
**Post date:** [June 19, 2019, 7:08pm UTC](https://community.hubspot.com/t/filemanager-upload-cors-issue/14873/2 "2019-06-19T19:08:34Z")

</div>

I saw another section having issues with cross-domain that was resolved by using v3. I tested and there is a v3 endpoint, but it also throws the same error.

---

<div class="post-metadata">

**Author:** ![Derek\_Gervais](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/derek_gervais/32/17429_2.png) [@Derek\_Gervais](https://community.hubspot.com/u/Derek_Gervais)\
**Post date:** [June 19, 2019, 10:05pm UTC](https://community.hubspot.com/t/filemanager-upload-cors-issue/14873/3 "2019-06-19T22:05:53Z")

</div>

Hey @jradcliff ,

Most of the HubSpot API does not support CORS AJAX calls, since these calls expose your authentication information client-side ([see here](https://developers.hubspot.com/docs/faq/do-hubspot-apis-support-ajax-request)). If you’ve implemented any code like this publicly, I would recommend deactivating your API key and generating a new one.

Regarding the confusion around v2 / v3: This _only_ applies to the Form Submission API endpoints, since they do not require authentication.
