Sail Knowledgebase

Getting a DigitalOcean API Token

Sail uses the DigitalOcean API to interact with cloud services. This article explains how to create a DigitalOcean account, and obtain your API token.

If you like Sail, don't forget to give us a star on GitHub!

Create a DigitalOcean account

If you don't have an account with DigitalOcean yet, you can create one here.

Note that while Sail CLI is completely free, the DigitalOcean hosting platform used by Sail is a paid service. All billing associated with the cloud platform is the responsibility of the user, and not the Sail software, service or any of its authors or contributors.

New DigitalOcean users will typically receive some free credits, which can be used to evaluate the platform.

Generate a new DigitalOcean API token

After creating your DigitalOcean account and verifying your e-mail address, sign into the DigitalOcean dashboard, navigate to the API > Tokens/Keys section from the left panel, and hit the Generate New Token button.

Give the new token a descriptive name, for example "sail", and make sure that both Read and Write scopes are selected.

After generating the token, it'll show up in the list of personal access tokens, you'll see the token itself directly below the token name. Copy that token and store it in a safe place.

Using the DigitalOcean API token with Init

When creating a new Sail project with sail init, you can pass your DigitalOcean API token on the command line with the --provider-token option:

sail init --provider-token=YOUR_TOKEN

Saving the token to the Sail user configuration

While the API token can be used on the command line with sail init, it is recommended to save the provider token once as a default, so that all new Sail projects are automatically assigned this token:

sail config provider-token YOUR_TOKEN

Now, every time you invoke sail init you will not need to pass the provider token, however you can still override your default token with a --provider-token option on the command line.

You can remove the default token with:

sail config provider-token --delete

Revoking API access

If you need to revoke Sail CLI access to your DigitalOcean account, you should delete the API token granted to Sail. This can be done from your DigitalOcean control panel.

Browse to API > Tokens/Keys. Find the personal access token you wish to delete, hit the More dropdown next to it, and select the Delete option.