# Using Search API to get deals

**URL:** <https://community.hubspot.com/t/using-search-api-to-get-deals/86922>\
**Category:** APIs & Integrations\
**Tags:** object\
**Created:** [August 7, 2023, 12:52pm UTC](https://community.hubspot.com/t/using-search-api-to-get-deals/86922 "2023-08-07T12:52:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![asmmlkmblive](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@asmmlkmblive](https://community.hubspot.com/u/asmmlkmblive)\
**Post date:** [August 7, 2023, 12:52pm UTC](https://community.hubspot.com/t/using-search-api-to-get-deals/86922/1 "2023-08-07T12:52:22Z")

</div>

Hi all, I’m using the “/crm/v3/objects/deals/search” endpoint to get a list of deals. I need to put 4 filters (all of them with AND).

1. Company name X
2. Deal isn’t closed
3. Project ID is unknown
4. Close date is between specific dates

I know there’s a limitation of maximum three filterGroups with up to three filters in each group and this is becoming an issue for me.

I’ve put the first three filters in a filtergroup and the next one as a separate filtergroup. Is there a way to use AND between two filter groups or some other way that’d allow me to put the filters mentioned above?

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [August 8, 2023, 6:38pm UTC](https://community.hubspot.com/t/using-search-api-to-get-deals/86922/2 "2023-08-08T18:38:27Z")

</div>

Hi, @asmmlkmblive 👋 To confirm, you are not missing a documented solution. I agree, being able to “chain” **AND** statements would be useful. And in this case, it is not possible.

Hey, @louischausse @MatthiasWeber @coldrickjack, do you have any creative solutions for the problem @asmmlkmblive is trying to solve?

My instinct is that you’ll need to break this into pieces on way or another.

You could try to:

- make your request using the three filters in one group
- add the fourth as a property to be returned
- filter the “filter as property” externally (Middleware or a simple server could work) and then send the results to their destination

Or make two calls:

- the first would use three of your filters in a group
- the second would be your fourth filter
- it will take some investigation to understand which filters to group and which to send solo to get the most efficient results
- handle the final sorting and matching on your end via your app or Middleware of your choosing

I know this isn’t what you were asking for. And I hope it helps light a creative spark and get you unstuck and onto the next step.

Best,

Jaycee

---

<div class="post-metadata">

**Author:** ![asmmlkmblive](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@asmmlkmblive](https://community.hubspot.com/u/asmmlkmblive)\
**Post date:** [August 8, 2023, 6:46pm UTC](https://community.hubspot.com/t/using-search-api-to-get-deals/86922/3 "2023-08-08T18:46:14Z")

</div>

Hey Jaycee, thanks for responding.

Yeah, I figured out it wasn’t possible, so I created a workflow that handles the filtering part and sets a new ‘custom property’ to 1 or 0. I used that in my API call, and it worked.

Cheers!

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [August 8, 2023, 7:06pm UTC](https://community.hubspot.com/t/using-search-api-to-get-deals/86922/4 "2023-08-08T19:06:08Z")

</div>

Hey, @asmmlkmblive 👋 I appreciate you letting us know how you solved your challenge. I didn’t think of doing it that way. Thanks for teaching me a new trick!

Have fun building! — Jaycee
