Retrieve Records for a Custom Object including all custom properties

I am using the following endpoint to retrieve the records for a Custom Object called recipes.

https://api.hubspot.com/crm/v3/objects/recipes

The returned response does not contain any information about the custom properties of this object:

"results": [
 {
 "id": "1213232423",
 "properties": {
 "hs_createdate": "2023-09-12T09:58:25.792Z",
 "hs_lastmodifieddate": "2023-09-12T09:58:46.104Z",
 "hs_object_id": "1213232423"
 },
 "createdAt": "2023-09-12T09:58:25.792Z",
 "updatedAt": "2023-09-12T09:58:46.104Z",
 "archived": false
 }
]

How can I get all records but also the values of custom properties?

Hey, @alvarofranz :waving_hand: Thanks for your question!

There are two ways to do this, depending on your use case + how many properties you need returned. You can get all the properties for an object by making a request to the Properties API.

The endpoint you referenced wants you to specify the properties you require in the request URL. It would look like this (note – my object is called Cats):

curl --request GET \
 --url 'https://api.hubapi.com/crm/v3/objects/cats?limit=10&properties=prop_1%2Cprop_2%2Cprop_3&archived=false' \
 --header 'authorization: Bearer YOUR_ACCESS_TOKEN'

But if you have many custom properties, there’s a chance you’ll hit the URL character limit.

If this is the case, you can use the Search API instead. This will let you include the properties you want in the request body, which allows for many more characters to be included.

Search API — Specify returned properties

Request body
{
 "properties": [ "custom-prop-1", "custom-prop-2", "custom-prop-3" ]
}

Have fun building! — Jaycee