node package manager


Heroku Addons

A convenience library for querying Heroku's addons API.


npm install heroku-addons --save


The library requires a HEROKU_API_TOKEN environment variable to authenticate with the Heroku Platform API. Create a .env file with your token:

echo "HEROKU_API_TOKEN=$(heroku auth:token)" >> .env

Here's a sample script. Let's say it's named demo.js:

var addons = require('heroku-addons')
var slugs = [
addons.mix(slugs, function(err, mix) {

Run it using foreman, which will make the variables in your .env file available in the script's env:

foreman run node demo.js

The output will look something like this:

  totalPrice: "$59/mo",
  totalPriceInCents: 5900,
  plans: [{
    created_at: '2013-08-05T20:50:21Z',
    default: true,
    description: 'Redis To Go Nano',
    id: '0e4db8d1-973a-40a6-8af2-06954105565c',
    name: 'redistogo:nano',
    price: [Object],
    state: 'public',
    updated_at: '2013-12-16T22:19:39Z'
  }, {
    created_at: '2013-08-05T20:50:22Z',
    default: true,
    description: 'MongoHQ MongoHQ Sandbox',
    id: 'c7a19cde-5ba0-4e85-a579-1022abdd344a',
    name: 'mongohq:sandbox',
    price: [Object],
    state: 'public',
    updated_at: '2013-12-16T22:19:40Z'
  }, {
    created_at: '2013-09-13T17:46:32Z',
    default: false,
    description: 'Runscope Starter',
    id: '85e601e0-1b99-483b-8a55-a8abbf36d9c4',
    name: 'runscope:starter',
    price: [Object],
    state: 'public',
    updated_at: '2013-12-16T22:20:02Z'
  }, {
    created_at: '2013-08-05T20:50:35Z',
    default: false,
    description: 'Bonsai Elasticsearch Staging',
    id: '0ee349b5-6088-4694-9777-b81088f6072e',
    name: 'bonsai:staging',
    price: [Object],
    state: 'public',
    updated_at: '2013-12-16T22:19:49Z'

See test/index.js for more details.


The tests are not mocked: they hit the real API. The test suite expects a HEROKU_API_TOKEN in your .env file:

echo "HEROKU_API_TOKEN=$(heroku auth:token)" >> .env
npm test