Is it possible to use redirectUrl when submitting a form into HubSpot using POST method?



Hi all,

Firstly, the code on this post works, and redirects to a chosen redirectUrl (Google) once submitted: Using the redirectUrl property on forms

However, that example pulls the HubSpot form into the page in question, whereas what we’re doing is letting a third party build the form as they wish, and simply submit back to our HubSpot account via: . We then have a form in HubSpot which takes that data and stores it in the right contact properties, etc, then redirects once done (via a Redirect entered into the Embed tab). This works fine.

However, our client would like the form in multiple languages, so each would redirect back to a different URL per language. I know that in HubSpot forms, the redirect can only be set to one URL (non-dynamic). Rather than making multiple forms (per language) in HubSpot and setting each to redirect differently, we thought it’d be cool if the redirectUrl value could be used; that way, the third party building the form can decide where each form redirects themselves, without us having to “hard code” it into HubSpot (in case it ever needs changing, etc).

Does/is this possible at all? I’ve tried having a hidden name=“hs_context” with value=“redirectUrl: “Google”}” and also tried appending ?hs_context={redirectUrl: “Google”} on the end of the form action POST URL, but neither do anything (the form submits into HubSpot but doesn’t redirect).

For clarity: in HubSpot I set the form’s Embed tab to “Thank you message”, as I read that having a Redirect in there can cause it to malfunction.

Any ideas or things I can try?


FYI: where I put Google it actually has full URL, but I’m limited to 2x URLs per post, so simplified it!


Hi @mleatham,

Just to make sure that we’re on the same page, are the forms you’re referring to embedded HubSpot forms? Or are they custom HTML / 3rd party forms submitting using the Forms API? If they’re the latter, then HubSpot’s redirect properties don’t determine where the user is redirected after submission; that’s handled by the form itself.


It’s a third party form, we get them to do a POST into our form (which is in HubSpot). They don’t embed our form directly on their site.

From the example linked above (in my original post), it passes a redirectUrl to redirect once submitted; I tried this with our form and it works, but we don’t want them to embed our form, just POST data to it. In that case, can the redirectUrl still be passed/work?

Ultimately I don’t really want (in HubSpot) an English form, French form, German form, etc, all with identical fields, just each using a different redirect (to website/en/, website/fr/, website/de/, etc), as it’ll become difficult to manage. So I’d like the external form to handle the redirect location, if that’s at all possible?


To summarise: we’ve got a form in HubSpot that collects sign ups. This will initially handle an English sign up form on an external 3rd party site. If I set the redirect for that form back to a “thanks” page in English on the external site then that all works fine.

However, when the client rolls out another 6 languages, those forms will all redirect to the same external English “thanks” page, as the form cannot dynamically assign different redirect URLs inside HubSpot I have read, thus we’d need a replica of the English form for French (for example) so we can set a different redirect URL.

HubSpot’s form API seems to offer a redirectUrl value, which the external site can pass to HubSpot, in order to redirect, but we’re not using the API interface directly, rather doing the post via this line:

along with running an hs-script-loader from // script.

Apologies, I’m not hugely technical and this is flying above my head to a large degree.

Ultimately we’d like a way that the client can put in their form where they want it to redirect to, and that gets passed into HubSpot to redirect to after form submission (without having to embed our whole form wholesale).

And now I’ve written a novel…


Update: solved it; in the end it needed hs_context passing with quotes encoded, i.e.

This then redirects to the BBC website (random choice!) after form has gone into HubSpot.