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

# Connect Heroku with API Key – StackOne Hub

> Link a Heroku account in the StackOne Hub using API Key. End-user guide to authorize the integration and start using Heroku actions.

## Choose the account for the connection

The token acts as the Heroku account that creates it, with that account's role in the team. A token created with the default scope can read and write everything that account can reach, so use a viewer of the team. A viewer has read-only access to the team's resources and can still view its users and invitations.

**1. Pick or add the account**

Use an account that is a viewer, member or admin of the Heroku Team you want to connect.

<ul>
  <li>If the team uses single sign-on, use an account created directly in Heroku and added to the team.</li>
</ul>

## Create the API token

Heroku creates long-lived tokens from the Heroku CLI.

**1. Create the token**

Create the token in the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli).

<ul>
  <li>Run `heroku login` and sign in as the account you chose.</li>
  <li>Run `heroku authorizations:create -d "StackOne" -S`. It prints only the token.</li>
</ul>

**2. Copy the token**

Copy the **API Key** across. The token does not expire. Revoking it with `heroku authorizations:revoke` disconnects the connection.

## Find the team name

Check which Heroku Teams the account belongs to.

**1. Copy the team name**

Run `heroku teams` in the Heroku CLI to list the teams the account belongs to.

<ul>
  <li>If the account belongs to more than one Heroku Team, copy the **Team Name** across.</li>
  <li>If it belongs to only one, leave **Team Name** empty.</li>
</ul>

## Link the Account

**1. Connect**

<ul>
  <li>Click **Connect**.</li>
  <li>If applicable, the provider will redirect you to a sign-in or authorization page. Complete the provider's authorization flow.</li>
  <li>Once authorization is successful, you will see a confirmation popup.</li>
</ul>

**2. Use Actions**

Connect an AI platform to the linked account's actions. See [AI Platforms](https://docs.stackone.com/ai-platforms/overview.md).

Other ways to call actions are listed in [Protocols & SDKs](https://docs.stackone.com/connect/protocols-and-sdks.md).


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