---
title: "Migrate"
method: POST
path: "/v1/passwords/migrate"
tags: ["Password"]
---

# Migrate

`POST /v1/passwords/migrate`

## Request

- Base URL: `https://api.stytch.com`
- URL: `https://api.stytch.com/v1/passwords/migrate`
- Auth: HTTP basic

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.

## Request body

- ApiPasswordV1MigrateRequest: Request type
  - `email` string, required: The email address of the end user.
  - `hash` string, 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
  - `md_5_config` ApiPasswordV1MD5Config
    - `prepend_salt` string, required: The salt that should be prepended to the migrated password.
    - `append_salt` string, required: The salt that should be appended to the migrated password.
  - `argon_2_config` ApiPasswordV1Argon2Config
    - `salt` string, required: The salt value.
    - `iteration_amount` integer, required: The iteration amount.
    - `memory` integer, required: The memory in kibibytes.
    - `threads` integer, required: The thread value, also known as the parallelism factor.
    - `key_length` integer, required: The key length, also known as the hash length.
  - `sha_1_config` ApiPasswordV1SHA1Config
    - `prepend_salt` string, required: The salt that should be prepended to the migrated password.
    - `append_salt` string, required: The salt that should be appended to the migrated password.
  - `sha_512_config` ApiPasswordV1SHA512Config
    - `prepend_salt` string, required: The salt that should be prepended to the migrated password.
    - `append_salt` string, required: The salt that should be appended to the migrated password.
  - `scrypt_config` ApiPasswordV1ScryptConfig
    - `salt` string, required: The salt value, which should be in a base64 encoded string form.
    - `n_parameter` integer, required: The N value, also known as the iterations count. It must be a power of two greater than 1 and less than 262,145. If your application's N parameter is larger than 262,144, please reach out to [support@stytch.com](mailto:support@stytch.com)
    - `r_parameter` integer, required: The r parameter, also known as the block size.
    - `p_parameter` integer, required: The p parameter, also known as the parallelism factor.
    - `key_length` integer, required: The key length, also known as the hash length.
  - `pbkdf_2_config` ApiPasswordV1PBKDF2Config
    - `salt` string, required: The salt value, which should be in a base64 encoded string form.
    - `iteration_amount` integer, required: The iteration amount.
    - `key_length` integer, required: The key length, also known as the hash length.
    - `algorithm` string, required: The algorithm that was used to generate the HMAC hash. Accepted values are "sha512" and sha256". Defaults to sha256.
  - `trusted_metadata` object: The `trusted_metadata` field contains an arbitrary JSON object of application-specific data. See the [Metadata](https://stytch.com/docs/api/metadata) reference for complete field behavior details.
  - `untrusted_metadata` object: 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](https://stytch.com/docs/api/metadata) reference for complete field behavior details.
  - `set_email_verified` boolean: 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.
  - `name` ApiUserV1Name
    - `first_name` string: The first name of the user.
    - `middle_name` string: The middle name(s) of the user.
    - `last_name` string: The last name of the user.
  - `phone_number` string: The phone number of the user. The phone number should be in E.164 format (i.e. +1XXXXXXXXXX).
  - `set_phone_number_verified` boolean: 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_id` string: 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.
  - `roles` string[]: Roles to explicitly assign to this User. See the [RBAC guide](https://stytch.com/docs/guides/rbac/role-assignment) for more information about role assignment.

## Response `200`

Successful response

- ApiPasswordV1MigrateResponse
  - `request_id` string, 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_id` string, required: The unique ID of the affected User.
  - `email_id` string, required: The unique ID of a specific email address.
  - `user_created` boolean, required: In `login_or_create` endpoints, this field indicates whether or not a User was just created.
  - `user` ApiUserV1User, required
    - `user_id` string, required: The unique ID of the affected User.
    - `emails` ApiUserV1Email[], required: An array of email objects for the User.
      - `email_id` string, required: The unique ID of a specific email address.
      - `email` string, required: The email address.
      - `verified` boolean, required: The verified boolean denotes whether or not this send method, e.g. phone number, email address, etc., has been successfully authenticated by the User.
    - `status` string, required: The status of the User. The possible values are `pending` and `active`.
    - `phone_numbers` ApiUserV1PhoneNumber[], required: An array of phone number objects linked to the User.
      - `phone_id` string, required: The unique ID for the phone number.
      - `phone_number` string, required: The phone number.
      - `verified` boolean, required: The verified boolean denotes whether or not this send method, e.g. phone number, email address, etc., has been successfully authenticated by the User.
    - `webauthn_registrations` ApiUserV1WebAuthnRegistration[], required: An array that contains a list of all Passkey or WebAuthn registrations for a given User in the Stytch API.
      - `webauthn_registration_id` string, required: The unique ID for the Passkey or WebAuthn registration.
      - `domain` string, required: The `domain` on which Passkey or WebAuthn registration was started. This will be the domain of your app.
      - `user_agent` string, required: The user agent of the User.
      - `verified` boolean, required: The verified boolean denotes whether or not this send method, e.g. phone number, email address, etc., has been successfully authenticated by the User.
      - `authenticator_type` string, required: The `authenticator_type` string displays the requested authenticator type of the Passkey or WebAuthn device. The two valid types are "platform" and "cross-platform". If no value is present, the Passkey or WebAuthn device was created without an authenticator type preference.
      - `name` string, required: The `name` of the Passkey or WebAuthn registration.
    - `providers` ApiUserV1OAuthProvider[], required: An array of OAuth `provider` objects linked to the User.
      - `provider_type` string, required: Denotes the OAuth identity provider that the user has authenticated with, e.g. Google, Facebook, GitHub etc.
      - `provider_subject` string, required: The unique identifier for the User within a given OAuth provider. Also commonly called the "sub" or "Subject field" in OAuth protocols.
      - `profile_picture_url` string, required: If available, the `profile_picture_url` is a url of the User's profile picture set in OAuth identity the provider that the User has authenticated with, e.g. Facebook profile picture.
      - `locale` string, required: If available, the `locale` is the User's locale set in the OAuth identity provider that the user has authenticated with.
      - `oauth_user_registration_id` string, required: The unique ID for an OAuth registration.
    - `totps` ApiUserV1TOTP[], required: An array containing a list of all TOTP instances for a given User in the Stytch API.
      - `totp_id` string, required: The unique ID for a TOTP instance.
      - `verified` boolean, required: The verified boolean denotes whether or not this send method, e.g. phone number, email address, etc., has been successfully authenticated by the User.
    - `crypto_wallets` ApiUserV1CryptoWallet[], required: An array contains a list of all crypto wallets for a given User in the Stytch API.
      - `crypto_wallet_id` string, required: The unique ID for a crypto wallet
      - `crypto_wallet_address` string, required: The actual blockchain address of the User's crypto wallet.
      - `crypto_wallet_type` string, required: The blockchain that the User's crypto wallet operates on, e.g. Ethereum, Solana, etc.
      - `verified` boolean, required: The verified boolean denotes whether or not this send method, e.g. phone number, email address, etc., has been successfully authenticated by the User.
    - `biometric_registrations` ApiUserV1BiometricRegistration[], required: An array that contains a list of all biometric registrations for a given User in the Stytch API.
      - `biometric_registration_id` string, required: The unique ID for a biometric registration.
      - `verified` boolean, required: The verified boolean denotes whether or not this send method, e.g. phone number, email address, etc., has been successfully authenticated by the User.
    - `is_locked` boolean, required: Whether the User is temporarily locked due to too many failed authentication attempts. See the [User Locking Guide](https://stytch.com/docs/resources/platform/user-locks) for more information.
    - `roles` string[], required: Roles assigned to this User. See the [RBAC guide](https://stytch.com/docs/guides/rbac/role-assignment) for more information about role assignment.
    - `name` ApiUserV1Name
      - `first_name` string: The first name of the user.
      - `middle_name` string: The middle name(s) of the user.
      - `last_name` string: The last name of the user.
    - `created_at` string: The timestamp of the User's creation. Values conform to the RFC 3339 standard and are expressed in UTC, e.g. `2021-12-29T12:33:09Z`.
    - `password` ApiUserV1Password
      - `password_id` string, required: The unique ID of a specific password
      - `requires_reset` boolean, required: Indicates whether this password requires a password reset
    - `trusted_metadata` object: The `trusted_metadata` field contains an arbitrary JSON object of application-specific data. See the [Metadata](https://stytch.com/docs/api/metadata) reference for complete field behavior details.
    - `untrusted_metadata` object: 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](https://stytch.com/docs/api/metadata) reference for complete field behavior details.
    - `external_id` string: An identifier that can be used in most API calls where a `member_id` is expected. This is a string consisting of alphanumeric, `.`, `_`, `-`, or `|` characters with a maximum length of 128 characters. External IDs must be unique within the project.
    - `lock_created_at` string: When the user lock was created, if there is one. Values conform to the RFC 3339 standard and are expressed in UTC, e.g. `2021-12-29T12:33:09Z`.
    - `lock_expires_at` string: When the user lock expires, if there is one. Values conform to the RFC 3339 standard and are expressed in UTC, e.g. `2021-12-29T12:33:09Z`.
  - `status_code` integer, 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.

## Other responses

- `400`: Bad request
- `401`: Unauthorized
- `429`: Too Many Requests
- `500`: Internal server error

## Changes

- **2026-03-07** `110f26a94e5b`: 1 info
  - endpoint added
- **2026-03-06** `9cab20b8eca7`: 1 breaking
  - api path removed without deprecation
- **2026-01-09** `7dfcc14e566c`: 4 breaking
  - the `trusted_metadata` request property type changed from `string` to `object`
  - the `untrusted_metadata` request property type changed from `string` to `object`
  - the `user/trusted_metadata` response's property type changed from `string` to `object` for status `200`
  - the `user/untrusted_metadata` response's property type changed from `string` to `object` for status `200`
- **2025-11-03** `b2acbf387799`: 2 info
  - added the new optional request property `sha_512_config`
  - added the new `sha_512` enum value to the request property `hash_type`
- **2025-09-24** `d1a2040cf009`: 1 info
  - added the required property `user/roles` to the response with the `200` status

[Operation history](https://skmtc.dev/stytch/apis/stytch-api/changes/v1/passwords/migrate/post.md)

---

[API](https://skmtc.dev/stytch/apis/stytch-api.md) - [All operations](https://skmtc.dev/stytch/apis/stytch-api/llms.txt) - [OpenAPI document](https://skmtc.dev/stytch/apis/stytch-api/revisions/6d1ff7474803?raw)
