Form API not accepting IP values

forms

#1

Hey guys,

Having some trouble with the Form API adding ipAddress to contacts, and therefore the location that’s generated based on this.

I’ve removed the IP Exclusion for the test, to no avail.

When viewing the submission on the form the hutk and ipAddress are both present, with the correct formatting to match HubSpot’s, but for some reason it’s not appearing in the contact’s information - the field history lists the only change as “HubSpot Location Service” - no mention of the form API.

An example post is below (I x’d out a few characters just in case)

https://forms.hubspot.com/uploads/form/v2/18xxxxx/0f70xxx4-1116-4a92-9461-0bxxxxf63520?email=xxxxx@gmail.com&firstname=mark&lastname=xxxx&hutk=ae0b77226bd10e6c1cdfb0132ea7f642&ipAddress=xxx.xx.xxx.x

Any help would be much appreciated.


#2

Hi @timsearle,

The form submission endpoint takes a POST request with the fields (including hs_context) in the POST body, not included as query parameters. Can you give me a link to an example contact so that I can look at the raw form submission?


#3

Hi Derek,

I just did a test submission which can be found here: https://app.hubspot.com/contacts/1838400/contact/444103

Thanks for your help.


#4

Hi @timsearle.

So it looks like you're including the IP address as it's own form field. The IP address needs to be included as a part of the hs_context field in order to be processed correctly. The hs_context field is a JSON object with submission meta info, like IP address and page name/URL. The doc below has some info on how exactly that field should be formatted/included.