The SDK can be configured in three ways: environment variables, configuration singleton and constructor arguments. The priority goes like this:

  1. Constructor arguments

  2. Configuration object

  3. Environment variables

If an argument is not provided, the configuration object is looked up, which falls back to the associated environment variable. Here's an example with all supported configuration settings their environment variable equivalents:

Clerk.configure do |c|
c.api_key = "your_api_key" # if omitted: ENV["CLERK_API_KEY"] - API calls will fail if unset
c.base_url = "https://..." # if omitted: ""
c.logger = # if omitted, no logging
c.middleware_cache_store = Rails.cache # if omitted: no caching

You can customize each instance of the Clerk::SDK object by passing keyword arguments to the constructor:

clerk =
api_key: "X",
base_url: "Y",

For full customization, you can instead pass a Faraday object directly, which will ignore all the other arguments, if passed:

faraday =
clerk = faraday)

Refer to the Faraday documentation for details.

Environment variables

Here's a list of all environment variables the SDK uses:

Variable name



Overrides the default API base URL:


The API key of your instance (required)


Rails view helper: clerk_sign_in_url


Rails view helper: clerk_sign_up_url


Rails view helper: clerk_user_profile_url