Hubspot API: Get Contact Custom Object Records with Hubl (Solved)

CR Rollyson
2 min readNov 1, 2024

--

Seems straightforward enough, but for some reason it isn’t until it is. Sound familiar? Likely.

This walkthrough assumes you have already:

  1. Created a Hubspot Private App and have the Bearer Token (this request requires setting an Authorization Bearer Token using your private app token)
  2. Created a Hubspot Custom Object and associated it bi-directionally to Hubspot’s defined Contacts Object
  3. Have the Custom Object ID (this can be found in the URL path when viewing the Custom Object in Hubspot)

Step 1:
Get the association ID by using a GET request to this URL endpoint, where {your-custom-object-id} is the Custom Object number:

https://api.hubapi.com/crm/v3/associations/contacts/{your-custom-object-id}/types

Screenshot from Postman Interface to the Hubspot Association’s API Endpoint
Screenshot from Postman Interface with the results of the API Endpoint GET Request

Step 2:
Take the returned association id number from the GET request results and construct the Hubl logic (the first number should be a known contact ID who you know has a custom object record associated to ensure it’s working for you):

{% set associated_object_records = crm_associations({any-contacts-id-with-known-custom-object-records}, “USER_DEFINED”, ASSOCIATION_NUMBER, false) %}

Screenshot setting up the Hubl logic to get the CRM Associations records

Step 3:
Then output using Hubl in your HTML:

{{ associated_object_records }}

Screenshot showing Hubl output from above using a known contact ID

Hope this helps √

This is part of my Hubspot API shorts as I’m working through Custom Objects.

--

--

CR Rollyson
CR Rollyson

Written by CR Rollyson

UX & Web mgr for a S&P 500 Fintech & COO of Side Role, a marketing team partnering w In-house Teams & Agencies, Non-profits, & Start-Ups. https://siderole.com