doctl Verified current stable Not installed? Cloud Infrastructure

Doctl / Get Account Balance Access Token

Get Account Balance Access Token

Get account balance using an access token with `doctl`.

$
Terminal
doctl balance g -t <access_token>

When To Use

When executing scripts requiring different access credentials than those in the current session.

Pro Tip

Store access tokens securely; avoid embedding them directly in scripts.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
doctl balance g -t <access_token>

Anatomy of Output

Understanding the result

Balance: $75.00 Account Balance

Current balance accessible via the provided token.

Plan: basic droplet Plan Description

Details regarding the current service plan.

Last Transaction: $25.00 Last Transaction Amount

Most recent incoming or outgoing fund activity.

Power User Variants

Optimized versions

doctl balance get --access-token access_token --raw

Retrieve raw balance data without formatting.

doctl balance get --access-token access_token --history

Fetch account balance history attached to the provided token.

Troubleshooting

Common pitfalls

Error: invalid access token

Solution: Ensure the token provided is valid and active.

Error: unauthorized access

Solution: Verify permissions associated with the access token.

Error: API limit reached

Solution: Examine usage rates and optimize your API calls accordingly.

Command Breakdown

What each part is doing

doctl
Base Command
The executable that performs this operation. Here it runs Doctl before the shell applies any redirect operators.
g
g|get
The value supplied for g|get.
-t
t| access token
The value supplied for t| access token.
<access_token>
access token
The value supplied for access token.
-t
Command Option
Tool-specific option used by this command invocation.

Alternative Approaches

Comparable commands in other tools

Alternative cloud infrastructure tools for the same job.