LinuxCommandLibrary

doctl-balance

Manage DigitalOcean load balancers

TLDR

Get balance of the account associated with the current context

$ doctl balance [[g|get]]
copy

Get the balance of an account associated with an access token
$ doctl balance [[g|get]] [[-t|--access-token]] [access_token]
copy

Get the balance of an account associated with a specified context
$ doctl balance [[g|get]] --context
copy

SYNOPSIS

doctl balance get [flags]

PARAMETERS

--access-token string
    DigitalOcean API V2 access token (overrides env var)

--format string
    Output format: json, yaml, or table (default: table)

--no-header
    Suppress column headers in table output

--output string
    Write output to file instead of stdout

--verbose
    Enable verbose logging

-h, --help
    Show command help

DESCRIPTION

doctl balance is a subcommand of the official DigitalOcean CLI tool, doctl, used to retrieve and display your account's current billing balance. It queries the DigitalOcean API to show key details like the current balance amount, prepaid account limit if applicable, total spend for the month so far, and projected costs. This helps users monitor resource usage and avoid billing overages.

By default, output is in a readable table format. It's essential for DevOps workflows, scripting, and cost management on DigitalOcean cloud infrastructure. Authentication requires a personal access token, set via doctl auth init or the DO_API_TOKEN environment variable.

Ideal for automation: pipe JSON output to tools like jq for parsing balance data in CI/CD pipelines or monitoring scripts. Supports verbose mode for debugging API interactions.

CAVEATS

Requires valid DigitalOcean API token with read access to billing. Prepaid accounts show limit; monthly billing shows spend. Rate-limited by API.

EXAMPLE USAGE

doctl balance get
doctl balance get --format json | jq '.balance'

AUTHENTICATION

Run doctl auth init first or export DO_API_TOKEN.

HISTORY

Introduced in early doctl versions (~2016) with DigitalOcean API v2. Evolved with API updates; current in doctl v1.100+ for enhanced billing visibility.

SEE ALSO

doctl(1), jq(1)

Copied to clipboard