Docs

Available methods

The Ruby SDK mirrors the Backend API. 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
sdk.allowlist_identifiers.all

Add a new allowlist identifier

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)
sdk.allowlist_identifiers.delete("alid_xyz")
sdk.allowlist.update(restricted_to_allowlist: true)

Clients

The following methods are available for the clients resource.

Retrieve a single client

sdk.clients.find("client_xyz")
sdk.clients.all
sdk.clients.verify_token("jwt")

Sessions

The following methods are available for managing sessions.

Retrieve a single session

sdk.sessions.find("sess_xyz")
sdk.sessions.all
sdk.sessions.revoke("sess_xyz")

Verify a session to a token

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")

Users

The following methods are available for managing users.

Retrieve a list of users

sdk.users.all

You can also filter users by email address:

sdk.users.all(email_address: ["user1@example.com", "user2@example.com"])
sdk.users.update("user_xyz", {first_name: "John"})
sdk.users.delete("user_xyz")

Feedback

What did you think of this content?