Answers.Body: <p>I did some research in the code. When you use the contact API, the default <em>Unsupervised</em> rule for the Contact Type. This rule is configurable in the <em>Contacts -> Find and Merge Duplicate Contacts</em> screen. </p>
  
  <p>Update: The contact has another option. You can use the <code>duplicatecheck</code> method. But it cannot be tested in the API explorer. The following code returns the contact_ids found deduplication rule 4 (Checking on email for Individuals).</p>
  
  <pre><code>$result = civicrm_api3('Contact', 'duplicatecheck', array(
       'return' =&gt; array("display_name"),
       'dedupe_rule_id' =&gt; 4,
       'check_permission' =&gt; FALSE,
       'match' =&gt; array(
          'contact_type' =&gt; 'Individual',
          'email'        =&gt; 'blue@example.com'
    )
  ));
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-30T19:16:57.493Z
Answers.Text: Actually you can test it in the API Explorer. Just add a parameter other as "match" and then you can put in the parameters like this:
  
  
  `{"contact_type":"Individual","email":"lee@email.org","last_name":"lastname","first_name":"firstname"}`
Answers.UserDisplayName: Sleewok
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-22T15:42:04.667Z
Answers.LastActivityDate: 2016-11-23T10:32:23.983Z
Answers.LastEditDate: 2016-11-23T10:32:23.983Z
Answers.UserDisplayName: Kainuk - CiviCooP
Answers.Body: <p>There are different sets of deduplication rules, and you can create your own. They may be:</p>
  
  <ul>
  <li>Unsupervised- are used automatically when contacts are created in certain ways, such as through imports, event registrations and profiles</li>
  <li>Supervised- are used to check/warn of possible duplicates when creating new contacts in the UI</li>
  <li>General- you can use these at your leisure from the "Find and Merge Duplicate Contacts" page</li>
  </ul>
  
  <p>What you're seeing in the API is probably only the Unsupervised rule, which should be deliberately strict. What you're warned about in the UI will be the Supervised rule.</p>
  
  <p>The docs: <a href="https://docs.civicrm.org/user/en/4.6/common-workflows/deduping-and-merging/" rel="nofollow noreferrer">https://docs.civicrm.org/user/en/4.6/common-workflows/deduping-and-merging/</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-22T16:11:14.413Z
Answers.Text: We even effectively disabled the unsupervised rule, by setting it to match on the contact ID. We have a signup process consisting of multiple Drupal Webforms, and together with unsupervised dedupe (I am informed, this is from before I worked here) it presented a possible information disclosure.
Answers.UserDisplayName: DaveFF
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-22T16:06:22.510Z
Answers.LastActivityDate: 2016-11-22T16:06:22.510Z
Answers.UserDisplayName: DaveFF
Body: <p>I am creating a contact using CiviCRM API, what I have noticed that the duplicate checking looks inaccurate compared to the check done when entering new contacts via the User Interface.</p>
  
  <p>Under the CiviCRM API, it's only a match if the given parameters are exactly the same like "John Smith of john@here.com" does not match "Johnathan Smith of john@here.com", for example, but in the UI, simply entering a matching e-mail address throws a warning.</p>
  
  <p>Is there a way to make the CiviCRM API dupe check behave more like the UI  ?</p>
  
  <p>I am passing the parameter <code>dupe_check = true</code>. The complete call is:</p>
  
  <pre><code>$result = civicrm_api3('Contact', 'create', 
            array( 'sequential' =&gt; 1,
                   'contact_type' =&gt; "Individual",
                   'first_name' =&gt; "raj", 
                   'last_name' =&gt; "l", 
                   'dupe_check' =&gt; 1, 
                   'api.Email.create' =&gt; array('email' =&gt; "raj@abc.com"), )
             );
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-11-17T12:15:15.147Z
Comments.Text: Are you using the *duplicatecheck* action from the Contact api? Maybe you can add some sample code?
Comments.UserDisplayName: Kainuk - CiviCooP
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-11-21T05:30:38.367Z
Comments.Text: Yes i am passing dupe_check = true.                                                                $result = civicrm_api3('Contact', 'create', array(
    'sequential' => 1,
    'contact_type' => "Individual",
    'first_name' => "raj",
    'last_name' => "l",
    'dupe_check' => 1,
    'api.Email.create' => array('email' => "raj@abc.com"),
  ));
