APIs & Integrations

CDzieg
Member

custom contact properties

SOLVE

As an example I have a custom property, Current Period End Date, under Contact Information of a customer profile. Using the /crm/v3/objects/contacts/{contactId} endpoint I am not able to get this field to return anything for a test cutomer that had the property value defined. I have tried adding properties=CurrentPeriodEndDate (property name without spaces), this seems to work for some other properties, but I do not get anything back. Coud someone please clarify what I am doing wrong?

0 Upvotes
1 Accepted solution
Jaycee_Lewis
Solution
Community Manager
Community Manager

custom contact properties

SOLVE

Hey, @CDzieg 👋 Thanks for sticking with me. If you want to update the value of a custom property for a specific record, a Contact for example, we can use this endpoint and a PATCH request — Update.

Here's an example using the test property we created from before —  current_period_end_date:

  • I have a Contact with an existing value for this property. It was set as 1-30-23.
  • Using the on-page example.
    Endpoint used PATCH/crm/v3/objects/contacts/{contactId}
  • Request
    curl --request PATCH \
      --url https://api.hubapi.com/crm/v3/objects/contacts/1001 \
      --header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
      --header 'content-type: application/json' \
      --data '{
      "properties": {
        "current_period_end_date": "2023-01-31"
      }
    }'​
  • Response
    HTTP 200
    
    {
      "id": "1001",
      "properties": {
        "createdate": "2022-11-03T21:42:31.255Z",
        "current_period_end_date": "2023-01-31",
        "first_deal_created_date": "2023-01-25T23:29:16.588Z",
        "hs_created_by_user_id": "10233975",
        "hs_is_contact": "true",
        "hs_is_unworked": "true",
        "hs_object_id": "1001",
        "hs_pipeline": "contacts-lifecycle-pipeline",
        "hs_time_between_contact_creation_and_deal_creation": "7177605333",
        "hs_updated_by_user_id": "10233975",
        "lastmodifieddate": "2023-01-27T23:30:41.408Z",
        "lifecyclestage": "opportunity",
        "notes_last_updated": "2023-01-27T18:21:43.054Z"
      },
      "createdAt": "2022-11-03T21:42:31.255Z",
      "updatedAt": "2023-01-27T23:30:41.408Z",
      "archived": false
    }​
  • And we can see it reflected on the timeline (Agitated Toothbrush is the name of the Private App I used to make the call 🤣)
    CleanShot 2023-01-27 at 16.31.06.png

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

View solution in original post

0 Upvotes
5 Replies 5
Jaycee_Lewis
Community Manager
Community Manager

custom contact properties

SOLVE

Hi, @CDzieg 👋 One quick request, can you navigate to Settings > Properties > Contacts and click into your custom property, please? We can verify the Internal name for this property. This should give you the correct value to include in your request. 

 

I did a quick test and used your property name. Here's a screenshot:

CleanShot 2023-01-19 at 16.56.43.png

Then you can make a request to the endpoint that would look like this (or use the internal value for your property if it is different)

 

curl --request GET \
  --url 'https://api.hubapi.com/crm/v3/objects/contacts/901?properties=current_period_end_date&archived=false

 

 

Have fun building! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
CDzieg
Member

custom contact properties

SOLVE

Thank you, I was able to correctly get the name of the property and retrieve it. I'd like to follow up with how do you update the property?

Jaycee_Lewis
Community Manager
Community Manager

custom contact properties

SOLVE

Hi, @CDzieg! Have you checked out the Update a property endpointPATCH/crm/v3/properties/{objectType}/{propertyName} 

 

If you run into any trouble, please post your request, response, and the full error body. And the community will be happy to take a look. 

 

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
CDzieg
Member

custom contact properties

SOLVE

Sorry, maybe that question was phrased incorrectly. I meant for a specific contact how do I update the value for one of these custom properties.

0 Upvotes
Jaycee_Lewis
Solution
Community Manager
Community Manager

custom contact properties

SOLVE

Hey, @CDzieg 👋 Thanks for sticking with me. If you want to update the value of a custom property for a specific record, a Contact for example, we can use this endpoint and a PATCH request — Update.

Here's an example using the test property we created from before —  current_period_end_date:

  • I have a Contact with an existing value for this property. It was set as 1-30-23.
  • Using the on-page example.
    Endpoint used PATCH/crm/v3/objects/contacts/{contactId}
  • Request
    curl --request PATCH \
      --url https://api.hubapi.com/crm/v3/objects/contacts/1001 \
      --header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
      --header 'content-type: application/json' \
      --data '{
      "properties": {
        "current_period_end_date": "2023-01-31"
      }
    }'​
  • Response
    HTTP 200
    
    {
      "id": "1001",
      "properties": {
        "createdate": "2022-11-03T21:42:31.255Z",
        "current_period_end_date": "2023-01-31",
        "first_deal_created_date": "2023-01-25T23:29:16.588Z",
        "hs_created_by_user_id": "10233975",
        "hs_is_contact": "true",
        "hs_is_unworked": "true",
        "hs_object_id": "1001",
        "hs_pipeline": "contacts-lifecycle-pipeline",
        "hs_time_between_contact_creation_and_deal_creation": "7177605333",
        "hs_updated_by_user_id": "10233975",
        "lastmodifieddate": "2023-01-27T23:30:41.408Z",
        "lifecyclestage": "opportunity",
        "notes_last_updated": "2023-01-27T18:21:43.054Z"
      },
      "createdAt": "2022-11-03T21:42:31.255Z",
      "updatedAt": "2023-01-27T23:30:41.408Z",
      "archived": false
    }​
  • And we can see it reflected on the timeline (Agitated Toothbrush is the name of the Private App I used to make the call 🤣)
    CleanShot 2023-01-27 at 16.31.06.png

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes