class Stytch::Users

def connected_apps(

The type of this field is +Integer+.
(no documentation yet)
status_code::
The type of this field is list of +UserConnectedApp+ (+object+).
An array of Connected Apps with which the User has successfully completed an authorization flow.
connected_apps::
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 +String+.
The unique ID of a specific User. You may use an `external_id` here if one is set for the user.
user_id::
== Parameters:

no longer be returned in the response.
If the User revokes a Connected App's access (e.g. via the Revoke Connected App endpoint) then the Connected App will
authorization flow.
User Get Connected Apps retrieves a list of Connected Apps with which the User has successfully completed an
def connected_apps(
  user_id:
)
  headers = {}
  query_params = {}
  request = request_with_query_params("/v1/users/#{user_id}/connected_apps", query_params)
  get_request(request, headers)
end

def create(

The type of this field is +Integer+.
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 for the phone number.
phone_id::
The type of this field is +String+.
The status of the User. The possible values are `pending` and `active`.
status::
The type of this field is +String+.
The unique ID of a specific email address.
email_id::
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 list of +String+.
See the [RBAC guide](https://stytch.com/docs/guides/rbac/role-assignment) for more information about role assignment.
Roles to explicitly assign to this User.
roles::
The type of this field is nilable +String+.
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.
external_id::
The type of this field is nilable +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.
untrusted_metadata::
The type of this field is nilable +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.
trusted_metadata::
The type of this field is nilable +Boolean+.
an account for them.
a true flag would be to require users to verify their phone by entering the OTP code before creating
If false, users will be created as active. An example usage of
If true, users will be saved with status pending in Stytch's backend until authenticated.
Flag for whether or not to save a user as pending vs active in Stytch. Defaults to false.
create_user_as_pending::
The type of this field is nilable +String+.
The phone number to use for one-time passcodes. The phone number should be in E.164 format (i.e. +1XXXXXXXXXX). You may use +10000000000 to test this endpoint, see [Testing](https://stytch.com/docs/home#resources_testing) for more detail.
phone_number::
The type of this field is nilable +Attributes+ (+object+).
(no documentation yet)
attributes::
The type of this field is nilable +Name+ (+object+).
The name of the user. Each field in the name object is optional.
name::
The type of this field is nilable +String+.
The email address of the end user.
email::
== Parameters:

Add a User to Stytch. A `user_id` is returned in the response that can then be used to perform other operations within Stytch. An `email` or a `phone_number` is required.
def create(
  email: nil,
  name: nil,
  attributes: nil,
  phone_number: nil,
  create_user_as_pending: nil,
  trusted_metadata: nil,
  untrusted_metadata: nil,
  external_id: nil,
  roles: nil
)
  headers = {}
  request = {}
  request[:email] = email unless email.nil?
  request[:name] = name unless name.nil?
  request[:attributes] = attributes unless attributes.nil?
  request[:phone_number] = phone_number unless phone_number.nil?
  request[:create_user_as_pending] = create_user_as_pending unless create_user_as_pending.nil?
  request[:trusted_metadata] = trusted_metadata unless trusted_metadata.nil?
  request[:untrusted_metadata] = untrusted_metadata unless untrusted_metadata.nil?
  request[:external_id] = external_id unless external_id.nil?
  request[:roles] = roles unless roles.nil?
  post_request('/v1/users', request, headers)
end

def delete(

The type of this field is +Integer+.
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 +String+.
The unique ID of the deleted 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 +String+.
The unique ID of a specific User. You may use an `external_id` here if one is set for the user.
user_id::
== Parameters:

Delete a User from Stytch.
def delete(
  user_id:
)
  headers = {}
  delete_request("/v1/users/#{user_id}", headers)
end

def delete_biometric_registration(

The type of this field is +Integer+.
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 +String+.
The `biometric_registration_id` to be deleted.
biometric_registration_id::
== Parameters:

Delete a biometric registration from a User.
def delete_biometric_registration(
  biometric_registration_id:
)
  headers = {}
  delete_request("/v1/users/biometric_registrations/#{biometric_registration_id}", headers)
end

def delete_crypto_wallet(

The type of this field is +Integer+.
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 +String+.
The `crypto_wallet_id` to be deleted.
crypto_wallet_id::
== Parameters:

Delete a crypto wallet from a User.
def delete_crypto_wallet(
  crypto_wallet_id:
)
  headers = {}
  delete_request("/v1/users/crypto_wallets/#{crypto_wallet_id}", headers)
end

def delete_email(

The type of this field is +Integer+.
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 +String+.
The `email_id` to be deleted.
email_id::
== Parameters:

Delete an email from a User.
def delete_email(
  email_id:
)
  headers = {}
  delete_request("/v1/users/emails/#{email_id}", headers)
end

def delete_external_id(

def delete_external_id(
  user_id:
)
  headers = {}
  delete_request("/v1/users/#{user_id}/external_id", headers)
end

def delete_oauth_registration(

The type of this field is +Integer+.
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 +String+.
The `oauth_user_registration_id` to be deleted.
oauth_user_registration_id::
== Parameters:

Delete an OAuth registration from a User.
def delete_oauth_registration(
  oauth_user_registration_id:
)
  headers = {}
  delete_request("/v1/users/oauth/#{oauth_user_registration_id}", headers)
end

def delete_password(

The type of this field is +Integer+.
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 +String+.
The `password_id` to be deleted.
password_id::
== Parameters:

Delete a password from a User.
def delete_password(
  password_id:
)
  headers = {}
  delete_request("/v1/users/passwords/#{password_id}", headers)
end

def delete_phone_number(

The type of this field is +Integer+.
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 +String+.
The `phone_id` to be deleted.
phone_id::
== Parameters:

Delete a phone number from a User.
def delete_phone_number(
  phone_id:
)
  headers = {}
  delete_request("/v1/users/phone_numbers/#{phone_id}", headers)
end

def delete_totp(

The type of this field is +Integer+.
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 +String+.
The `totp_id` to be deleted.
totp_id::
== Parameters:

Delete a TOTP from a User.
def delete_totp(
  totp_id:
)
  headers = {}
  delete_request("/v1/users/totps/#{totp_id}", headers)
end

def delete_webauthn_registration(

The type of this field is +Integer+.
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 +String+.
The `webauthn_registration_id` to be deleted.
webauthn_registration_id::
== Parameters:

Delete a WebAuthn registration from a User.
def delete_webauthn_registration(
  webauthn_registration_id:
)
  headers = {}
  delete_request("/v1/users/webauthn_registrations/#{webauthn_registration_id}", headers)
end

def exchange_primary_factor(

The type of this field is +Integer+.
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. You may use an `external_id` here if one is set for the 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

def get(

The type of this field is nilable +String+.
(no documentation yet)
lock_expires_at::
The type of this field is nilable +String+.
(no documentation yet)
lock_created_at::
The type of this field is nilable +String+.
(no documentation yet)
external_id::
The type of this field is nilable +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.
untrusted_metadata::
The type of this field is nilable +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.
trusted_metadata::
The type of this field is nilable +Password+ (+object+).
The password object is returned for users with a password.
password::
The type of this field is nilable +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`.
created_at::
The type of this field is nilable +Name+ (+object+).
The name of the User. Each field in the `name` object is optional.
name::
The type of this field is +Integer+.
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 list of +String+.
See the [RBAC guide](https://stytch.com/docs/guides/rbac/role-assignment) for more information about role assignment.
Roles assigned to this User.
roles::
The type of this field is +Boolean+.
(no documentation yet)
is_locked::
The type of this field is list of +BiometricRegistration+ (+object+).
An array that contains a list of all biometric registrations for a given User in the Stytch API.
biometric_registrations::
The type of this field is list of +CryptoWallet+ (+object+).
An array contains a list of all crypto wallets for a given User in the Stytch API.
crypto_wallets::
The type of this field is list of +TOTP+ (+object+).
An array containing a list of all TOTP instances for a given User in the Stytch API.
totps::
The type of this field is list of +OAuthProvider+ (+object+).
An array of OAuth `provider` objects linked to the User.
providers::
The type of this field is list of +WebAuthnRegistration+ (+object+).
An array that contains a list of all Passkey or WebAuthn registrations for a given User in the Stytch API.
webauthn_registrations::
The type of this field is list of +PhoneNumber+ (+object+).
An array of phone number objects linked to the User.
phone_numbers::
The type of this field is +String+.
The status of the User. The possible values are `pending` and `active`.
status::
The type of this field is list of +Email+ (+object+).
An array of email objects for the User.
emails::
The type of this field is +String+.
The unique ID of the returned 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 +String+.
The unique ID of a specific User. You may use an `external_id` here if one is set for the user.
user_id::
== Parameters:

Get information about a specific User.
def get(
  user_id:
)
  headers = {}
  query_params = {}
  request = request_with_query_params("/v1/users/#{user_id}", query_params)
  get_request(request, headers)
end

def initialize(connection)

def initialize(connection)
  @connection = connection
end

def revoke(

The type of this field is +Integer+.
(no documentation yet)
status_code::
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 +String+.
The ID of the Connected App.
connected_app_id::
The type of this field is +String+.
The unique ID of a specific User. You may use an `external_id` here if one is set for the user.
user_id::
== Parameters:

Connected App.
on the User's behalf. New tokens cannot be created until the User completes a new authorization flow with the
Revoke Connected App revokes a Connected App's access to a User and revokes all active tokens that have been created
def revoke(
  user_id:,
  connected_app_id:
)
  headers = {}
  request = {}
  post_request("/v1/users/#{user_id}/connected_apps/#{connected_app_id}/revoke", request, headers)
end

def search(

The type of this field is +Integer+.
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 +ResultsMetadata+ (+object+).
The search `results_metadata` object contains metadata relevant to your specific query like total and `next_cursor`.
results_metadata::
The type of this field is list of +User+ (+object+).
An array of results that match your search query.
results::
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 +SearchUsersQuery+ (+object+).
The optional query object contains the operator, i.e. `AND` or `OR`, and the operands that will filter your results. Only an operator is required. If you include no operands, no filtering will be applied. If you include no query object, it will return all results with no filtering applied.
query::
The type of this field is nilable +Integer+.
The number of search results to return per page. The default limit is 100. A maximum of 1000 results can be returned by a single search request. If the total size of your result set is greater than one page size, you must paginate the response. See the `cursor` field.
limit::
The type of this field is nilable +String+.
The `cursor` field allows you to paginate through your results. Each result array is limited to 1000 results. If your query returns more than 1000 results, you will need to paginate the responses using the `cursor`. If you receive a response that includes a non-null `next_cursor` in the `results_metadata` object, repeat the search call with the `next_cursor` value set to the `cursor` field to retrieve the next page of results. Continue to make search calls until the `next_cursor` in the response is null.
cursor::
== Parameters:

[This Github repository](https://github.com/stytchauth/stytch-node-export-users) contains a utility that leverages the Search Users endpoint to export all of your User data to a CSV or JSON file.

Submit an empty `query` in your Search Users request to return all of your Stytch Project's Users.

### Export all User data

Use the `query` object to filter by different fields. See the `query.operands.filter_value` documentation below for a list of available filters.

Search for Users within your Stytch Project.

**Warning**: This endpoint is not recommended for use in login flows. Scaling issues may occur, as search performance may vary from ~150 milliseconds to 9 seconds depending on query complexity and rate limits are set to 150 requests/minute.
def search(
  cursor: nil,
  limit: nil,
  query: nil
)
  headers = {}
  request = {}
  request[:cursor] = cursor unless cursor.nil?
  request[:limit] = limit unless limit.nil?
  request[:query] = query unless query.nil?
  post_request('/v1/users/search', request, headers)
end

def update(

The type of this field is +Integer+.
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 list of +CryptoWallet+ (+object+).
An array contains a list of all crypto wallets for a given User in the Stytch API.
crypto_wallets::
The type of this field is list of +PhoneNumber+ (+object+).
An array of phone number objects linked to the User.
phone_numbers::
The type of this field is list of +Email+ (+object+).
An array of email objects for the User.
emails::
The type of this field is +String+.
The unique ID of the updated 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 list of +String+.
See the [RBAC guide](https://stytch.com/docs/guides/rbac/role-assignment) for more information about role assignment.
Roles to explicitly assign to this User.
roles::
The type of this field is nilable +String+.
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.
external_id::
The type of this field is nilable +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.
untrusted_metadata::
The type of this field is nilable +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.
trusted_metadata::
The type of this field is nilable +Attributes+ (+object+).
Provided attributes to help with fraud detection. These values are pulled and passed into Stytch endpoints by your application.
attributes::
The type of this field is nilable +Name+ (+object+).
The name of the user. Each field in the name object is optional.
name::
The type of this field is +String+.
The unique ID of a specific User. You may use an `external_id` here if one is set for the user.
user_id::
== Parameters:

**Note:** In order to add a new email address or phone number to an existing User object, pass the new email address or phone number into the respective `/send` endpoint for the authentication method of your choice. If you specify the existing User's `user_id` while calling the `/send` endpoint, the new, unverified email address or phone number will be added to the existing User object. If the user successfully authenticates within 5 minutes of the `/send` request, the new email address or phone number will be marked as verified and remain permanently on the existing Stytch User. Otherwise, it will be removed from the User object, and any subsequent login requests using that phone number will create a new User. We require this process to guard against an account takeover vulnerability.

Update a User's attributes.
def update(
  user_id:,
  name: nil,
  attributes: nil,
  trusted_metadata: nil,
  untrusted_metadata: nil,
  external_id: nil,
  roles: nil
)
  headers = {}
  request = {}
  request[:name] = name unless name.nil?
  request[:attributes] = attributes unless attributes.nil?
  request[:trusted_metadata] = trusted_metadata unless trusted_metadata.nil?
  request[:untrusted_metadata] = untrusted_metadata unless untrusted_metadata.nil?
  request[:external_id] = external_id unless external_id.nil?
  request[:roles] = roles unless roles.nil?
  put_request("/v1/users/#{user_id}", request, headers)
end