# Form API (with CORS) Documentation help

**URL:** <https://community.hubspot.com/t/form-api-with-cors-documentation-help/11612>\
**Category:** APIs & Integrations\
**Tags:** forms\
**Created:** [November 2, 2018, 1:13pm UTC](https://community.hubspot.com/t/form-api-with-cors-documentation-help/11612 "2018-11-02T13:13:35Z")\
**Posts on this page:** 3\
**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:** [November 2, 2018, 1:13pm UTC](https://community.hubspot.com/t/form-api-with-cors-documentation-help/11612/1 "2018-11-02T13:13:35Z")

</div>

Hello there,  
**What I want to achieve** : I want to call HS Form API from my front end, with a custom non-hubspot form.

[https://developers.hubspot.com/docs/methods/forms/submit\_form\_v3](https://developers.hubspot.com/docs/methods/forms/submit_form_v3) I think has poor documentation in terms of example POST.

**Questions:**  
What is the URL for posting this data?  
Where do I find the Portal ID?  
Where do I find the Form ID?  
What is the proper payload structure of sending data?  
Do I need to make my request a query string on the URL?

Most importantly, can someone show an example of vanilla JS version of posting to Form API with CORS? Data et all please

---

<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:** [November 5, 2018, 2:59pm UTC](https://community.hubspot.com/t/form-api-with-cors-documentation-help/11612/2 "2018-11-05T14:59:17Z")

</div>

Welcome, [@alphy](https://community.hubspot.com/u/alphy),

Happy to help:

**What is the URL for posting this data?**

- This is noted in [the documentation](https://developers.hubspot.com/docs/methods/forms/submit_form_v3): `https://api.hsforms.com/submissions/v3/integration/submit/:portalId/:formGuid`

**Where do I find the portal ID?**

- This is your HubSpot account ID and can also be found in any app URL while you are logged in. For example, in `https://app.hubspot.com/reports-dashboard/1234567/marketing`, `1234567` is the portal ID.

**Where do I find the form ID?**

- Via the [Get all forms](https://developers.hubspot.com/docs/methods/forms/v2/get_forms) endpoint or in the URL when viewing any form in your portal.

**What is the proper payload structure of sending data?**

- [As documented](https://developers.hubspot.com/docs/methods/forms/submit_form_v3), the payload should be formatted in JSON. All form fields should be transmitted as objects within the `"fields"` array.

**Do I need to make my request a query string on the URL?**

- No. As documented, the submission information is contained in the body.

There’s plenty of documentation out there on submitting form data with AJAX. For example, see [this Stack Overflow discussion](https://stackoverflow.com/questions/13611614/submit-the-form-using-ajax).

You can ensure that your field data is formatted correctly by following guides [like this](https://stackoverflow.com/questions/12966433/convert-form-data-to-json-object).

---

<div class="post-metadata">

**Author:** ![ShawnMclean](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/shawnmclean/32/192726_2.png) [@ShawnMclean](https://community.hubspot.com/u/ShawnMclean)\
**Post date:** [January 8, 2022, 2:30pm UTC](https://community.hubspot.com/t/form-api-with-cors-documentation-help/11612/3 "2022-01-08T14:30:52Z")

</div>

What about with CORS? Do you guys support posting directly from the browser?
