Add person_id parameter to "Get all deals" endpoint

We need to be able to pull all deals matching a certain filter, plus person email or phone.
We can search for a person via email or phone and return their person_id.
Can you please add an optional person_id parameter to the “Get all deals” endpoint so that if we enter both a filter id and person id, it will return all deals matching both?


Reading over this a few times, I think I might be misunderstanding what you’re trying to accomplish. If you’re using a filter to get results, why not include the person email or phone within the variables of the filter you’re using?

Hi David,
Let me explain the use case:
Say I have a filter - all open deals with attached product X. Say the filter id is 61.
Say that there are 100 deals matching this filter.
Now, when a client makes a purchase on our website for product X, I want to search for his deal on pipedrive and update it from OPEN to WON.
This client may have several open deals (for several products) so I must search for the deal that matches this filter as it points to the specific product.
So the goal is to fetch the deal which matches filter 61, and the contact person’s email matches that of the client which just made the purchase - say

What we’re doing now is using the “Get all deals” api to fetch all deals matching filter_id 61, then iterating each deal, fetching the associated contact person’s email, comparing it to the requested email from the website purchase and if not - moving on to the next deal.
All of this is done through Zapier.
This iterative process works fine when there are a few (several hundred) deals matching the filter, but breaks on timeouts when there are many, due to its iterative nature.
Adding the person_id to the “Get all deals” api as an optional parameter would allow us to as follows:
(1) Seach for person with specific email address and return person_id, using this:!/SearchResults/get_searchResults_field
(2) Search for deal with filter_id AND person_id returned from (1) using this:!/Deals/get_deals

Two api calls, no iterative process, will work on filters with many deals and crowded filters.
Is it clearer now?


Thanks for the clarification - I can definitely see your point of how you would want to do this and I can clearly say there’s not a way to do this without 2 calls (like you’re doing now). I will make a request to trya and have this updated in the future.

thanks David, any chance this optional parameter will be added to the api soon?

There’s no current plans to add this to the API, but I was thinking. Wouldn’t it work if you would just add a variable to your original filter that you could update on each call?
Something like this:

"conditions": [
          "object": "person",
          "field_id": "9029",
          "operator": "=",
          "value": "1",
          "extra_value": null

Then, just keep value as “null” until you’re adding email address

FYI David - we implemented your suggestion and it works great!
It also enabled us to add additional functionality dyanmically, which we did not have before.
Thanks a lot!