IP Address Pulling from Server Instead of Contact



I am using the Forms API to get Contacts from an externally hosted form. The IP address that is being pulled for contacts is the IP address of the website server and I get this notification on each Contact: “Some of this contact’s activity has been excluded based on their IP address. Learn more.” I had our developer add: “ipAddress”:x to the parameters but it has not changed anything. Any help or advice would be amazing.

IP Address not being pulled from server and not ipAddress

Hi @JamesArbogast,

Just to make sure I’m understanding, are you including the ipAddress: xxxxxx in the hs_context parameter? If that’s not included properly, the IP address will be set to the IP of the system making the request to the Forms API, which is likely your server.


Yes, that is where it was included. It doesn’t seem to have changed anything.


Hi @JamesArbogast,

Can you direct message me with a link to the corresponding form in HubSpot? Additionally, how are you populating the ipAddress field?


Hi @Derek_Gervais,

I messaged you the link. I am not sure exactly how it is populated, I am not the one who implemented the code, I work on the marketing end. I will have to get back to you on that.




Was there any resolution on this?


Hi @Peter_Keogh,

I believe the IP address wasn't properly included in the hs_context parameter.


Hi @Derek_Gervais!

Would it be possible to look into these 2 examples and tell me if I messed up something?



I'm facing the same problem with IP address not populating correctly but I'm sure I've included the ipAddress in the hs_context parameter.


Hi @batjaa,

The contact's IP address properties are matching up with the values I'm seeing in the hs_context fields for those submissions. I'm also not seeing any other data appearing in the hs_context data for this form. Are you sure that the hs_context fields are being properly formatted? Do you have an example of a raw request you're making to the forms API, so that I can take a closer look?


I'm using ryanwinchester/hubspot-php and overriding the Froms class. Looks like it's still not sending the hs_context params.

This is what I have now:

public function submit($portal_id, $form_guid, $form = [])
        $form['hs_context'] = [
            'hutk'      => $this->request->cookie('hubspotutk'),
            'ipAddress' => $this->request->getClientIp(),

        $endpoint = "https://forms.hubspot.com/uploads/form/v2/{$portal_id}/{$form_guid}";

        $options = [
            'form_params' => $form,

        return $this->client->request('post', $endpoint, $options, null, false);

this is one of the latest submissions.


You can find another submission I'm testing here.

Made that request using postman, though I've included hs_context it's still not showing up. Does the hs_context have to include all the the properties?


Hi @batjaa,

Apologies, I'm not particularly familiar with PHP. How does the final hs_context field look? It's supposed to be a JSON object, but it appears above like it might be an array? Here's an example hs_context:

    "hutk": "60c2ccdfe4892f0fa0593940b12c11aa", 
    "ipAddress": "", 
    "pageUrl": "http://demo.hubapi.com/contact/", 
    "pageName": "Contact Us", 
    "redirectUrl": "http://demo.hubapi.com/thank-you/"