Basics: Creating forms from API data


Hi there.

This may be poorly understood on my end, so please bear with me. I am not a HubSpot developer, but I have a client who has asked us to integrate their HubSpot forms onto their website that we develop for them. They’ve given my a GUID for each of their forms, as well as an authorization API key, but frankly, they haven’t been very responsive beyond that. With that and the documentation I have available, this is my current process.

The first and last bit, I’m not having any trouble with. But it’s the middle step that I’m increasingly uncertain about. The result I’m currently putting together is a rather dull collection of labels and html inputs, with no styling whatsoever. And I keep running into alternate cases I have to handle from the JSON data I’m getting back, which is not going to work well if the client wants to be in control of their forms.

Is there either some commonly available way of building an html form from JSON data that I’m not familiar with, or is there documentation somewhere for using the JSON data to properly build a form manually?

Thank you!


Hi @thalandor46

Are you doing any type of special processing on the form data, or simply passing it to HubSpot? If you’re just passing the data along, you may just be able to use the form GUID and Hub ID to embed the form into a page. The embedded code would automatically generate the HTML form based on the current settings of the form, along with some other options that can be set in the embed code itself:


Hi @dadams

That was eventually a resource I needed, but as it turns out, what I was really looking for was the address of the v2.js script. Once I figured out that needed to be loaded, everything else fell into place. I may have just skimmed over it, but I don’t believe that script is mentioned anywhere in the forms API documentation.

If I may hijack my own thread for another issue, my integration now looks like this.

    portalId: '[Proper portalId]',
    formId: '[Proper formId]',
    onFormReady($form, ctx){

The onFormReady portion is just for placing the form in the correct place on the page. Otherwise, the form will appear on the bottom of my page, which is not desirable.

This displays the form perfectly. However, when I try to submit the form, I get the following error.

Uncaught Error: Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.
at r (
at Object.findComponentRoot (
at Object.findReactNodeByID (
at Object.l [as getNode] (
at Object.s [as executeDispatch] (
at executeDispatch (
at a (
at Object.l [as executeDispatchesInOrder] (
at c (
at Array.forEach (native)

This, unfortunately, is not telling me very much. Any idea what might be causing this error, or at least what could help me debug it further?

Interestingly, if I remove the onFormReady part and submit the form at the default position, the form submits without error, as expected.