This program provides command-line access to the B2 service.

There are two flows of authorization:

  • call b2 authorize-account and have the credentials cached in sqlite

  • set B2_APPLICATION_KEY_ID and B2_APPLICATION_KEY environment variables when running this program

This program caches authentication-related and other data in a local SQLite database. The location of this database is determined in the following way:

If --profile arg is provided:

  • XDG_CONFIG_HOME/b2/db-<profile>.sqlite, if XDG_CONFIG_HOME env var is set

  • ~/.b2db-{profile}.sqlite


  • B2_ACCOUNT_INFO env var’s value, if set

  • ~/.b2_account_info, if it exists

  • XDG_CONFIG_HOME/b2/account_info, if XDG_CONFIG_HOME env var is set

  • ~/.b2_account_info, as default

If the directory XDG_CONFIG_HOME/b2 does not exist (and is needed), it is created. Please note that the above rules may be changed in next versions of b2sdk, and in order to get reliable authentication file location you should use b2 get-account-info.

You can suppress command stdout & stderr output by using --quiet option. To supress only progress bar, use --noProgress option.

For more details on one command:

b2 <command> --help

When authorizing with application keys, this tool requires that the key have the listBuckets capability so that it can take the bucket names you provide on the command line and translate them into bucket IDs for the B2 Storage service. Each different command may required additional capabilities. You can find the details for each command in the help for that command.

A string provided via an optional environment variable B2_USER_AGENT_APPEND will be appended to the User-Agent.

Documentation index

Indices and tables