Comments.UserDisplayName: MH9
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-06-30T21:48:38.620Z
Comments.Text: Note: in most cases, you probably want to pass `check_permissions: 0` in a call to api.Contact.create. The reason for this is that permissions are taken into account when checking for dupes, so an anonymous user who fills out a form is never going to get matched unless you have very permissive configs. Further note: client-side requests have `check_permissions` forced to 1, so you may have to get creative if you aren't working in PHP.
Comments.UserDisplayName: universalhandle
Tags: <contacts><api><duplicate-contacts>
Title: Make the Contact create API behave like UI in the way in checks for duplicates
ThreadText: # Make the Contact create API behave like UI in the way in checks for duplicates
  
  (Asked by: username_0 on 2016-11-16)
  
  I am creating a contact using CiviCRM API, what I have noticed that the duplicate checking looks inaccurate compared to the check done when entering new contacts via the User Interface.
  
  Under the CiviCRM API, it's only a match if the given parameters are exactly the same like "John Smith of john@here.com" does not match "Johnathan Smith of john@here.com", for example, but in the UI, simply entering a matching e-mail address throws a warning.
  
  Is there a way to make the CiviCRM API dupe check behave more like the UI ?
  
  I am passing the parameter `dupe_check = true`. The complete call is:
  
  ```
  $result = civicrm_api3('Contact', 'create', 
            array( 'sequential' => 1,
                   'contact_type' => "Individual",
                   'first_name' => "raj", 
                   'last_name' => "l", 
                   'dupe_check' => 1, 
                   'api.Email.create' => array('email' => "raj@abc.com"), )
             );
  
  ```
  
  **Tags:** contacts, api, duplicate-contacts
  
  > **Comments:**
  > **username_1**: Are you using the *duplicatecheck* action from the Contact api? Maybe you can add some sample code?  
  > **username_0**: Yes i am passing dupe_check = true.                                                                $result = civicrm_api3('Contact', 'create', array(   'sequential' => 1,   'contact_type' => "Individual",   'first_name' => "raj",   'last_name' => "l",   'dupe_check' => 1,   'api.Email.create' => array('email' => "raj@abc.com"), ));  
  > **username_2**: Note: in most cases, you probably want to pass `check_permissions: 0` in a call to api.Contact.create. The reason for this is that permissions are taken into account when checking for dupes, so an anonymous user who fills out a form is never going to get matched unless you have very permissive configs. Further note: client-side requests have `check_permissions` forced to 1, so you may have to get creative if you aren't working in PHP.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-11-22. Score: 1
  
  I did some research in the code. When you use the contact API, the default *Unsupervised* rule for the Contact Type. This rule is configurable in the *Contacts -> Find and Merge Duplicate Contacts* screen.
  
  Update: The contact has another option. You can use the `duplicatecheck` method. But it cannot be tested in the API explorer. The following code returns the contact\_ids found deduplication rule 4 (Checking on email for Individuals).
  
  ```
  $result = civicrm_api3('Contact', 'duplicatecheck', array(
       'return' => array("display_name"),
       'dedupe_rule_id' => 4,
       'check_permission' => FALSE,
       'match' => array(
          'contact_type' => 'Individual',
          'email'        => 'blue@example.com'
    )
  ));
  
  ```
  
  > **Comments:**
  > **username_3**: Actually you can test it in the API Explorer. Just add a parameter other as "match" and then you can put in the parameters like this:   `{"contact_type":"Individual","email":"lee@email.org","last_name":"lastname","first_name":"firstname"}`  
  
  ---
  
  ### Answer by username_4 on 2016-11-22. Score: 1
  
  There are different sets of deduplication rules, and you can create your own. They may be:
  
  * Unsupervised- are used automatically when contacts are created in certain ways, such as through imports, event registrations and profiles
  * Supervised- are used to check/warn of possible duplicates when creating new contacts in the UI
  * General- you can use these at your leisure from the "Find and Merge Duplicate Contacts" page
  
  What you're seeing in the API is probably only the Unsupervised rule, which should be deliberately strict. What you're warned about in the UI will be the Supervised rule.
  
  The docs: <https://docs.civicrm.org/user/en/4.6/common-workflows/deduping-and-merging/>
  
  > **Comments:**
  > **username_4**: We even effectively disabled the unsupervised rule, by setting it to match on the contact ID. We have a signup process consisting of multiple Drupal Webforms, and together with unsupervised dedupe (I am informed, this is from before I worked here) it presented a possible information disclosure.  
  
  ---
  
  