/clearbit

Go client library and command line interface to the Clearbit API

Primary LanguageGoMIT LicenseMIT

clearbit

GoDoc Reference Circle CI

clearbit is a client library and command-line interface for the Clearbit API.

Install for the command line

For OS X users, you can install and upgrade through the Homebrew package:

brew tap thoughtbot/formulae
brew update
brew install clearbit

Or, for anyone with Go installed, you can install from the command-line:

go get -u github.com/thoughtbot/clearbit/cmd/clearbit

Then, store your Clearbit API key in ~/.clearbit_key.

Usage from the command line

Use the subcommands to interact with the different Clearbit API endpoints.

Get detailed information about a person from their email address:

$ clearbit enrich b@thoughtbot.com

Get data about a company from its domain:

$ clearbit enrich thoughtbot.com

Get contact details for a company (role & seniority picklist):

$ clearbit prospect -role marketing -seniority executive thoughtbot.com

Since each command produces JSON as its output, the clearbit command pairs nicely with jq for processing.

Get company copy-pasteable company contacts:

$ clearbit prospect thoughtbot.com |
    jq '.[] | "\(.name.fullName) <\(.email)>"'

Run clearbit help [subcommand] for details on additional options.

Usage from Go

The clearbit package exposes types for interacting with the Clearbit API and the data it returns.

import "github.com/thoughtbot/clearbit"

client, _ := clearbit.NewClient(os.Getenv("CLEARBIT_API_KEY"))

bernerd, _ := client.EnrichPerson("b@thoughtbot.com")
thoughtbot, _ := client.EnrichCompany(bernerd.Employment.Domain)

prospects, _ := client.Prospect(clearbit.ProspectQuery{
  Domain: "thoughtbot.com",
  Titles: []string{"CEO", "CTO", "VP"},
})

for _, prospect := range prospects {
  prospectDetails, _ := client.EnrichPerson(prospect.Email)
}

For detailed API documentation, read the go docs.

Contributing

We love pull requests from everyone. By participating in this project, you agree to abide by the thoughtbot code of conduct.

We expect everyone to follow the code of conduct anywhere in thoughtbot's project codebases, issue trackers, chatrooms, and mailing lists.

License

clearbit is Copyright (c) 2016 thoughtbot, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About

clearbit is maintained by Bernerd Schaefer and thoughtbot's Go development team.

thoughtbot

The names and logos for thoughtbot are trademarks of thoughtbot, inc.

We love open source software! See our other projects or hire us to help build your product.