Is there a way to search by relationship in the Contact.get API call?

Eg: give me all the contacts that are individuals, in group 9 and have a relationship type 8 (optionally specifying direction and/or the other contact) ?

I'm modifying existing code that builds a variety of filters into a Contact.get call and I want to add relationships to that.

The new join feature in 4.7 looks hopeful except that it is not advertised for Contacts in the API explorer.

  • Correct, the Contact api unfortunately uses a legacy query builder that prevents it from supporting joins.
    – Coleman
    Sep 14, 2016 at 20:21

1 Answer 1


This is going to require a second api call, first to retrieve a list of relationships for the 2nd contact, use a php loop to turn the list of relations into an array, and then you can add that to the original api call like

'id' => array('IN', $related_contact_ids)

PS. I'm not sure if the contact api3 supports this syntax.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.