Password

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, SHA-512, or PBKDF2. This endpoint has a rate limit of 100 requests per second.

post/v1/passwords/migrate

Request

  • Base URL
    https://api.stytch.com
  • Auth
    HTTP basic

Request body

emailstring required

The email address of the end user.

hashstring required

The password hash. For a Scrypt or PBKDF2 hash, the hash needs to be a base64 encoded string.

hash_type'bcrypt' | 'md_5' | 'argon_2i' | 'argon_2id' | 'sha_1' | 'sha_512' | 'scrypt' | 'phpass' | 'pbkdf_2' required
trusted_metadataobject

The trusted_metadata field contains an arbitrary JSON object of application-specific data. See the Metadata reference for complete field behavior details.

untrusted_metadataobject

The untrusted_metadata field contains an arbitrary JSON object of application-specific data. Untrusted metadata can be edited by end users directly via the SDK, and cannot be used to store critical information. See the Metadata reference for complete field behavior details.

set_email_verifiedboolean

Whether to set the user's email as verified. This is a dangerous field, incorrect use may lead to users getting erroneously deduplicated into one User object. This flag should only be set if you can attest that the user owns the email address in question.

phone_numberstring

The phone number of the user. The phone number should be in E.164 format (i.e. +1XXXXXXXXXX).

set_phone_number_verifiedboolean

Whether to set the user's phone number as verified. This is a dangerous field, this flag should only be set if you can attest that the user owns the phone number in question.

external_idstring

If a new user is created, this will set an identifier that can be used in API calls wherever a user_id is expected. This is a string consisting of alphanumeric, ., _, -, or | characters with a maximum length of 128 characters.

rolesstring[]

Roles to explicitly assign to this User. See the RBAC guide for more information about role assignment.

Response

Successful response

request_idstring required

Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.

user_idstring required

The unique ID of the affected User.

email_idstring required

The unique ID of a specific email address.

user_createdboolean required

In login_or_create endpoints, this field indicates whether or not a User was just created.

status_codeinteger required

The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.

Changes