Skip to content

Latest commit

 

History

History
1685 lines (1199 loc) · 54.8 KB

UsersApi.md

File metadata and controls

1685 lines (1199 loc) · 54.8 KB

ClerkBackend::UsersApi

All URIs are relative to https://api.clerk.com/v1

Method HTTP request Description
ban_user POST /users/{user_id}/ban Ban a user
create_user POST /users Create a new user
create_user_totp POST /users/{user_id}/totp Create a TOTP for a user
delete_backup_code DELETE /users/{user_id}/backup_code Disable all user's Backup codes
delete_totp DELETE /users/{user_id}/totp Delete all the user's TOTPs
delete_user DELETE /users/{user_id} Delete a user
delete_user_profile_image DELETE /users/{user_id}/profile_image Delete user profile image
disable_mfa DELETE /users/{user_id}/mfa Disable a user's MFA methods
get_o_auth_access_token GET /users/{user_id}/oauth_access_tokens/{provider} Retrieve the OAuth access token of a user
get_user GET /users/{user_id} Retrieve a user
get_user_list GET /users List all users
get_users_count GET /users/count Count users
lock_user POST /users/{user_id}/lock Lock a user
set_user_profile_image POST /users/{user_id}/profile_image Set user profile image
unban_user POST /users/{user_id}/unban Unban a user
unlock_user POST /users/{user_id}/unlock Unlock a user
update_user PATCH /users/{user_id} Update a user
update_user_metadata PATCH /users/{user_id}/metadata Merge and update a user's metadata
user_passkey_delete DELETE /users/{user_id}/passkeys/{passkey_identification_id} Delete a user passkey
user_web3_wallet_delete DELETE /users/{user_id}/web3_wallets/{web3_wallet_identification_id} Delete a user web3 wallet
users_get_organization_memberships GET /users/{user_id}/organization_memberships Retrieve all memberships for a user
verify_password POST /users/{user_id}/verify_password Verify the password of a user
verify_totp POST /users/{user_id}/verify_totp Verify a TOTP or backup code for a user

ban_user

ban_user(user_id)

Ban a user

Marks the given user as banned, which means that all their sessions are revoked and they are not allowed to sign in again.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user to ban

begin
  # Ban a user
  result = api_instance.ban_user(user_id)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->ban_user: #{e}"
end

Using the ban_user_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> ban_user_with_http_info(user_id)

