class Stytch::Users
def exchange_primary_factor(
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.
status_code::
The type of this field is +User+ (+object+).
The `user` object affected by this API call. See the [Get user endpoint](https://stytch.com/docs/api/get-user) for complete response field details.
user::
The type of this field is +String+.
The unique ID of the affected User.
user_id::
The type of this field is +String+.
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.
request_id::
An object with the following fields:
== Returns:
The type of this field is nilable +String+.
The phone number to exchange to. The phone number should be in E.164 format (i.e. +1XXXXXXXXXX).
phone_number::
The type of this field is nilable +String+.
The email address to exchange to.
email_address::
The type of this field is +String+.
The unique ID of a specific User.
user_id::
== Parameters:
Use this endpoint with caution as it performs an admin level action.
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`.
Must pass either an `email_address` or a `phone_number`.
Exchange a user's email address or phone number for another.
def exchange_primary_factor( user_id:, email_address: nil, phone_number: nil ) headers = {} request = {} request[:email_address] = email_address unless email_address.nil? request[:phone_number] = phone_number unless phone_number.nil? put_request("/v1/users/#{user_id}/exchange_primary_factor", request, headers) end