I've been using 'dupe_check' = true in contact_add to ensure that I'm not duplicating contacts. However when a dupe is found, matching IDs are returned in the error string like so:
array ( 'is_error' => 1, 'error_message' => 'Found matching contacts: 311799,45678', )
This makes the matched IDs dificult to work with. Ideally they would be in a seperate array element like so (which has the added benefit of leaving the error message consistent)
array ( 'is_error' => 1, 'error_message' => 'Found matching contacts', 'matching_contacts' => array(311799 => 311799, 45678 => 45678, ), )
I took a look at writing a patch, but it would require changing civicrm_contact_check_params(), CRM_Core_BAO_UFGroup::findContact(), and CRM_Contact_BAO_Contact::matchContact().