Available Methods
The Ruby SDK mirrors the Backend API. Here's a list of the instance methods on the Clerk::SDK
and the API endpoint each one corresponds to:
allowlist_identifiers
|
API endpoint/prefix | Methods on resource object |
---|---|---|
allowlist_identifiers
|
/v1/allowlist_identifiers |
update
create
delete
|
allowlist
|
/v1/beta_features/allowlist |
update
|
clients
|
/v1/clients |
all
find
verify_token
|
emails
|
/v1/emails |
create
|
sessions
|
/v1/sessions |
all
find
verify_token
revoke
|
sms_messages
|
/v1/sms_messages |
create
|
users
|
/v1/users |
all
find
update
delete
|
Examples
All examples assume you have an instance of the Clerk::SDK
:
sdk = Clerk::SDK.new
Allowlist identifiers
Get an array of all allowlist identifiers:
sdk.allowlist_identifiers.all
Create a new allowlist
sdk.allowlist_identifiers.create(identifier: "john@example.com", notify: true)
Delete an allowlist
sdk.allowlist_identifiers.delete("alid_xyz")
Allowlist
Toggle allowlist-only sign-ups on/off:
sdk.allowlist.update(restricted_to_allowlist: true)
Clients
Get a client by its ID:
sdk.clients.find("client_xyz")
Get an array of all clients:
sdk.clients.all
Verify the JWT and return the client:
sdk.clients.verify_token("jwt")
Emails
Send an email:
sdk.emails.create(email_address_id: "ema_xyz",from_email_name: "noreply",subject: "Welcome",body: "<html>...</html>",)
Sessions
Get a session by its ID:
sdk.sessions.find("sess_xyz")
Get an array of all sessions
sdk.sessions.all
Revoke a session:
sdk.sessions.revoke("sess_xyz")
Verify the JWT of a specific session ID:
sdk.sessions.verify_token("sess_xyz", "jwt")
SMS Messages
Send an SMS:
sdk.sms_messages.create(phone_number_id: "idn_xyz", message: "Welcome!")
Users
Get an array of all users:
sdk.users.all
Get an array of users, with filters:
sdk.users.all(email_address: ["user1@example.com", "user2@example.com"])
Update a user:
sdk.users.update("user_xyz", {first_name: "John"})
Delete a user:
sdk.users.delete("user_xyz")