Buildkite CLI configuration

The Buildkite CLI uses both the REST and GraphQL APIs to interact with Buildkite, and therefore, requires the configuration of an API access token.

Create an API access token for the Buildkite CLI

To create a new API access token:

  1. Select your user profile icon > Personal Settings in the global navigation.

  2. Select API Access Tokens to access your API Access Tokens page.

  3. Select New API Access Token to open the New API Access Token page.

  4. Specify a Description and the Organization Access (that is, the specific Buildkite organization) for this token.

  5. Once you have selected the required REST API Scopes and Enable GraphQL API access for the token, retain a copy of your API access token's value in a secure location.

Note: You can also use the following New API Access Token page links with pre-set fields to create these API access tokens:

If you use one of these links, you must still specify the Buildkite organization (in Organization Access) for this API access token.

Configure the Buildkite CLI with your API access token

Once you have created your API access token, you'll need to configure the Buildkite CLI with this token.

To do this:

  1. Run the following command:

    bk configure
    
  2. When prompted for Organization slug, specify the slug for your Buildkite organization.

  3. When prompted for API Token, specify the value for your configured API access token.

Configure the Buildkite CLI with multiple organizations

Some users may have access to Buildkite organizations—one for their company, and others for open-source work, personal work, etc.

The Buildkite CLI tool allows you to work with such multiple Buildkite organizations.

To configure the Buildkite CLI tool with another Buildkite organization:

  1. Ensure you have created individual API access tokens for each Buildkite organization to configure in the Buildkite CLI tool.

  2. Run the following command:

    bk configure add
    
  3. When prompted for Organization slug, specify the slug for the new Buildkite organization to add to the Buildkite CLI.

  4. When prompted for API Token, specify the value for your configured API access token for this organization.

Select a configured organization

If your Buildkite CLI tool has been configured with multiple Buildkite organizations, you can switch from your current/active organization to another. To do this:

  1. Run the following command:

    bk use
    
  2. Use the cursor select another configured Buildkite organization and make it the current/active one. All subsequent bk commands will operate with the new active organization.