Getting the following errors when trying to update properties via contacts ID:
All fields are created in the UI and have "show in forms" enabled. We already have an integration running updating other fields, and we are just adding the fields below to the call.
email_opt_in
{"status":"error","message":"Property values were not valid","correlationId":"edf90279-f147-40bb-b799-f1e4b38a9612","validationResults":[{"isValid":false,"message":"Property "email_opt_in" does not exist","error":"PROPERTY_DOESNT_EXIST","name":"email_opt_in"}],"requestId":"7951ed448293799d7d3639d2b4344218"}
do_not_call
{"status":"error","message":"Property values were not valid","correlationId":"4508c693-6cf0-4960-a3f6-7f0b1a119b2c","validationResults":[{"isValid":false,"message":"Property "do_not_call" does not exist","error":"PROPERTY_DOESNT_EXIST","name":"do_not_call"}],"requestId":"d26cc52d48b50c80b0240b5aa0394a3c"}
email_opt_out
{"status":"error","message":"Property values were not valid","correlationId":"e05ce616-791d-4673-a2f8-4f17d28f8fb0","validationResults":[{"isValid":false,"message":"Property "email_opt_out" does not exist","error":"PROPERTY_DOESNT_EXIST","name":"email_opt_out"}],"requestId":"03debedff46c8a8fe17cdc971b2abd8b"}
c_id__c
{"status":"error","message":"Property values were not valid","correlationId":"cb832e5b-c945-4c56-a2e5-b67b592d3f18","validationResults":[{"isValid":false,"message":"Property "c_id__c" does not exist","error":"PROPERTY_DOESNT_EXIST","name":"c_id__c"}],"requestId":"c408f93c6b1621c54d765c2bf6f8080e"}
sandbox_key__c
{"status":"error","message":"Property values were not valid","correlationId":"653f27ec-7402-484e-aad5-0f88cef1aee6","validationResults":[{"isValid":false,"message":"Property "sandbox_key__c" does not exist","error":"PROPERTY_DOESNT_EXIST","name":"sandbox_key__c"}],"requestId":"7b19b107529dadd2ba05603aabc64b82"}
I just successfully created this contact in your account using your code. As you can see here, the email_opt_in property was filled successfully.
Are you certain you are using your account's API key instead of demo? When I made the same request with hapikey=demo, I got the PROPERTY_DOESNT_EXIST error because there is no property with the internal name email_opt_in in HubSpot's API test account — that's a custom property in your account.
{"status":"error","message":"Property values were not valid","correlationId":"d404d58b-7aa6-4ec2-b7fa-7277988a0928","validationResults":[{"isValid":false,"message":"Property "email_opt_in" does not exist","error":"PROPERTY_DOESNT_EXIST","name":"email_opt_in"}],"requestId":"dea60670d7495ab324359dd6b3b3ff4f"}
The "Property values were not valid" error generally indicates a mismatch between the property values you are trying to pass and the HubSpot property's available values. (Rather than the nonexistence of the properties themselves.)
I successfully passed values for each of those five properties to this test contact using the following request:
POST https://api.hubapi.com/contacts/v1/contact/vid/3620251/profile
{
"properties": [
{
"property": "email_opt_in",
"value": "false"
},
{
"property": "do_not_call",
"value": "true"
},
{
"property": "email_opt_out",
"value": "true"
},
{
"property": "c_id__c",
"value": "Sample data for property c_id__c"
},
{
"property": "sandbox_key__c",
"value": "Sample data for property sandbox_key__c"
}
]
}
Make sure that the values you pass match the internal names of the corresponding property's options (if they exist). For example, the email_opt_in property will only accept true or false. Passing the label values yes or no will return errors.