Why do you need hapikey/access_token to get form fields?


#1

Get all fields from a form documenation requires Form GUID and HubSpot API Key or OAuth Access Token.

Example URL: https://api.hubapi.com/forms/v2/fields/78c2891f-ebdd-44c0-bd94-15c012bbbfbf?hapikey=demo

However, embedding form code directly from hubspot only requires portalId and formId and not `HubSpot API Key or OAuth Access Token.

                  hbspt.forms.create({
                    portalId: '',
                    formId: ''
                  });

which eventually calls GET method to get form fields - https://forms.hubspot.com/embed/v3/form/62515/78c2891f-ebdd-44c0-bd94-15c012bbbfbf?callback=?


#2

To expand more on this, I need to perform additional validation before submitting form data to Hubspot. Form embedding would work really well for us, but it looks like there is no way to prevent form submititon. - Integration with JQuery Validator - customized validation


#3

Hi @sajinshrestha

The endpoints at api.hubapi.com/forms are all part of the same system, and that system requires authentication since there are endpoints that allow you to create or modify forms.

The forms.hubspot.com/embed endpoints are designed to be used by the embed code, so they don’t require authentication so that anyone viewing the page can load the form, but they also don’t support making changes.