Skip to Content
Clerk logo

Clerk Docs

Ctrl + K
Go to clerkstage.dev

Available methods

The Ruby SDK mirrors the Backend API(opens in a new tab). The SDK is organized into resources, which are listed below. Each resource has a set of methods that correspond to the API endpoints.

All examples assume you have an instance of the Clerk::SDK:

sdk = Clerk::SDK.new

Allowlist identifiers(opens in a new tab)

Retrieve the list of allowlist identifiers.

sdk.allowlist_identifiers.all

Add a new identifier to the allowlist. If notify is true, an email will be sent to notify the owner of the identifier.

sdk.allowlist_identifiers.create(identifier: "john@example.com", notify: true)

Delete an allowlist identifier, given a valid ID. Throws an error if the ID is invalid.

sdk.allowlist_identifiers.delete("alid_xyz")

Allowlist

Toggle allowlist-only sign-ups on/off.

sdk.allowlist.update(restricted_to_allowlist: true)

Clients(opens in a new tab)

Retrieve a single client by its ID, if the ID is valid. Throws an error otherwise.

sdk.clients.find("client_xyz")

Retrieve the list of clients.

sdk.clients.all

Verify the JWT and return the client.

sdk.clients.verify_token("jwt")

Emails(opens in a new tab)

Send an email message to an email address ID belonging to another user.

sdk.emails.create( email_address_id: "ema_xyz", from_email_name: "noreply", subject: "Welcome", body: "<html>...</html>", )

Sessions(opens in a new tab)

Retrieve a single session by its ID, if the ID is valid. Throws an error otherwise.

sdk.sessions.find("sess_xyz")

Retrieve a list of sessions.

sdk.sessions.all

Revokes a session given its ID, if the ID is valid. Throws an error otherwise.

sdk.sessions.revoke("sess_xyz")

Verify whether a session with a given ID corresponds to the provided session token. Throws an error if the provided ID is invalid.

sdk.sessions.verify_token("sess_xyz", "jwt")

SMS messages (deprecated)

This resource is deprecated. Clerk no longer supports sending SMS messages through Clerk's backend API.

Send an SMS message to a phone number ID belonging to another user.

sdk.sms_messages.create(phone_number_id: "idn_xyz", message: "Welcome!")

Users(opens in a new tab)

Retrieves a list of users.

sdk.users.all

Retrieves a list of users, with filters:

sdk.users.all(email_address: ["user1@example.com", "user2@example.com"])

Updates a user with a given ID. The provided ID must be valid, otherwise an error will be thrown.

sdk.users.update("user_xyz", {first_name: "John"})

Deletes a user given a valid ID. Throws an error otherwise.

sdk.users.delete("user_xyz")

What did you think of this content?

Clerk © 2024