Adds an existing password to a User's email that doesn't have a password yet. We support migrating users from passwords stored with bcrypt, scrypt, argon2, MD-5, SHA-1, or PBKDF2. This endpoint has a rate limit of 100 requests per second.
Migrate Password
POSThttps://test.stytch.com/v1/passwords/migrate
Body parameters
email* string
name object
trusted_metadata object
untrusted_metadata object
hash* string
hash_type* string
scrypt_config object
argon_2_config object
md_5_config object
sha_1_config object
pbkdf_2_config object
set_email_verified boolean
Response fields
status_code int
request_id string
user_id string
user object
email_id string
user_created boolean
curl --request POST \
--url https://test.stytch.com/v1/passwords/migrate \
-u 'PROJECT_ID:SECRET' \
-H 'Content-Type: application/json' \
-d '{
"email": "sandbox@stytch.com",
"hash": "$2a$12$vefoDBbzuMb/NczV/fc9QemTizkNAZr9EO02pIUHPAAJibcYp0.ne",
"hash_type": "bcrypt"
}'
RESPONSE
200
{
"status_code": 200,
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
"user_id": "user-test-16d9ba61-97a1-4ba4-9720-b03761dc50c6",
"email_id": "email-test-81bf03a8-86e1-4d95-bd44-bb3495224953",
"user_created": true
}
Common Error Types
- invalid_argon_2_salt
- invalid_base64_scrypt_hash
- invalid_bcrypt_cost
- invalid_bcrypt_hash
- invalid_email
- invalid_hash
- invalid_md_5_hash
- invalid_pbkdf_2_iteration_amount
- invalid_pbkdf_2_salt
- invalid_phpass_hash_prefix
- invalid_scrypt_salt_length
- invalid_sha_1_hash
- password_already_exists
- pbkdf_2_key_length_mismatch
- scrypt_key_length_mismatch