# \[Hubspot API\] How do you use IN filter operator?

**URL:** <https://community.hubspot.com/t/hubspot-api-how-do-you-use-in-filter-operator/45613>\
**Category:** APIs & Integrations\
**Tags:** python\
**Created:** [October 20, 2021, 9:09am UTC](https://community.hubspot.com/t/hubspot-api-how-do-you-use-in-filter-operator/45613 "2021-10-20T09:09:40Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Teun](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/teun/32/28739_2.png) [@Teun](https://community.hubspot.com/u/Teun)\
**Post date:** [October 20, 2021, 5:37pm UTC](https://community.hubspot.com/t/hubspot-api-how-do-you-use-in-filter-operator/45613/2 "2021-10-20T17:37:56Z")

</div>

Hi @CSwart ,

I checked the Deals docs, and I think you can retrieve the deals with two endpoints.

**Batch read (inputs= should get your array of ID’s):**

```lia-code-sample
import hubspot
from pprint import pprint
from hubspot.crm.deals import BatchReadInputSimplePublicObjectId, ApiException

client = hubspot.Client.create(api_key="YOUR_HUBSPOT_API_KEY")

batch_read_input_simple_public_object_id = BatchReadInputSimplePublicObjectId(properties="dealname", inputs=[{"id":"3651752129"},{"id":"3741754830"}])
try:
 api_response = client.crm.deals.batch_api.read(archived=False, batch_read_input_simple_public_object_id=batch_read_input_simple_public_object_id)
 pprint(api_response)
except ApiException as e:
 print("Exception when calling batch_api->read: %s\n" % e)

```

**Search:**

```lia-code-sample
import hubspot
from pprint import pprint
from hubspot.crm.deals import PublicObjectSearchRequest, ApiException

client = hubspot.Client.create(api_key="YOUR_HUBSPOT_API_KEY")

public_object_search_request = PublicObjectSearchRequest(filter_groups={"filters":[{"value":"3741754830","propertyName":"hs_object_id","operator":"EQ"},{"value":"3651752129","propertyName":"hs_object_id","operator":"EQ"}]}, sorts="dealname", query="string", properties="dealname", limit=10, after=0)
try:
 api_response = client.crm.deals.search_api.do_search(public_object_search_request=public_object_search_request)
 pprint(api_response)
except ApiException as e:
 print("Exception when calling search_api->do_search: %s\n" % e)

```

OR:

```lia-code-sample
import hubspot
from pprint import pprint
from hubspot.crm.deals import PublicObjectSearchRequest, ApiException

client = hubspot.Client.create(api_key="YOUR_HUBSPOT_API_KEY")

public_object_search_request = PublicObjectSearchRequest(filter_groups={"filters":[{"value":"[\"3651752129\", \"3741754830\"]","propertyName":"hs_object_id","operator":"IN"}]}, sorts="dealname", query="string", properties="dealname", limit=10, after=0)
try:
 api_response = client.crm.deals.search_api.do_search(public_object_search_request=public_object_search_request)
 pprint(api_response)
except ApiException as e:
 print("Exception when calling search_api->do_search: %s\n" % e)

```

---

_[View the full topic](https://community.hubspot.com/t/hubspot-api-how-do-you-use-in-filter-operator/45613)._
