How to set dropdown select custom property on contact via API

Hi

Im using this endpoint to create a contact

endpoint = ‘https://api.hubapi.com/contacts/v1/contact/’.

{

                "property": "lastname",

                "value": "myemail"

            },

            {

                "property": "drop\_down\_property",

                "value": "Public "

            }]

This doesnt set the value for the drop_down_property

The property exists on the contact but how do i set its value

Hey, @NAhmed4 :waving_hand: Thanks for reaching out. Here are examples using the v1 and v3 versions of this endpoint.

Steps taken for both:

  • Created a custom contact property — dropdown select
  • Grabbed the internal value to use in my API request

Update an existing contact — POST /contacts/v1/contact/vid/:vid/profile

  • My request URL and body

    POST https://api.hubapi.com/contacts/v1/contact/vid/901/profile​
    
    {
     "properties": [
     {
     "property": "new_mexico_chile",
     "value": "Green"
     }
     ]
    }
    
  • I received a 204 No Content response which indicates a successful update

  • From the documentation — “Response details – Returns a 204 with no response body when a contact is updated successfully.”

For the v3 version — Update a Contact:

  • Update a contact — PATCH/crm/v3/objects/contacts/{contactId}

  • Request

    curl --request PATCH \
     --url https://api.hubapi.com/crm/v3/objects/contacts/901 \
     --header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
     --header 'content-type: application/json' \
     --data '{
     "properties": {
     "new_mexico_chile": "Red"
     }
    }'​
    
  • Response

    HTTP 200
    
    {
     "id": "901",
     "properties": {
     "createdate": "2022-11-03T21:42:31.255Z",
     "hs_lifecyclestage_lead_date": "2022-11-03T21:42:31.255Z",
     "hs_pipeline": "contacts-lifecycle-pipeline",
     "lastmodifieddate": "2022-12-14T20:30:50.877Z",
     "lifecyclestage": "lead",
     "new_mexico_chile": "Red"
     },
     "createdAt": "2022-11-03T21:42:31.255Z",
     "updatedAt": "2022-12-14T20:30:50.877Z",
     "archived": false
    }​
    

Have fun building! — Jaycee

Hi Jaycee, how would you do that for multiple values? e.g. you want red and green to be selected

I’ve figured it out - just separate the values with a semicolon

Thank you for coming back and sharing your solution! — Jaycee