An organization's success is directly dependent on the way they represent and organize their data. It is evaluated that many successful organizations have a more streamlined and organized database. Thus, to help all types of businesses, HubSpot provides the ability to create custom CRM objects to define and manage their data more efficiently.
If you are a HubSpot Enterprise user, then you can surely leverage this feature of custom objects. Well! In HubSpot, there are four standard CRM objects, including tickets, deals, companies, and contacts.
Say if you want to create more properties that will allow you better manage your data, then defining a custom object via API is the only way to fulfill your goals.
But before we jump into the steps of creating a custom object in HubSpot, let's first know about the importance of using custom objects in HubSpot.
People using custom objects can easily;
Are you excited about creating custom objects for your business? Now, let's learn how it actually works.
Let's get started…..
Note- To get started with the creation of custom objects in HubSpot, it is vital to have a HubSpot key.
Step-1 Navigate to the setting.
Step-2 Select the API key from the sidebar. Copy this API if created; if not, then create and copy HubSpot API key for permission of API.
Once you get the API key, it's time to create a custom object in HubSpot using API code.
Step-3 The code added below will help you to create custom objects easily. In this code, I have named the key as "custom_users." But you can change the name as per your open requirements.
The name and key are "custom_users." If you don't have any requirements, then you can also use this key. This code is created in PHP, and the method used is POST
Have a look at the below Curl Request-
Step-4 Once you run this code, you will get the response as shown in the below-added screenshot-
Step-5 If you redirect to a similar page, then it means that you have successfully created a custom object in HubSpot. Have a look at the below screenshot-
Step-6 With the help of creating custom_users, you can create any user. In the code shared above, I have listed Name, Gender, and Email property, just as shown below. Here you can add more properties in POST requests.
Note- Many of you might be wondering about the association. The good news here is that you don't need to perform extra steps. When you run the above code of API, the association will be done automatically.
Step-7 Now, if you want to get the entire data definition of custom object schema, then using the below code will help you succeed.
With this PHP code, you can get the custom object layout to get more details.
Method- GET
Curl Request-
Step-8 Once you run this code, you will get an output as shown below-
Step-9 Now, if you want to update the custom objects such as name, gender, etc., or want to add more fields, then you can use the below URL request.
Here, the method used is PATCH.
https://api.hubapi.com/crm/v3/schemas/p<PORTAL_ID>_custom_users?portalId=<PORTAL_ID>&hapikey=demo
Here, you have to use your own portal ID and the name of your custom object.
Curl Request:
Step-10 Many times, we are in a situation where we want to delete a custom object. For deletion, you can use the below code, which is written in PHP.
Here the method used is DELETE.
Curl request-
Step-11 Usually, the above code will automatically associate each property. But if you want to associate another property that is not listed in the above code, then the below URL request will allow you to proceed further.
The below code is created using PHP, and the method here is- POST.
https://api.hubapi.com/crm/v3/schemas/p<PORTAL_ID>_custom_users/associations?portalId=<PORTAL_ID>&hapikey=demo
Make sure you use your own portal ID.
Curl request-
Step-12 If you want to associate with different objects, then you can use the below API, where you have to use your own portal ID and custom object name.
Here the method used is POST.
https://api.hubapi.com/crm/v3/associations/p<PORTAL_ID>_custom_users/contact/batch/create?portalId=<PORTAL_ID>&hapikey=demo
Curl Request:
Note- Many times; people don't know where to find the custom object ID. Well! You can refer to the below screenshot to know where you can get this ID.
Read more about- How to use HubSpot contact API.
It's well said that" Custom objects are a game-changer. They provide the flexibility to store any kind of data in HubSpot, maintaining all of the power and ease-of-use that teams need to scale and grow."
Well! Creating custom objects in HubSpot is not easy, but hopefully, the above steps will help you in creating custom objects in HubSpot using API without any hassle. By following each point and exact code, you can easily create custom objects for your unique business case.
Still, if you face any challenges in creating custom objects in HubSpot, feel free to reach us.
Editor- Divya Verma