Filter contacts by custom field

Hello,

there are a lot of topics about this already but I simply don’t get it. I have contacts with a particular field. Now I want to get the contacts that have a particular value for that field. I tried several things:

https://lendis.api-us1.com/api/3/contacts?filters[perstag]=
https://lendis.api-us1.com/api/3/contacts?filters[fieldid]=
https://lendis.api-us1.com/api/3/contacts?filters[fields][perstag]=
https://lendis.api-us1.com/api/3/contacts?filters[fields][fieldid]=
https://lendis.api-us1.com/api/3/contacts?perstag=
https://lendis.api-us1.com/api/3/contacts?fieldid=

I always get a list of contacts that don’t have that value in this field. In fact, the correct one is returned as well :slight_smile:

I even tried v1 of the api, but get a permission error:

https://lendis.api-us1.com/admin/api.php?api_action=contact_list?filters[fields][perstag]=...&api_key=

What am I doing wrong?

2 Likes

I have the same problem, did you get an answer to this?

Think of custom fields as it’s own table linked to the contact table.
You have to query this custom field values table:
https://lendis.api-us1.com/api/3/fieldValues?filters[fieldid]=fieldId&filters[val]=fieldValue

There is also a feature to include the assigned contact in the response, so you don’t need an additional query -> add …&include=owner

But be warned, the API is generally not very consistent and I couldn’t figure out how to query deals by custom deals field value.

Suuper, you saved my day :slight_smile:

1 Like