Once Clearbit has been added a CLEARBIT_KEY setting will be available in the app configuration and will contain the API key that can be used for authenticating with Clearbit. This can be confirmed using the heroku config:get command.

$ heroku config:get CLEARBIT_KEY

After installing Clearbit the application should be configured to fully integrate with the add-on.

Local setup

Environment setup

After provisioning the add-on it’s necessary to locally replicate the config vars so your development environment can operate against the service.

Though less portable it’s also possible to set local environment variables using export CLEARBIT_KEY=value.

Use the Heroku Local command-line tool to configure, run and manage process types specified in your app’s Procfile. Heroku Local reads configuration variables from a .env file. To view all of your app’s config vars, type heroku config. Use the following command to add the CLEARBIT_KEY values retrieved from heroku config to your .env file.

$ heroku config -s | grep CLEARBIT_KEY >> .env
$ more .env

Credentials and other sensitive configuration values should not be committed to source-control. In Git exclude the .env file with: echo .env >> .gitignore.

Using with Ruby

Ruby applications will need to add the following entry into their Gemfile specifying the clearbit RubyGem.

gem 'clearbit'

Update application dependencies with bundler.

$ bundle install

Then from within your application you can look up an email address by:

Clearbit::Streaming::Person[email: 'test@example.com']

The example above is using our streaming API, and can block for up to 60 seconds. If this is an issue, i.e. you’re performing a look up inside a request/response cycle, we suggest you use our webhook API.