I can import customers with the API using /rest/all/V1/customers endpoint. I can also supply a password.

But is it possible to import a customer with a hashed password with the M2 API? If possible, how would I do that? To be clear, I just want to supply a hashed password in the request. It's coming from Magento 1 and is MD5 hashed (which M2 supports).

I tried password_hash (named like the field in the table) instead, but that doesn't work. The field stays NULL.


How can I import customers with hashed passwords with the API?

2 Answers 2


I tried this /rest/default/V1/customers/me - it does indeed save the new customer entity and the set password_hash, but the customer is unable to login afterwards. So i'm missing something, but the method looks promising.

LE: As Akif suggested, I needed to add the :0 at the end of the M1 hash.

  • hey @Akif, did you try this?
    – Diana
    Feb 19, 2021 at 7:04
  • No not yet. What is the difference with this endpoint and the one in my question? To fix your issue regarding not working of hashes. If the hash is coming from Magento 1 just add :0 to the end of the string. This will make it work since M2 its backwards compatible. See also magento.stackexchange.com/a/259638/5827
    – Akif
    Feb 19, 2021 at 9:59
  • 1
    I don't have an m1 pass to try this out (i tried to emulate it, unsuccessfully, it seems), but thought you might and see if suits your needs. it's different from your mentioned endpoint as you provide the password in the 'password' property of the payload, and I provide the 'passwordHash' in mine which will fill in the password_hash field from the customers entity table.
    – Diana
    Feb 19, 2021 at 10:11
  • 1
    Yes, /swagger is listing it too. I think I found the problem. I had the hash inside the customer object. It should have been outside it. Thanks for the help!
    – Akif
    Feb 23, 2021 at 13:41
  • 1
    yep, that happened to me as well when i first tried it :D :D glad you sorted this out. please consider marking this this topic as solved if you found the solution.
    – Diana
    Feb 23, 2021 at 13:48

There is no need to add extra code or plugins to support the MD5 hash in Magento 2.

If you want to import the passwords directly you just have to add ":0" after the raw password from Magento 1.

Magento 2 supports multiple versions to hash the password. Version 0 is MD5, which is used by Magento 1.

The passwords in Magento 2 are formatted as: {password hash}:{salt}:{hash version}

The passwords in Magento 1 are formatted as: {password hash}:{salt}

  • Thanks for your answer I figured that out already. But this was not the question. The questions is how to import the hash trough the API.
    – Akif
    Feb 18, 2021 at 19:29
  • Create your own API endpoint and do as above Feb 18, 2021 at 19:31
  • 1
    its seems /V1/customers/me supports sending the hash along to insert it as Diana pointed out. No need to make a custom endpoint
    – Akif
    Feb 19, 2021 at 10:13
  • @Akif, did work as expected? if so, please consider marking the proper answer as solution. would be great to let me know if it indeed suits the needs for an m1 to m2 customer migration via API and i will edit my answer accordingly so there is no doubt it does what it's supposed to.
    – Diana
    Feb 20, 2021 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.