How to insert enumeration field values into forms API?


I'm using PHP to POST form data to HubSpot Forms API. Everything works fine - submitted form data is stored in HubSpot correctly except enumeration fields.

I'm sending form data from my front-end APP to my backend APP and receives all data as an array in following structure:

  'firstname' => ...,
  'lastname' => ...,
  'email' => ...,
  'some_enumeration_field' => [
    'Value 1',
    'Value 2',

Than I'm using PHP CURL to send this data further into HubSpot API. I'm using code almost exact the same as shown in API examples. Only difference is that I'm using http_build_query function to parse array. But there is problem with enumaration fields, which are sub-arrays. In my submission details enumeration field values has exclamation icons next to them. And the key names are bad, they are stored this way:

some_enumeration_field_0_ : 'Value 1'
some_enumeration_field_1_ : 'Value 2'

Hovering the exclamation icon gives me following error:
"This value wasn't passed to the contact record. 'some_enumeration_field_0_' isn't a contact property."

So how to send enumeration data to HubSpot API properly that it will be recognised as an array of values?


HI @Peronczyk, that error message seems to indicate that the enumeration property that you're trying to send data to in HubSpot does not exist. The field that stores the data in HubSpot has to exist on the contact in your property settings:

Can you check that the field exists in HubSpot that you're trying to pass data to? If that doesn't work, can you send me a bit more information?

  1. The request body that you're sending back to HubSpot.
  2. A link to the form in HubSpot that you're sending data to.

Thank you


Field some_enumeration_field in my example exists in HubSpot.

Ad 1. Here is example body of data that is send to HubSpot with PHP curl_exec() function:


In this real life example field nearshoring_it_challenge is enumeration.

Ad 2. Here is link to one of the forms that has problem with enumeration fields:


Hi @Peronczyk, looks like this is a quirk with HubSpot the values in an enumeration field should be separated by a semicolon. I was able to get a form submission to work by using this request body:


Here's my contact in your portal:

And here's a thread that talks about this a bit more:


Thank you for your response - you've helped me a lot. To be honest this is something even more than "quirk" :slight_smile: