Skip to content
DigitalOceanPersonal access token

How to rotate a DigitalOcean API token

Regenerate a DigitalOcean personal access token safely: create a twin with the same scopes, switch your tools, delete the old one, and clean up Droplet access.

DigitalOceanPersonal access token

Starts with: dop_v1_…
What a leaked key reaches
Team resources within the token's scopes, capped by the creator's team role. A Full Access token follows that role as it changes.
Can be scoped
Yes

Keys can be limited to fewer permissions or resources.

Expires
Chosen at creation; an expired token disappears from the account
Switching keys
Overlap windowRevokes at once

What Crunu does here

Crunu doesn't reissue keys at providers. It shows which values to replace and keeps the new one.

Build the list for a departure with the offboarding checklist
On this page

Generate a new personal access token with the same scopes on the Tokens tab of the control panel, switch your scripts and tools to it, and delete the old token once nothing uses it. Each token stands on its own, so the old and the new one work side by side during the switch. Deleting a token revokes its access (DigitalOcean docs). The token menu also offers Regenerate, but the documentation doesn't say what happens to the old value, so don't count on it for an overlap.

Crunu doesn't generate, regenerate or delete DigitalOcean tokens; it has no DigitalOcean integration. It works out which DigitalOcean values a departing person received, keeps the new token as a new environment version, and passes it to the tools that call the API.

Scopes age differently

How a token behaves over time depends on the scope you gave it, and this is a good reason to look at it again during a reissue:

  • Full Access uses the api:write alias and grants everything your team role allows. If the role gains permissions, so does the token.
  • Custom Scopes keeps exactly the scopes chosen at creation. A later change to your role adds nothing to the token.
  • Read Only uses the api:read alias and reads everything your role can read.

You can't edit a token's scope after creation, and a request outside its scopes gets 403 Forbidden. If a team owner narrows your role, existing tokens lose those permissions too. In practice, an old Full Access token quietly grows with its owner's role, so replacing it with a custom-scoped token is often the main gain of the reissue. It also pays to note whose token it is: its permissions come from the team role of the person who created it, so a token that serves the whole team shouldn't depend on one person's role.

Prefixes and leaked tokens

DigitalOcean tokens start with a prefix that names their type: dop_v1_ for personal access tokens made in the control panel, doo_v1_ for tokens issued to applications through OAuth, and dor_v1_ for OAuth refresh tokens (API reference). The prefixed format came with DigitalOcean's 2022 token update, which also joined GitHub's secret scanning program: a token exposed publicly is revoked automatically and its owner is notified (DigitalOcean blog). A token without the prefix predates that update, and DigitalOcean recommended regenerating such tokens at the time.

Reissue without downtime

  1. In the control panel, open Account, then API, and on the Tokens tab choose Generate New Token. Enter a name, choose when it expires and pick its scopes. Copy the secret: it's shown only once.
  2. Put it in Crunu as DIGITALOCEAN_TOKEN in the environment your tooling reads, for example data-pipeline / production, and save. The environment history gains a version with your name on it.
  3. Switch the tools. Deploy scripts and Terraform runs started under crunu run read the newest version every time they start; long-running services restart on their own with --restart on-change.
  4. Test the new token with a harmless read, such as the request below, before you touch the old one.
  5. Delete the old token from the Tokens tab. Tokens with an expiry date also leave by themselves: once it passes, the token can no longer authenticate and disappears from your account.
Shell
crunu run --env data-pipeline/production -- sh -c \
  'curl -s https://api.digitalocean.com/v2/account -H "Authorization: Bearer $DIGITALOCEAN_TOKEN"'

A token with custom scopes may not be allowed to read the account. If it gets 403 Forbidden, test with a request inside its scopes instead.

When someone leaves the team

DigitalOcean is direct about the limits of removing a team member. Removal revokes their access to the team in the control panel and the API. It doesn't revoke their access to Droplets through SSH keys or other credentials, because DigitalOcean doesn't manage what's inside a Droplet after it's created (team limits). A full offboarding therefore has three parts:

  • remove the person from the team;
  • reissue every DigitalOcean token they could read, such as a shared CI token, and move automation that ran on a token they created to a new one;
  • remove their SSH keys and other credentials from the Droplets themselves. Rotating SSH keys covers that part.

In Crunu, removing the person produces a reissue checklist of the values they received, with a link to the DigitalOcean token page for recognized values. Leaks follow the same steps, faster: delete the token first, then deploy the replacement. What to rotate when a developer leaves gives the full order of work, and the offboarding checklist builds the list for your stack.

Frequently asked questions

Something else? Write to support@crunu.com

Does DigitalOcean's Regenerate action keep the old token working?

DigitalOcean's documentation lists Regenerate among a token's actions but doesn't say what happens to the old value. For a planned switch, create a separate token with the same scopes, move your tools to it and delete the old token.

Can I change the scopes of an existing DigitalOcean token?

No. Scopes can't be edited after creation. To narrow a Full Access token to custom scopes, create a new token with the scopes you need, switch to it and delete the old one.

Does removing someone from a DigitalOcean team end all their access?

No. DigitalOcean says removal revokes their access to the team in the control panel and the API, but not their access to Droplets through SSH keys or other credentials. Those have to be removed on the Droplets themselves.

Does Crunu regenerate DigitalOcean tokens?

No. Crunu doesn't call the DigitalOcean API. It shows which DigitalOcean values a departing person received, stores the new token as a new environment version and passes it to your tools through crunu run.

Sources

Every source this page relies on, with the date we last checked it.

  1. DigitalOcean Docs: How to create a personal access token · checked October 30, 2026
  2. DigitalOcean API reference: Account · checked October 30, 2026
  3. DigitalOcean Docs: Team limits · checked October 30, 2026
  4. DigitalOcean blog: Updated API tokens with new management features · checked October 30, 2026
  • Docker

    Personal access token

    Expiry: None by default; 30 or 90 days, or a custom date up to a year ahead

    dckr_pat_…Partly scoped

  • GitHub

    Fine-grained personal access token

    Expiry: Set at creation; no expiry is allowed unless an org lifetime policy blocks it

    github_pat_…Scoped keys

  • GitLab

    Personal, project or group access token

    Expiry: Required by default, at most 365 days unless an admin changes the limit

    glpat-…Scoped keys

  • Google Cloud

    Service account key (JSON)

    Expiry: Never by default; an organization policy can limit key lifetime

    Partly scopedDelayed revocation

  • Hetzner

    Cloud API token

    Expiry: No expiry option in Hetzner's documentation

    Partly scopedRevocation time unknown

  • npm

    Granular access token

    Expiry: Always set; write tokens default to 7 days and last at most 90

    Scoped keysDelayed revocation

Know which values to replace

Free during early access. When someone leaves, Crunu lists the values they received, changes the environment keys, and keeps each new value as a new version.