Matching
Matching is the process of searching and identifying existing customer profiles in a database by specific data. It is used to update customer information and prevent the creation of duplicate records in the database.
When importing profiles into the database (from a file, via API query or from an external SQL table), you specify the profile search mode:

During the import process, the platform compares this data with what is already in the database. If it finds a profile with the same data, it updates it. If it doesn't find it, it creates a new profile.
Note, the data you are going to use for the search must be in the source. For example, if you are importing data from a file and select email search mode, make sure you have a column with email addresses in your file.
Matching modes
The following modes are available:
- By email, from profile or subscriptions - search by email from database or subscriptions.
- By email from profile - search by database profile email.
- By email from subscriptions - search by email from subscriptions only.
- By phone, from profile or subscriptions - search by phone in database field or SMS subscriptions.
- By phone from SMS subscriptions - search by phone from SMS subscriptions only.
- By push data from subscriptions - search by the identifier of push subscription (device token).
- By device identifier (
device_id) from the In-App channel subscription - By profile identifier - search by system identifier profile_id.
- By user-defined field - search by a user-defined database field, like customer ID in company CRM.
- By user-defined field from subscriptions- search by a user-defined database field from subscriptions only.
- Multimatching - by Email or phone from profile and subscriptions (email_phone), or by email or phone from subscriptions (email_phone_sub).
Matching features
There are several important nuances related to matchmaking:
- The field by which the search is performed must be unique for each profile. The value of this field should not be the same for different profiles in the same database.
- It is not recommended to use different types of matching in the same database to avoid duplicate profiles.
- If you do not pass the search mode in the matching field when importing or updating profiles via API, the platform will search for the profile by email address.
If you are going to use custom field matching, you should contact the platform administrator to create an index for this field. Thanks to the index, searching for a profile in the database will take much less time.
Profile processing mechanism
When the platform receives customer data (from a file, via API, or from an external SQL table), it processes it in the following order:
1. Profile search. The platform searches the database for a profile whose search field value matches the data from the source.
- A profile is found — it is updated.
- No profile is found — a new profile is created.
- If the profile search mode is not passed in an API request, the platform searches by email address.
2. Import mode. Depending on the selected import method, the platform may react differently to a found or not found profile:
- Add new and update existing — found profiles are updated, and not found ones are created.
- Only add new, do not update existing — if a profile with such data already exists in the database, the record is skipped: the existing profile is not updated, and a new one is not created.
- Only update existing, do not add new — if a profile is not found, a new one is not created: the record is skipped.
3. Field update. Only the fields that are passed in the data are updated. The values of the other profile fields remain unchanged.
- By default, an empty value in the source overwrites the current field value in the database.
- If the "Ignore empty values" option is enabled, empty values do not update the fields — the previous content stays in them.
4. Tags. Tags passed in the data are added to the profile's existing tags: existing tags are not removed.
5. Subscriptions. Subscriptions to resources are added and updated according to the subscription settings. In unsafe mode, the subscriptions of profiles with the Unsubscribed, Complained, Hardbounced, and Invalid statuses are also updated.
If no email is passed when creating a new profile, a system record in the form profile_id@localhost is written to the Email field.