> ## Documentation Index
> Fetch the complete documentation index at: https://buttercms.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Heroku add-on

> Provision and configure ButterCMS as a Heroku add-on to manage your API token and access the ButterCMS dashboard directly from Heroku.

The ButterCMS Heroku add-on lets you provision a ButterCMS account directly from Heroku. Your API token is automatically injected as a config var, and you can access the ButterCMS dashboard via Heroku SSO — no separate login required.

## Provisioning

Provision the add-on using the Heroku CLI:

```bash theme={null}
heroku addons:create butter
```

You can also provision it from the [Heroku Elements Marketplace](https://elements.heroku.com/addons/butter), or directly from the **Resources** tab of your app in the Heroku dashboard.

For available plans and pricing, see the [ButterCMS listing on the Heroku Elements Marketplace](https://elements.heroku.com/addons/butter#pricing).

To provision a specific plan:

```bash theme={null}
heroku addons:create butter --app YOUR_APP_NAME
```

### Regional availability

| Runtime | Regions |
| - | - |
| **Common Runtime** | United States, Europe |
| **Private Spaces** | Dublin, Frankfurt, London, Montreal, Mumbai, Oregon, Singapore, Sydney, Tokyo, Virginia |

## Accessing your API token

After provisioning, a `<APP_NAME>_BUTTER_TOKEN` config var is automatically added to your Heroku app. Confirm it is set with:

```bash theme={null}
heroku config:get <APP_NAME>_BUTTER_TOKEN
```

### Local development

To use the token in your local environment, add it to a `.env` file:

```bash theme={null}
heroku config:get <APP_NAME>_BUTTER_TOKEN -s >> .env
```

> [!WARNING]
>
> Make sure `.env` is listed in your `.gitignore` to avoid accidentally committing your API token to version control.
>
> ```bash theme={null}
> echo .env >> .gitignore
> ```

### Using the token in your app

Reference `<APP_NAME>_BUTTER_TOKEN` as an environment variable in your application code rather than hardcoding it:

```javascript theme={null}
// Node.js
import Butter from 'buttercms';
const butter = Butter(process.env.<APP_NAME>_BUTTER_TOKEN);
```

```python theme={null}
# Python
import buttercms
butter = buttercms.api_client.APIClient(os.environ.get('<APP_NAME>_BUTTER_TOKEN'))
```

```ruby theme={null}
# Ruby
butter = ButterCMS::API.new(ENV['<APP_NAME>_BUTTER_TOKEN'])
```

> [!NOTE]
>
> `<APP_NAME>_BUTTER_TOKEN` is a read API token. If you need write access, contact [ButterCMS support](mailto:support@buttercms.com) to enable a write token.

## Accessing the ButterCMS dashboard

Open the ButterCMS dashboard directly from the CLI using Heroku SSO:

```bash theme={null}
heroku addons:open butter
```

You can also access it by clicking the ButterCMS icon in the **Add-ons** section of your app in the Heroku dashboard.

## Supported languages & frameworks

> [card] JavaScript
>
> Node.js, React, Vue.js, Angular

> [card] Python
>
> Python, Django

> [card] Ruby
>
> Ruby, Rails

> [card] PHP
>
> PHP, Laravel

> [card] Go
>
> Go

> [card] JVM
>
> Java, Scala, Clojure

## Deprovisioning

To remove the ButterCMS add-on from your app:

```bash theme={null}
heroku addons:destroy butter
```

> [!WARNING]
>
> Deprovisioning is permanent and will destroy all content and data associated with the add-on. This action cannot be undone.

## Troubleshooting

> [accordion] \<APP\_NAME>\_BUTTER\_TOKEN is not set after provisioning
>
> Run `heroku config` to list all config vars for your app. If `<APP_NAME>_BUTTER_TOKEN` is missing, try reprovisioning the add-on or contact [ButterCMS support](mailto:support@buttercms.com).

> [accordion] I can't open the dashboard with heroku addons:open butter
>
> Ensure you are logged in to the Heroku CLI (`heroku login`) and that the add-on is provisioned for the correct app. Specify the app explicitly if needed: `heroku addons:open butter --app YOUR_APP_NAME`.

> [accordion] Who do I contact for support?
>
> For Heroku-specific provisioning issues, use [Heroku Support](https://help.heroku.com). For ButterCMS product questions, contact [support@buttercms.com](mailto:support@buttercms.com).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.