Problem with finding deal ID by person ID or phone number

Hi,

I can see that deals return data like

person_id->phone->0->value

but can’t figure out how to filter by this value

I don’t want to use typical filters because each request will ask for different number
so I just need to limit results to number in particular request or at least person ID

I see there is itemSearch and Deals with fields as phone but it doesn’t return ID of a deal
which is crucial for me.

Can you post an example GET syntax to search or filter by phone number or at least person ID ?

Hi,

I totally get the issue you’re facing! Unfortunately, the Pipedrive API doesn’t provide a straightforward way to filter deals directly by phone number. However, one way around this is to first search for the person using the phone number and then retrieve the related deals.

You can start by using the itemSearch endpoint to search for the person based on the phone number. Once you get the person_id, you can use that ID to find the associated deals.

For example, you can search for a person by phone number like this:

GET /v1/itemSearch?term={phone_number}&item_type=person

This will give you the person_id, which you can then use to fetch the deals connected to that person.

It’s a bit of a two-step process, but this way, you can dynamically find the right deals based on the phone number in your requests. Hopefully, this helps! If you need more specific details or run into any issues, feel free to ask.

You can dynamically update a filter with API requests - Pipedrive API Reference

If you need to understand the JSON structure, create an example filter in Pipedrive web interface, then GET that filter via API and output JSON.stringify() of it. From there you should be able to update that filter with a similar structure for a different phone number, then use that filter_id in other deals/persons API calls as needed.