There is a system where we answer calls from our members. We save all of these calls by creating contact information on CiviCRM and create the conversation in an activity.

People answering the calls create a contact by entering different information on the same number. I don't want that to happen. So, Can she create an API to enter a phone number and output a name?

2 Answers 2


You can, certainly - but it sounds like what you really want to do is set the Supervised Dedupe rule to dedupe on phone number. That way, when someone enters a new contact, when they try to save it, it will recognize the person as a duplicate.

  • I have been using CiviCRM for about 10 years. But I couldn't make the registration to the same number from the rules. Most of them also damaged the database. I had to reinstall. This is probably related to the number format used in our country. The other company will give me a code. It is necessary to bring that code together with the API, a doc that explains how to do this. Is there? Oct 23, 2020 at 12:22

Can she create an API to enter a phone number and output a name

If I understand the question right, the API is already available. If you simply need an api that provides the name based on phone number, you can use -

$contact = civicrm_api3('Phone', 'get', [
  'sequential' => 1,
  'return' => ["contact_id"],
  'is_primary' => 1,
  'phone_numeric' => <numeric value of the phone number>, // 12345678 if phone number is 12-345-678
  'api.Contact.get' => ['id' => "\$value.contact_id"],

$contact has all the information related to contact. You can try more such API combination from the API explorer

enter image description here

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.