DigitalOcean API

The first step to using the API is to generate a personal access token. Personal access tokens function like ordinary OAuth access tokens. They can be used instead of a password for DigitalOcean over HTTPS, or can be used to authenticate to the API over Basic Authentication.

A detailed tutorial about how to use the version 2 API can be found here:

- Tutorial - digitalocean.com - API Documentation - digitalocean.com

DigitalOcean tokens can be created with read or read-write scope. Write scope is required if you want to modify your account in any way (e.g. create or delete a droplet).

Here are the steps to generating a personal access token:

  • Log in to DigitalOcean Control Panel
  • Click on Apps & API in the sidebar on the left-hand side
  • Click Generate new token
  • Enter your desired token name
  • Select the scope for this token (read or read/write)
  • Click Generate Token
  • Record your personal access token now. It will not be shown again, for security purposes

Example Token

Here is an example of what your token will look like:

Example token

Note: Remember to keep your tokens secret! They function similarly to passwords. Do not hardcode your token(s) into programs--use environmental variables. If a token becomes compromised, delete it to revoke that token's access.

Now that you have generated a personal access token, you can use it like a password to use the API with your account.