Merge contacts and anonymous contacts

Is there an API in Mautic that can merge contacts and anonymous contacts?
An user come in the website without log in,
it will create an anonymous contact and track his events,
but after he log in,
events will tracked to another contact with email,
could any API to merge the anonymous contacts and the email contact?

Mautic will look at all custom fields that have been set as “Unique”. When more fields are set to unique then they probably will not merge.

In the console the following command triggers unduplication.
from within the mautic folder:
bin/console mautic:contacts:deduplicate

I do not know if an anonymous IP adres visitor will be merged to an known email visitor when the email address field is set to unique.

Maybe someone can confirm this.