Skip to content

Latest commit

 

History

History
1371 lines (955 loc) · 60.1 KB

README.md

File metadata and controls

1371 lines (955 loc) · 60.1 KB

Users

(users())

Overview

The user object represents a user that has successfully signed up to your application. https://clerk.com/docs/reference/clerkjs/user

Available Operations

list

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

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.GetUserListRequest;
import com.clerk.backend_api.models.operations.GetUserListResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        GetUserListRequest req = GetUserListRequest.builder()
                .lastActiveAtSince(1700690400000L)
                .build();

        GetUserListResponse res = sdk.users().list()
                .request(req)
                .call();

        if (res.userList().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request GetUserListRequest ✔️ The request object to use for the request.

Response

GetUserListResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 401, 422 application/json
models/errors/SDKError 4XX, 5XX */*

create

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.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.CreateUserRequestBody;
import com.clerk.backend_api.models.operations.CreateUserResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        CreateUserRequestBody req = CreateUserRequestBody.builder()
                .build();

        CreateUserResponse res = sdk.users().create()
                .request(req)
                .call();

        if (res.user().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request CreateUserRequestBody ✔️ The request object to use for the request.

Response

CreateUserResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 401, 403, 422 application/json
models/errors/SDKError 4XX, 5XX */*

count

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

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.GetUsersCountRequest;
import com.clerk.backend_api.models.operations.GetUsersCountResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        GetUsersCountRequest req = GetUsersCountRequest.builder()
                .build();

        GetUsersCountResponse res = sdk.users().count()
                .request(req)
                .call();

        if (res.totalCount().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request GetUsersCountRequest ✔️ The request object to use for the request.

Response

GetUsersCountResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 422 application/json
models/errors/SDKError 4XX, 5XX */*

get

Retrieve the details of a user

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.GetUserResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        GetUserResponse res = sdk.users().get()
                .userId("<id>")
                .call();

        if (res.user().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user to retrieve

Response

GetUserResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 401, 404 application/json
models/errors/SDKError 4XX, 5XX */*

update

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.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.UpdateUserRequestBody;
import com.clerk.backend_api.models.operations.UpdateUserResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        UpdateUserResponse res = sdk.users().update()
                .userId("<id>")
                .requestBody(UpdateUserRequestBody.builder()
                    .build())
                .call();

        if (res.user().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user to update
requestBody UpdateUserRequestBody ✔️ N/A

Response

UpdateUserResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 401, 404, 422 application/json
models/errors/SDKError 4XX, 5XX */*

delete

Delete the specified user

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.DeleteUserResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        DeleteUserResponse res = sdk.users().delete()
                .userId("<id>")
                .call();

        if (res.deletedObject().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user to delete

Response

DeleteUserResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 401, 404 application/json
models/errors/SDKError 4XX, 5XX */*

ban

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

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.BanUserResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        BanUserResponse res = sdk.users().ban()
                .userId("<id>")
                .call();

        if (res.user().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user to ban

Response

BanUserResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 402 application/json
models/errors/SDKError 4XX, 5XX */*

unban

Removes the ban mark from the given user.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.UnbanUserResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        UnbanUserResponse res = sdk.users().unban()
                .userId("<id>")
                .call();

        if (res.user().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user to unban

Response

UnbanUserResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 402 application/json
models/errors/SDKError 4XX, 5XX */*

lock

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.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.LockUserResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        LockUserResponse res = sdk.users().lock()
                .userId("<id>")
                .call();

        if (res.user().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user to lock

Response

LockUserResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 403 application/json
models/errors/SDKError 4XX, 5XX */*

unlock

Removes the lock from the given user.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.UnlockUserResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        UnlockUserResponse res = sdk.users().unlock()
                .userId("<id>")
                .call();

        if (res.user().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user to unlock

Response

UnlockUserResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 403 application/json
models/errors/SDKError 4XX, 5XX */*

setProfileImage

Update a user's profile image

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.SetUserProfileImageRequestBody;
import com.clerk.backend_api.models.operations.SetUserProfileImageResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        SetUserProfileImageResponse res = sdk.users().setProfileImage()
                .userId("<id>")
                .requestBody(SetUserProfileImageRequestBody.builder()
                    .build())
                .call();

        if (res.user().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user to update the profile image for
requestBody SetUserProfileImageRequestBody ✔️ N/A

Response

SetUserProfileImageResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 401, 404 application/json
models/errors/SDKError 4XX, 5XX */*

deleteProfileImage

Delete a user's profile image

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.DeleteUserProfileImageResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        DeleteUserProfileImageResponse res = sdk.users().deleteProfileImage()
                .userId("<id>")
                .call();

        if (res.user().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user to delete the profile image for

Response

DeleteUserProfileImageResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 404 application/json
models/errors/SDKError 4XX, 5XX */*

updateMetadata

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.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.UpdateUserMetadataRequestBody;
import com.clerk.backend_api.models.operations.UpdateUserMetadataResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        UpdateUserMetadataResponse res = sdk.users().updateMetadata()
                .userId("<id>")
                .requestBody(UpdateUserMetadataRequestBody.builder()
                    .build())
                .call();

        if (res.user().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user whose metadata will be updated and merged
requestBody Optional<UpdateUserMetadataRequestBody> N/A

Response

UpdateUserMetadataResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 401, 404, 422 application/json
models/errors/SDKError 4XX, 5XX */*

getOAuthAccessToken

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.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.GetOAuthAccessTokenResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        GetOAuthAccessTokenResponse res = sdk.users().getOAuthAccessToken()
                .userId("<id>")
                .provider("<value>")
                .call();

        if (res.responseBodies().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId 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)

Response

GetOAuthAccessTokenResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 422 application/json
models/errors/SDKError 4XX, 5XX */*

getOrganizationMemberships

Retrieve a paginated list of the user's organization memberships

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.UsersGetOrganizationMembershipsResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        UsersGetOrganizationMembershipsResponse res = sdk.users().getOrganizationMemberships()
                .userId("<id>")
                .limit(10L)
                .offset(0L)
                .call();

        if (res.organizationMemberships().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user whose organization memberships we want to retrieve
limit Optional<Long> Applies a limit to the number of results returned.
Can be used for paginating the results together with offset.
offset Optional<Long> Skip the first offset results when paginating.
Needs to be an integer greater or equal to zero.
To be used in conjunction with limit.

Response

UsersGetOrganizationMembershipsResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 403 application/json
models/errors/SDKError 4XX, 5XX */*

getOrganizationInvitations

Retrieve a paginated list of the user's organization invitations

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.QueryParamStatus;
import com.clerk.backend_api.models.operations.UsersGetOrganizationInvitationsResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        UsersGetOrganizationInvitationsResponse res = sdk.users().getOrganizationInvitations()
                .userId("<id>")
                .limit(10L)
                .offset(0L)
                .status(QueryParamStatus.PENDING)
                .call();

        if (res.organizationInvitationsWithPublicOrganizationData().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user whose organization invitations we want to retrieve
limit Optional<Long> Applies a limit to the number of results returned.
Can be used for paginating the results together with offset.
offset Optional<Long> Skip the first offset results when paginating.
Needs to be an integer greater or equal to zero.
To be used in conjunction with limit.
status Optional<QueryParamStatus> Filter organization invitations based on their status

Response

UsersGetOrganizationInvitationsResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 403, 404 application/json
models/errors/SDKError 4XX, 5XX */*

verifyPassword

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

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.VerifyPasswordRequestBody;
import com.clerk.backend_api.models.operations.VerifyPasswordResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        VerifyPasswordResponse res = sdk.users().verifyPassword()
                .userId("<id>")
                .requestBody(VerifyPasswordRequestBody.builder()
                    .password("fSBhIihdxMPlTHN")
                    .build())
                .call();

        if (res.object().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user for whom to verify the password
requestBody Optional<VerifyPasswordRequestBody> N/A

Response

VerifyPasswordResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 500 application/json
models/errors/SDKError 4XX, 5XX */*

verifyTOTP

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.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.VerifyTOTPRequestBody;
import com.clerk.backend_api.models.operations.VerifyTOTPResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        VerifyTOTPResponse res = sdk.users().verifyTOTP()
                .userId("<id>")
                .requestBody(VerifyTOTPRequestBody.builder()
                    .code("<value>")
                    .build())
                .call();

        if (res.object().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user for whom to verify the TOTP
requestBody Optional<VerifyTOTPRequestBody> N/A

Response

VerifyTOTPResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 500 application/json
models/errors/SDKError 4XX, 5XX */*

disableMFA

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

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.DisableMFAResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        DisableMFAResponse res = sdk.users().disableMFA()
                .userId("<id>")
                .call();

        if (res.object().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user whose MFA methods are to be disabled

Response

DisableMFAResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 404, 500 application/json
models/errors/SDKError 4XX, 5XX */*

deleteBackupCodes

Disable all of a user's backup codes.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.DeleteBackupCodeResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        DeleteBackupCodeResponse res = sdk.users().deleteBackupCodes()
                .userId("<id>")
                .call();

        if (res.object().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user whose backup codes are to be deleted.

Response

DeleteBackupCodeResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 404, 500 application/json
models/errors/SDKError 4XX, 5XX */*

deletePasskey

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

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.UserPasskeyDeleteResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        UserPasskeyDeleteResponse res = sdk.users().deletePasskey()
                .userId("<id>")
                .passkeyIdentificationId("<id>")
                .call();

        if (res.deletedObject().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user that owns the passkey identity
passkeyIdentificationId String ✔️ The ID of the passkey identity to be deleted

Response

UserPasskeyDeleteResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 403, 404, 500 application/json
models/errors/SDKError 4XX, 5XX */*

deleteWeb3Wallet

Delete the web3 wallet identification for a given user.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.UserWeb3WalletDeleteResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        UserWeb3WalletDeleteResponse res = sdk.users().deleteWeb3Wallet()
                .userId("<id>")
                .web3WalletIdentificationId("<id>")
                .call();

        if (res.deletedObject().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user that owns the web3 wallet
web3WalletIdentificationId String ✔️ The ID of the web3 wallet identity to be deleted

Response

UserWeb3WalletDeleteResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 403, 404, 500 application/json
models/errors/SDKError 4XX, 5XX */*

createTOTP

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

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.CreateUserTOTPResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        CreateUserTOTPResponse res = sdk.users().createTOTP()
                .userId("<id>")
                .call();

        if (res.totp().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user for whom the TOTP is being created.

Response

CreateUserTOTPResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 403, 404, 500 application/json
models/errors/SDKError 4XX, 5XX */*

deleteTotp

Deletes all of the user's TOTPs.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.DeleteTOTPResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        DeleteTOTPResponse res = sdk.users().deleteTotp()
                .userId("<id>")
                .call();

        if (res.object().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user whose TOTPs are to be deleted

Response

DeleteTOTPResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 404, 500 application/json
models/errors/SDKError 4XX, 5XX */*

deleteExternalAccount

Delete an external account by ID.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.DeleteExternalAccountResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        DeleteExternalAccountResponse res = sdk.users().deleteExternalAccount()
                .userId("<id>")
                .externalAccountId("<id>")
                .call();

        if (res.deletedObject().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
userId String ✔️ The ID of the user's external account
externalAccountId String ✔️ The ID of the external account to delete

Response

DeleteExternalAccountResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 403, 404, 500 application/json
models/errors/SDKError 4XX, 5XX */*