Large object search by property

Hey, I’m trying to integrate Hubspot with our payment gateway which processes thousands of updates every day.
To reduce overheating and work around the API Rate limit, I’m using the batch API.
I’m trying to implement a batch update of 200 records and for this, I need to find the id of all objects I’m trying to update. I’m running a search trying to find objects by properties, let’s say “email” to simplify.
The problem I’m finding is that I can’t seem to find a working example of how to use the IN operator. I always get an error related to parsing the filter object. I’ve tried sending a comma separated value, a JSON stringified value or a plain JSON object array.
I tried passing “value” or “values”. Nothing worked.
I’ve followed this documentation:

I’m using the official nodejs SDK.
And also tried the solutions in this thread:
https://community.hubspot.com/t5/APIs-Integrations/Hubspot-API-How-do-you-use-IN-filter-operator/td-p/512907
Sending multiple filter groups worked, but it only accepts 5 and I need 200.

Here is a pseudocode of what I’ve been trying to do:

 async findAll(objectType : string, emails: string[]) {
 const filterGroups: FilterGroup[] = [
 {
 filters : [
 {
 value : emails,
 propertyName: 'email',
 operator: 'IN'
 }
 ]
 }
 ]

 return this.getClient().crm.objects.searchApi.doSearch(objectType, filterGroups);
 }

Hi @dino56,

I’ve successfully used the IN operator in the past, but I know it was a pain !
Here is a working JSON body of a Postman request to the search endpoint :

{
 "filters" : [
 {
 "propertyName" : "email",
 "operator": "IN",
 "values": ["tutu@gmail.com","toutou@gmail.com"]
 }
 ]
}

I think you should be fine if adding the values as a JSON array, and you’re right to use values as a key instead of value. What response do you get when posting to this endpoint ?
Since the request is quite simple to make, have you tried using axios instead of the official library ?

It’s working fine, I’m able to get large objects.
But I need the same order as the request sent. Is this possible to get the same order or any other order

Hey, thanks for the answer.
I’ve checked the payload at the dashboard and seems like the node SDK removes the “values” key from this request.
I’ll try using the HTTP API directly, thanks again for the advice.