I'm assuming you're using the SOAP API, not the REST API. You can't do this with the REST API (yet)
With SOAP, you can use syncLead and pass in Cookie ID, email address and other personal data. That will create a new Known Lead and merge the anonymous record into the known Lead.