How to create API token on DigitalOcean
Log into DigitalOcean Control Panel, navigate to API > Tokens, generate a new token with a name, expiration, and scopes, then copy the token immediately as it shows only once. Use custom scopes for least privilege like domain:read/write for DNS. Store securely and use via Authorization: Bearer $TOKEN in API calls.
Prerequisites
- Active DigitalOcean account with email verified
- Browser access to DigitalOcean Control Panel
- Team permissions to generate tokens
- Secure storage like a password manager
Step-by-Step Instructions
Log in to DigitalOcean Control Panel
Navigate to API section
Access Personal Access Tokens
Enter token name
Set expiration period
Choose scopes
domain:read and domain:write for DNS, read for monitoring, or full Read and Write for broad access. Review the scope summary at the bottom.Generate the token
Verify in token list
Use the token in tools
Authorization: Bearer $TOKEN header. For CLI: doctl auth init --access-token YOUR_TOKEN_HERE For scripts: export DIGITALOCEAN_TOKEN="your_token_here" then curl -X GET -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" https://api.digitalocean.com/v2/account.Common Issues & Troubleshooting
Can't access API section or Generate button is missing/grayed out
Insufficient team role permissions; ask team owner to elevate your role or grant token generation access.
Token not visible after generation
Token shows only once; if lost, regenerate a new one immediately without navigating away.
403 Forbidden on API calls
Token scopes don't match endpoint requirements; regenerate with appropriate custom scopes like read/write.
Token expired or invalid
Check expiration setting; regenerate via same steps if auto-deleted.
Expired browser session during process
Re-login to Control Panel and restart from API > Tokens tab.