Cannot Populate Custom Contact Properties Using A POST API Request (but can using PATCH)

We are testing out Hubspot and we need to store additional custom properties against the Contact entity. We have added custom properties, for example pets_name, however we are finding that we are not able to populate this field when creating a new contact via a POST API request. It doesn’t complain when we supply the property in the request body, however the contact that is created does not contain any info in this field in the response nor the Hubspot CRM itself. We have found that we can populate this field by updating an already existing contact using a PATCH request, and we can then see the populated field when we do a subsequent GET request. What is the reason for this? I’m fairly certain we’re not doing anything wrong.

Hey, @MCrawley2. Thanks for your question. I have an example and a suggestion for you.

Example:

  • I created a custom property called pets name (pets_name)
  • Used this endpoint POST/crm/v3/objects/contacts and used the on-page example

Request

curl --request POST \
 --url https://api.hubapi.com/crm/v3/objects/contacts \
 --header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
 --header 'content-type: application/json' \
 --data '{
 "properties": {
 "company": "Wagstaff School",
 "email": "mrfrond@bobsburgers.com",
 "firstname": "Phillip",
 "lastname": "Frond",
 "website": "bobsburgers.com",
 "pets_name": "Kitty"
 }
}'​
  • Response

    HTTP 201
    
    {
     "id": "1701",
     "properties": {
     "company": "Wagstaff School",
     "createdate": "2023-04-20T20:15:25.553Z",
     "email": "mrfrond@bobsburgers.com",
     "firstname": "Phillip",
     "hs_all_contact_vids": "1701",
     "hs_email_domain": "bobsburgers.com",
     "hs_is_contact": "true",
     "hs_is_unworked": "true",
     "hs_lifecyclestage_lead_date": "2023-04-20T20:15:25.553Z",
     "hs_marketable_status": "false",
     "hs_marketable_until_renewal": "false",
     "hs_object_id": "1701",
     "hs_pipeline": "contacts-lifecycle-pipeline",
     "lastmodifieddate": "2023-04-20T20:15:25.553Z",
     "lastname": "Frond",
     "lifecyclestage": "lead",
     "pets_name": "Kitty",
     "website": "http://bobsburgers.com"
     },
     "createdAt": "2023-04-20T20:15:25.553Z",
     "updatedAt": "2023-04-20T20:15:25.553Z",
     "archived": false
    }​
    

In-app view of property and the source that added it (my private app)

My suggestion:

When posting questions, it’s helpful if you include an example request and response (for API-related questions). Not that you did anything wrong. I want to increase your chances of getting high-quality answers from the community the next time you post.

Best,

Jaycee