Question about batch endpoints for deals/companies

Hello!

I’ve been trying to call the POST/crm/v3/objects/deals/batch/read and POST/crm/v3/objects/companies/batch/read methods to get deals and companies by id (“hs_object_id”), but I keep getting this error:

{
 "status": "COMPLETE",
 "results": [],
 "numErrors": 1,
 "errors": [
 {
 "status": "error",
 "category": "OBJECT_NOT_FOUND",
 "message": "Could not get some DEAL objects, they may be deleted or not exist. Check that ids are valid.",
 "context": {
 "ids": [
 "4029040193"
 ]
 }
 }
 ],
 "startedAt": "2021-03-10T21:04:11.378Z",
 "completedAt": "2021-03-10T21:04:11.394Z"
}

I get the same error for companies. I’ve been trying requests like this:

curl --location --request POST 'https://api.hubapi.com/crm/v3/objects/deals/batch/read?archived=false&hapikey=*******' \
--header 'content-type: application/json' \
--data-raw '{
 "properties": [
 "name"
 ],
 "idProperty": "hs_object_id",
 "inputs": [
 {
 "id": "4029040193"
 }
 ]
}'

Could anybody please tell me what the correct way of using these endpoints is?

Hey @lgomez

I am assuming that in that second code block, you used companies in the request.

If you remove the idProperty line of code, you should get some results

Awesome. After removing `idProperty`, it works like a charm.

Thank you!