CRM Search API - Not Returning The Correct Number Of Results

I have made a POST request to https://api.hubapi.com/crm/v3/objects/deals/search?hapikey=YOUR_HUBSPOT_API_KEY with the following body params:

“propertyName”: “dealstage”,
“operator”: “EQ”,
“value”: “closedwon”

The response contained only 5 deals. When I check my HubSpot account i have 410?

Hey @michaelbarley,

That’s strange. Would you mind sharing with me your HubSpot portal ID in question?

Hi @WendyGoh

Sure it’s: 4593466

Hey @michaelbarley,

Thanks for sharing that!

Digging into this, I’m able to confirm that this is because the internal value for the deal stage label - ‘Closed won’ is set as ‘contractsent’. If you use the following post body:

{
 "filterGroups":[
 {
 "filters":[
 {
"propertyName": "dealstage",
"operator": "EQ",
"value": "contractsent"
 }
 ]
 }
 ]
 }

The result would return 411 closed won deals.

Currently the internal value ‘closedwon’ is pointing to deal stage label - ‘Closed lost’ and since the portal has 5 deals with a deal stage of ‘Closed Lost’, the return results was 5.

You can check your deals pipeline internal id by going to Settings > Expand ‘Sales’ > Click ‘Deals’ > Hover over a certain deal stage > Click the ‘</>’ icon.

Hope this helps to shed some lights!

Hey @WendyGoh ,

Thank you so much! I was very confused haha :smiley: