The Heroku CLI's API Workflow

Ever wondered how the Heroku command line client accomplishes its work? We don’t talk about it much, but the Heroku CLI isn’t a black box, it’s a fairly thin consumer of our own RESTful API, and that means everything you do in your day to day workflow on Heroku is available to work with in a programmatic fashion. The CLI even uses our own implementation of the API library called heroku.rb (and by the way, heroku.rb is a great choice if you want to consume the API from Ruby).

A handy tool that we use here regularly is inspecting the CLI’s workflow by telling Excon to send its output to standard out. Try it for yourself:


Any calls that are implemented via heroku.rb make their requests using Excon, but a few of the older endpoints still use Restclient. If you run into one of these, you can do something very similar:

RESTCLIENT_LOG=stdout heroku drains -a mutelight

Posted on July 9, 2012 from San Francisco


My name is Brandur. I'm a polyglot software engineer and part-time designer working at Heroku in San Francisco, California. I'm a Canadian expat. My name is Icelandic. Drop me a line at

Aside from technology, I'm interested in energy and how it relates to our society, travel, longboarding, muay thai, symphonic metal, and the guitar.

If you liked this article, consider finding me on Twitter.