Consumer Authentication

/

API reference

/

Users

/

Exchange primary factor

Exchange Primary Factor

PUThttps://test.stytch.com/v1/users/{user_id}/exchange_primary_factor

Exchange a user's email address or phone number for another.

Must pass either an email_address or a phone_number.

This endpoint only works if the user has exactly one factor. You are able to exchange the type of factor for another as well, i.e. exchange an email_address for a phone_number.

Use this endpoint with caution as it performs an admin level action.


Path parameters


user_id*string

Body parameters


email_addressstring

phone_numberstring

Response fields


status_codeint

request_idstring

user_idstring

userobject
curl --request PUT \
  --url https://test.stytch.com/v1/users/user-test-16d9ba61-97a1-4ba4-9720-b03761dc50c6/exchange_primary_factor \
  -u 'PROJECT_ID:SECRET' \
  -H 'Content-Type: application/json'

RESPONSE

200
{
  "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
  "status_code": 200,
  "user_id": "user-test-16d9ba61-97a1-4ba4-9720-b03761dc50c6",
  "user": {...}
}

Common Error Types