search api properties, but cannot find properties mapping

Hi,our company is using hubspot’s api, and we’re having some issues with the query interface.
For example, when using the deal search api, we want to return the deal property we need, such as ‘deal owner’, but I can’t find the mapping property in the field requested by the interface. I try to use deal_owner or dealowner or deal owner, in properties, it doesn’t work.

{
 "filterGroups": [
 {
 "filters": [
 {
 "value": "88759199",
 "propertyName": "hubspot_owner_id",
 "operator": "EQ"
 }
 ]
 }
 ],
 "sorts": [
 "name"
 ],
 "properties": [
 "hubspot_owner_id",
 "associations_company_id",
 "responds_to_reviews",
 "deal_owner", <-- it doesn't work
 "dealowner" <-- it doesn't work
 ],
 "limit": 10,
 "after": 0
}

Is there somewhere you can view mappings between deal properties and request fields, or are there any rules for mapping information?

Hi, @jasoncheng :waving_hand: Thanks for the great questions. Let’s break them out and get you some clarity.

If you need to view the details for all properties for an Object (Contact, Tickets, Deals, etc) you can make a request to the endpoints here — HubSpot Properties API. You can retrieve the internal value for any of your properties here.

For your request body — I think there is a bit of confusion here. The property named (labelled) Deal Owner has an internal value of `hubspot_owner_id`. This matches what you are using in your filter group and your property group. There isn’t a separate property with an internal value of deal_owner.

We can verify this by using the above-mentioned Properties endpoint and in-app:

In-app — navigate to Settings > Properties > Deal properties. Enter Deal Owner into the search > click into the property details > click the </> icon to reveal the internal value for the property — `hubspot_owner_id`

Via the Properties API

GET /crm/v3/properties/{objectType}/{propertyName}

We can see the internal value for Deal Owner is `hubspot_owner_id`

Request:

curl --request GET \
 --url 'https://api.hubapi.com/crm/v3/properties/deals/hubspot_owner_id?archived=false' \
 --header 'authorization: Bearer YOUR_ACCESS_TOKEN'

Response:

HTTP 200

{
 "updatedAt": "2023-01-10T23:43:41.247Z",
 "createdAt": "2020-06-30T15:57:38.418Z",
 "name": "hubspot_owner_id",
 "label": "Deal owner",
 "type": "enumeration",
 "fieldType": "select",
 "description": "User the deal is assigned to. Assign additional users to a deal record by creating a custom user property.",
 "groupName": "dealinformation",
 "options": [],
 "referencedObjectType": "OWNER",
...
}

Now if the issue is that you are getting back the internal value in your response for `hubspot_owner_id` in the properties group, meaning 123456789 vs Bob Belcher, that is the expected behaviour. You’ll need to associate the internal value to the label outside this call.

You can get the values for `hubspot_owner_id` from the Owner API.

Have fun building! — Jaycee

Thank you very much. That solves my confusion!