Method for Batch Retrieval of Deals is Vague

I’m trying to pull a list of Deals using a custom property. I’m using this endpoint:

POST/crm/v3/objects/deals/batch/read

The documentation is too vague but states that one can “Read a batch of deals by internal ID, or unique property values”. I’m trying to pass a list of values for a custom property in order to get a list of deals that match that property value. Here’s what I’m passing:

curl --request POST \
	--url 'https://api.hubapi.com/crm/v3/objects/deals/batch/read?archived=false&hapikey=*-*-*-*-*' \
	--header 'content-type: application/json' \
	--data '{
 "inputs": [
 {
 "id": "51349"
 },
 {
 "id": "51350"
 }
 ], 
 "idProperty": "vboe_quote_id", 
 "properties": [
 "amount",
 "hubspot_owner_id",
 "dealname",
 "dealstage"
 ]
}'

I get the following error message back:

{
 "completedAt": "2021-04-13T13:24:04.105Z", 
 "errors": [
 {
 "category": "OBJECT_NOT_FOUND", 
 "context": {
 "ids": [
 "51350", 
 "51349"
 ]
 }, 
 "message": "Could not get some DEAL objects, they may be deleted or not exist. Check that ids are valid.", 
 "status": "error"
 }
 ], 
 "numErrors": 1, 
 "results": [], 
 "startedAt": "2021-04-13T13:24:04.088Z", 
 "status": "COMPLETE"
}

Note that ‘vboe_quote_id’ is my custom property but has nothing to do with HubSpot quotes. So, don’t let that mislead you. :slightly_smiling_face:

What’s the correct way to use this endpoint?

Thanks

-Scot

Hey @SCatlin

Is the vboe_quote_id identified as a unique property?

If you scroll down to the “creating your own unique identifiers” section on this page, you will see an example.

@PCarlson , @MichaelC are both more talented than I am and may have more insights so adding them here as well

Hi @SCatlin

To read batch of deals based on custom properties I myself use v3/objects/deals/search query.

https://api.hubapi.com/crm/v3/objects/deals/search?hapikey=

In my print screen below I have a custom property called “avtalsnummer” and I want to recieve a specific deal with a specific avtalsnummer. If you want to add more search querys or get more results the “filters” is an array and can easly be added with more filters using comas.

More documentation here:

Endpoint: Search

Example with many query here (ignore the fact that its the same property I copy pasted

@MichaelC

Thanks! I ended up using the same search endpoint but using some other properties to narrow down the results. Then, I filter futher in code to get what I need.

However, I might modify my code to do what you’re suggesting as the result set size is likely to grow as my client uses HubSpot more and more.

I appreciate you’re taking the time to help out.