begin
  # Ban a user
  data, status_code, headers = api_instance.ban_user_with_http_info(user_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <User>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->ban_user_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user to ban

Return type

User

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

create_user

create_user(create_user_request)

Create a new user

Creates a new user. Your user management settings determine how you should setup your user model. Any email address and phone number created using this method will be marked as verified. Note: If you are performing a migration, check out our guide on zero downtime migrations. A rate limit rule of 20 requests per 10 seconds is applied to this endpoint.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
create_user_request = ClerkBackend::CreateUserRequest.new # CreateUserRequest | 

begin
  # Create a new user
  result = api_instance.create_user(create_user_request)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->create_user: #{e}"
end

Using the create_user_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> create_user_with_http_info(create_user_request)

begin
  # Create a new user
  data, status_code, headers = api_instance.create_user_with_http_info(create_user_request)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <User>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->create_user_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
create_user_request CreateUserRequest

Return type

User

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

create_user_totp

create_user_totp(user_id)

Create a TOTP for a user

Creates a TOTP (Time-based One-Time Password) for a given user, returning both the TOTP secret and the URI.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user for whom the TOTP is being created.

begin
  # Create a TOTP for a user
  result = api_instance.create_user_totp(user_id)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->create_user_totp: #{e}"
end

Using the create_user_totp_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> create_user_totp_with_http_info(user_id)

begin
  # Create a TOTP for a user
  data, status_code, headers = api_instance.create_user_totp_with_http_info(user_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <TOTP>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->create_user_totp_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user for whom the TOTP is being created.

Return type

TOTP

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

delete_backup_code

delete_backup_code(user_id)

Disable all user's Backup codes

Disable all of a user's backup codes.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user whose backup codes are to be deleted.

begin
  # Disable all user's Backup codes
  result = api_instance.delete_backup_code(user_id)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->delete_backup_code: #{e}"
end

Using the delete_backup_code_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> delete_backup_code_with_http_info(user_id)

begin
  # Disable all user's Backup codes
  data, status_code, headers = api_instance.delete_backup_code_with_http_info(user_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <DisableMFA200Response>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->delete_backup_code_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user whose backup codes are to be deleted.

Return type

DisableMFA200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

delete_totp

delete_totp(user_id)

Delete all the user's TOTPs

Deletes all of the user's TOTPs.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user whose TOTPs are to be deleted

begin
  # Delete all the user's TOTPs
  result = api_instance.delete_totp(user_id)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->delete_totp: #{e}"
end

Using the delete_totp_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> delete_totp_with_http_info(user_id)

begin
  # Delete all the user's TOTPs
  data, status_code, headers = api_instance.delete_totp_with_http_info(user_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <DisableMFA200Response>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->delete_totp_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user whose TOTPs are to be deleted

Return type

DisableMFA200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

delete_user

delete_user(user_id)

Delete a user

Delete the specified user

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user to delete

begin
  # Delete a user
  result = api_instance.delete_user(user_id)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->delete_user: #{e}"
end

Using the delete_user_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> delete_user_with_http_info(user_id)

begin
  # Delete a user
  data, status_code, headers = api_instance.delete_user_with_http_info(user_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <DeletedObject>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->delete_user_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user to delete

Return type

DeletedObject

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

delete_user_profile_image

delete_user_profile_image(user_id)

Delete user profile image

Delete a user's profile image

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user to delete the profile image for

begin
  # Delete user profile image
  result = api_instance.delete_user_profile_image(user_id)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->delete_user_profile_image: #{e}"
end

Using the delete_user_profile_image_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> delete_user_profile_image_with_http_info(user_id)

begin
  # Delete user profile image
  data, status_code, headers = api_instance.delete_user_profile_image_with_http_info(user_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <User>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->delete_user_profile_image_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user to delete the profile image for

Return type

User

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

disable_mfa

disable_mfa(user_id)

Disable a user's MFA methods

Disable all of a user's MFA methods (e.g. OTP sent via SMS, TOTP on their authenticator app) at once.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user whose MFA methods are to be disabled

begin
  # Disable a user's MFA methods
  result = api_instance.disable_mfa(user_id)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->disable_mfa: #{e}"
end

Using the disable_mfa_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> disable_mfa_with_http_info(user_id)

begin
  # Disable a user's MFA methods
  data, status_code, headers = api_instance.disable_mfa_with_http_info(user_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <DisableMFA200Response>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->disable_mfa_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user whose MFA methods are to be disabled

Return type

DisableMFA200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_o_auth_access_token

<Array> get_o_auth_access_token(user_id, provider)

Retrieve the OAuth access token of a user

Fetch the corresponding OAuth access token for a user that has previously authenticated with a particular OAuth provider. For OAuth 2.0, if the access token has expired and we have a corresponding refresh token, the access token will be refreshed transparently the new one will be returned.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user for which to retrieve the OAuth access token
provider = 'provider_example' # String | The ID of the OAuth provider (e.g. `oauth_google`)

begin
  # Retrieve the OAuth access token of a user
  result = api_instance.get_o_auth_access_token(user_id, provider)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->get_o_auth_access_token: #{e}"
end

Using the get_o_auth_access_token_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(<Array>, Integer, Hash)> get_o_auth_access_token_with_http_info(user_id, provider)

begin
  # Retrieve the OAuth access token of a user
  data, status_code, headers = api_instance.get_o_auth_access_token_with_http_info(user_id, provider)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Array<GetOAuthAccessToken200ResponseInner>>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->get_o_auth_access_token_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user for which to retrieve the OAuth access token
provider String The ID of the OAuth provider (e.g. `oauth_google`)

Return type

Array<GetOAuthAccessToken200ResponseInner>

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_user

get_user(user_id)

Retrieve a user

Retrieve the details of a user

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user to retrieve

begin
  # Retrieve a user
  result = api_instance.get_user(user_id)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->get_user: #{e}"
end

Using the get_user_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_user_with_http_info(user_id)

begin
  # Retrieve a user
  data, status_code, headers = api_instance.get_user_with_http_info(user_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <User>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->get_user_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user to retrieve

Return type

User

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_user_list

<Array> get_user_list(opts)

List all users

Returns a list of all users. The users are returned sorted by creation date, with the newest users appearing first.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
opts = {
  email_address: ['inner_example'], # Array<String> | Returns users with the specified email addresses. Accepts up to 100 email addresses. Any email addresses not found are ignored.
  phone_number: ['inner_example'], # Array<String> | Returns users with the specified phone numbers. Accepts up to 100 phone numbers. Any phone numbers not found are ignored.
  external_id: ['inner_example'], # Array<String> | Returns users with the specified external ids. For each external id, the `+` and `-` can be prepended to the id, which denote whether the respective external id should be included or excluded from the result set. Accepts up to 100 external ids. Any external ids not found are ignored.
  username: ['inner_example'], # Array<String> | Returns users with the specified usernames. Accepts up to 100 usernames. Any usernames not found are ignored.
  web3_wallet: ['inner_example'], # Array<String> | Returns users with the specified web3 wallet addresses. Accepts up to 100 web3 wallet addresses. Any web3 wallet addressed not found are ignored.
  user_id: ['inner_example'], # Array<String> | Returns users with the user ids specified. For each user id, the `+` and `-` can be prepended to the id, which denote whether the respective user id should be included or excluded from the result set. Accepts up to 100 user ids. Any user ids not found are ignored.
  organization_id: ['inner_example'], # Array<String> | Returns users that have memberships to the given organizations. For each organization id, the `+` and `-` can be prepended to the id, which denote whether the respective organization should be included or excluded from the result set. Accepts up to 100 organization ids.
  query: 'query_example', # String | Returns users that match the given query. For possible matches, we check the email addresses, phone numbers, usernames, web3 wallets, user ids, first and last names. The query value doesn't need to match the exact value you are looking for, it is capable of partial matches as well.
  last_active_at_since: 1700690400000, # Integer | Returns users that had session activity since the given date, with day precision. Providing a value with higher precision than day will result in an error. Example: use 1700690400000 to retrieve users that had session activity from 2023-11-23 until the current day.
  limit: 8.14, # Float | Applies a limit to the number of results returned. Can be used for paginating the results together with `offset`.
  offset: 8.14, # Float | Skip the first `offset` results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with `limit`.
  order_by: 'order_by_example' # String | Allows to return users in a particular order. At the moment, you can order the returned users by their `created_at`,`updated_at`,`email_address`,`web3wallet`,`first_name`,`last_name`,`phone_number`,`username`,`last_active_at`,`last_sign_in_at`. In order to specify the direction, you can use the `+/-` symbols prepended in the property to order by. For example, if you want users to be returned in descending order according to their `created_at` property, you can use `-created_at`. If you don't use `+` or `-`, then `+` is implied. We only support one `order_by` parameter, and if multiple `order_by` parameters are provided, we will only keep the first one. For example, if you pass `order_by=username&order_by=created_at`, we will consider only the first `order_by` parameter, which is `username`. The `created_at` parameter will be ignored in this case.
}

begin
  # List all users
  result = api_instance.get_user_list(opts)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->get_user_list: #{e}"
end

Using the get_user_list_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(<Array>, Integer, Hash)> get_user_list_with_http_info(opts)

begin
  # List all users
  data, status_code, headers = api_instance.get_user_list_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Array<User>>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->get_user_list_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
email_address Array<String> Returns users with the specified email addresses. Accepts up to 100 email addresses. Any email addresses not found are ignored. [optional]
phone_number Array<String> Returns users with the specified phone numbers. Accepts up to 100 phone numbers. Any phone numbers not found are ignored. [optional]
external_id Array<String> Returns users with the specified external ids. For each external id, the `+` and `-` can be prepended to the id, which denote whether the respective external id should be included or excluded from the result set. Accepts up to 100 external ids. Any external ids not found are ignored. [optional]
username Array<String> Returns users with the specified usernames. Accepts up to 100 usernames. Any usernames not found are ignored. [optional]
web3_wallet Array<String> Returns users with the specified web3 wallet addresses. Accepts up to 100 web3 wallet addresses. Any web3 wallet addressed not found are ignored. [optional]
user_id Array<String> Returns users with the user ids specified. For each user id, the `+` and `-` can be prepended to the id, which denote whether the respective user id should be included or excluded from the result set. Accepts up to 100 user ids. Any user ids not found are ignored. [optional]
organization_id Array<String> Returns users that have memberships to the given organizations. For each organization id, the `+` and `-` can be prepended to the id, which denote whether the respective organization should be included or excluded from the result set. Accepts up to 100 organization ids. [optional]
query String Returns users that match the given query. For possible matches, we check the email addresses, phone numbers, usernames, web3 wallets, user ids, first and last names. The query value doesn't need to match the exact value you are looking for, it is capable of partial matches as well. [optional]
last_active_at_since Integer Returns users that had session activity since the given date, with day precision. Providing a value with higher precision than day will result in an error. Example: use 1700690400000 to retrieve users that had session activity from 2023-11-23 until the current day. [optional]
limit Float Applies a limit to the number of results returned. Can be used for paginating the results together with `offset`. [optional][default to 10]
offset Float Skip the first `offset` results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with `limit`. [optional][default to 0]
order_by String Allows to return users in a particular order. At the moment, you can order the returned users by their `created_at`,`updated_at`,`email_address`,`web3wallet`,`first_name`,`last_name`,`phone_number`,`username`,`last_active_at`,`last_sign_in_at`. In order to specify the direction, you can use the `+/-` symbols prepended in the property to order by. For example, if you want users to be returned in descending order according to their `created_at` property, you can use `-created_at`. If you don't use `+` or `-`, then `+` is implied. We only support one `order_by` parameter, and if multiple `order_by` parameters are provided, we will only keep the first one. For example, if you pass `order_by=username&order_by=created_at`, we will consider only the first `order_by` parameter, which is `username`. The `created_at` parameter will be ignored in this case. [optional][default to '-created_at']

Return type

Array<User>

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_users_count

get_users_count(opts)

Count users

Returns a total count of all users that match the given filtering criteria.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
opts = {
  email_address: ['inner_example'], # Array<String> | Counts users with the specified email addresses. Accepts up to 100 email addresses. Any email addresses not found are ignored.
  phone_number: ['inner_example'], # Array<String> | Counts users with the specified phone numbers. Accepts up to 100 phone numbers. Any phone numbers not found are ignored.
  external_id: ['inner_example'], # Array<String> | Counts users with the specified external ids. Accepts up to 100 external ids. Any external ids not found are ignored.
  username: ['inner_example'], # Array<String> | Counts users with the specified usernames. Accepts up to 100 usernames. Any usernames not found are ignored.
  web3_wallet: ['inner_example'], # Array<String> | Counts users with the specified web3 wallet addresses. Accepts up to 100 web3 wallet addresses. Any web3 wallet addressed not found are ignored.
  user_id: ['inner_example'], # Array<String> | Counts users with the user ids specified. Accepts up to 100 user ids. Any user ids not found are ignored.
  query: 'query_example' # String | Counts users that match the given query. For possible matches, we check the email addresses, phone numbers, usernames, web3 wallets, user ids, first and last names. The query value doesn't need to match the exact value you are looking for, it is capable of partial matches as well.
}

begin
  # Count users
  result = api_instance.get_users_count(opts)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->get_users_count: #{e}"
end

Using the get_users_count_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_users_count_with_http_info(opts)

begin
  # Count users
  data, status_code, headers = api_instance.get_users_count_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <TotalCount>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->get_users_count_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
email_address Array<String> Counts users with the specified email addresses. Accepts up to 100 email addresses. Any email addresses not found are ignored. [optional]
phone_number Array<String> Counts users with the specified phone numbers. Accepts up to 100 phone numbers. Any phone numbers not found are ignored. [optional]
external_id Array<String> Counts users with the specified external ids. Accepts up to 100 external ids. Any external ids not found are ignored. [optional]
username Array<String> Counts users with the specified usernames. Accepts up to 100 usernames. Any usernames not found are ignored. [optional]
web3_wallet Array<String> Counts users with the specified web3 wallet addresses. Accepts up to 100 web3 wallet addresses. Any web3 wallet addressed not found are ignored. [optional]
user_id Array<String> Counts users with the user ids specified. Accepts up to 100 user ids. Any user ids not found are ignored. [optional]
query String Counts users that match the given query. For possible matches, we check the email addresses, phone numbers, usernames, web3 wallets, user ids, first and last names. The query value doesn't need to match the exact value you are looking for, it is capable of partial matches as well. [optional]

Return type

TotalCount

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

lock_user

lock_user(user_id)

Lock a user

Marks the given user as locked, which means they are not allowed to sign in again until the lock expires. Lock duration can be configured in the instance's restrictions settings.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user to lock

begin
  # Lock a user
  result = api_instance.lock_user(user_id)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->lock_user: #{e}"
end

Using the lock_user_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> lock_user_with_http_info(user_id)

begin
  # Lock a user
  data, status_code, headers = api_instance.lock_user_with_http_info(user_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <User>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->lock_user_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user to lock

Return type

User

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

set_user_profile_image

set_user_profile_image(user_id, opts)

Set user profile image

Update a user's profile image

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user to update the profile image for
opts = {
  file: File.new('/path/to/some/file') # File | 
}

begin
  # Set user profile image
  result = api_instance.set_user_profile_image(user_id, opts)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->set_user_profile_image: #{e}"
end

Using the set_user_profile_image_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> set_user_profile_image_with_http_info(user_id, opts)

begin
  # Set user profile image
  data, status_code, headers = api_instance.set_user_profile_image_with_http_info(user_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <User>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->set_user_profile_image_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user to update the profile image for
file File [optional]

Return type

User

Authorization

bearerAuth

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

unban_user

unban_user(user_id)

Unban a user

Removes the ban mark from the given user.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user to unban

begin
  # Unban a user
  result = api_instance.unban_user(user_id)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->unban_user: #{e}"
end

Using the unban_user_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> unban_user_with_http_info(user_id)

begin
  # Unban a user
  data, status_code, headers = api_instance.unban_user_with_http_info(user_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <User>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->unban_user_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user to unban

Return type

User

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

unlock_user

unlock_user(user_id)

Unlock a user

Removes the lock from the given user.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user to unlock

begin
  # Unlock a user
  result = api_instance.unlock_user(user_id)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->unlock_user: #{e}"
end

Using the unlock_user_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> unlock_user_with_http_info(user_id)

begin
  # Unlock a user
  data, status_code, headers = api_instance.unlock_user_with_http_info(user_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <User>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->unlock_user_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user to unlock

Return type

User

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

update_user

update_user(user_id, update_user_request)

Update a user

Update a user's attributes. You can set the user's primary contact identifiers (email address and phone numbers) by updating the primary_email_address_id and primary_phone_number_id attributes respectively. Both IDs should correspond to verified identifications that belong to the user. You can remove a user's username by setting the username attribute to null or the blank string "". This is a destructive action; the identification will be deleted forever. Usernames can be removed only if they are optional in your instance settings and there's at least one other identifier which can be used for authentication. This endpoint allows changing a user's password. When passing the password parameter directly you have two further options. You can ignore the password policy checks for your instance by setting the skip_password_checks parameter to true. You can also choose to sign the user out of all their active sessions on any device once the password is updated. Just set sign_out_of_other_sessions to true.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user to update
update_user_request = ClerkBackend::UpdateUserRequest.new # UpdateUserRequest | 

begin
  # Update a user
  result = api_instance.update_user(user_id, update_user_request)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->update_user: #{e}"
end

Using the update_user_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> update_user_with_http_info(user_id, update_user_request)

begin
  # Update a user
  data, status_code, headers = api_instance.update_user_with_http_info(user_id, update_user_request)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <User>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->update_user_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user to update
update_user_request UpdateUserRequest

Return type

User

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

update_user_metadata

update_user_metadata(user_id, opts)

Merge and update a user's metadata

Update a user's metadata attributes by merging existing values with the provided parameters. This endpoint behaves differently than the Update a user endpoint. Metadata values will not be replaced entirely. Instead, a deep merge will be performed. Deep means that any nested JSON objects will be merged as well. You can remove metadata keys at any level by setting their value to null.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user whose metadata will be updated and merged
opts = {
  update_user_metadata_request: ClerkBackend::UpdateUserMetadataRequest.new # UpdateUserMetadataRequest | 
}

begin
  # Merge and update a user's metadata
  result = api_instance.update_user_metadata(user_id, opts)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->update_user_metadata: #{e}"
end

Using the update_user_metadata_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> update_user_metadata_with_http_info(user_id, opts)

begin
  # Merge and update a user's metadata
  data, status_code, headers = api_instance.update_user_metadata_with_http_info(user_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <User>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->update_user_metadata_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user whose metadata will be updated and merged
update_user_metadata_request UpdateUserMetadataRequest [optional]

Return type

User

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

user_passkey_delete

user_passkey_delete(user_id, passkey_identification_id)

Delete a user passkey

Delete the passkey identification for a given user and notify them through email.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user that owns the passkey identity
passkey_identification_id = 'passkey_identification_id_example' # String | The ID of the passkey identity to be deleted

begin
  # Delete a user passkey
  result = api_instance.user_passkey_delete(user_id, passkey_identification_id)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->user_passkey_delete: #{e}"
end

Using the user_passkey_delete_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> user_passkey_delete_with_http_info(user_id, passkey_identification_id)

begin
  # Delete a user passkey
  data, status_code, headers = api_instance.user_passkey_delete_with_http_info(user_id, passkey_identification_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <DeletedObject>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->user_passkey_delete_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user that owns the passkey identity
passkey_identification_id String The ID of the passkey identity to be deleted

Return type

DeletedObject

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

user_web3_wallet_delete

user_web3_wallet_delete(user_id, web3_wallet_identification_id)

Delete a user web3 wallet

Delete the web3 wallet identification for a given user.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user that owns the web3 wallet
web3_wallet_identification_id = 'web3_wallet_identification_id_example' # String | The ID of the web3 wallet identity to be deleted

begin
  # Delete a user web3 wallet
  result = api_instance.user_web3_wallet_delete(user_id, web3_wallet_identification_id)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->user_web3_wallet_delete: #{e}"
end

Using the user_web3_wallet_delete_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> user_web3_wallet_delete_with_http_info(user_id, web3_wallet_identification_id)

begin
  # Delete a user web3 wallet
  data, status_code, headers = api_instance.user_web3_wallet_delete_with_http_info(user_id, web3_wallet_identification_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <DeletedObject>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->user_web3_wallet_delete_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user that owns the web3 wallet
web3_wallet_identification_id String The ID of the web3 wallet identity to be deleted

Return type

DeletedObject

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

users_get_organization_memberships

users_get_organization_memberships(user_id, opts)

Retrieve all memberships for a user

Retrieve a paginated list of the user's organization memberships

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user whose organization memberships we want to retrieve
opts = {
  limit: 8.14, # Float | Applies a limit to the number of results returned. Can be used for paginating the results together with `offset`.
  offset: 8.14 # Float | Skip the first `offset` results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with `limit`.
}

begin
  # Retrieve all memberships for a user
  result = api_instance.users_get_organization_memberships(user_id, opts)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->users_get_organization_memberships: #{e}"
end

Using the users_get_organization_memberships_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> users_get_organization_memberships_with_http_info(user_id, opts)

begin
  # Retrieve all memberships for a user
  data, status_code, headers = api_instance.users_get_organization_memberships_with_http_info(user_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <OrganizationMemberships>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->users_get_organization_memberships_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user whose organization memberships we want to retrieve
limit Float Applies a limit to the number of results returned. Can be used for paginating the results together with `offset`. [optional][default to 10]
offset Float Skip the first `offset` results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with `limit`. [optional][default to 0]

Return type

OrganizationMemberships

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

verify_password

verify_password(user_id, opts)

Verify the password of a user

Check that the user's password matches the supplied input. Useful for custom auth flows and re-verification.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user for whom to verify the password
opts = {
  verify_password_request: ClerkBackend::VerifyPasswordRequest.new({password: 'password_example'}) # VerifyPasswordRequest | 
}

begin
  # Verify the password of a user
  result = api_instance.verify_password(user_id, opts)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->verify_password: #{e}"
end

Using the verify_password_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> verify_password_with_http_info(user_id, opts)

begin
  # Verify the password of a user
  data, status_code, headers = api_instance.verify_password_with_http_info(user_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <VerifyPassword200Response>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->verify_password_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user for whom to verify the password
verify_password_request VerifyPasswordRequest [optional]

Return type

VerifyPassword200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

verify_totp

verify_totp(user_id, opts)

Verify a TOTP or backup code for a user

Verify that the provided TOTP or backup code is valid for the user. Verifying a backup code will result it in being consumed (i.e. it will become invalid). Useful for custom auth flows and re-verification.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::UsersApi.new
user_id = 'user_id_example' # String | The ID of the user for whom to verify the TOTP
opts = {
  verify_totp_request: ClerkBackend::VerifyTOTPRequest.new({code: 'code_example'}) # VerifyTOTPRequest | 
}

begin
  # Verify a TOTP or backup code for a user
  result = api_instance.verify_totp(user_id, opts)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->verify_totp: #{e}"
end

Using the verify_totp_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> verify_totp_with_http_info(user_id, opts)

begin
  # Verify a TOTP or backup code for a user
  data, status_code, headers = api_instance.verify_totp_with_http_info(user_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <VerifyTOTP200Response>
rescue ClerkBackend::ApiError => e
  puts "Error when calling UsersApi->verify_totp_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
user_id String The ID of the user for whom to verify the TOTP
verify_totp_request VerifyTOTPRequest [optional]

Return type

VerifyTOTP200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json