AccountInfo stores basic information about the account, such as Application Key ID and Application Key, in order to let b2sdk.v2.B2Api perform authenticated requests.

There are two usable implementations provided by b2sdk:

  • b2sdk.v2.InMemoryAccountInfo - a basic implementation with no persistence

  • b2sdk.v2.SqliteAccountInfo - for console and GUI applications

They both provide the full AccountInfo interface.


Backup applications and many server-side applications should implement their own AccountInfo, backed by the metadata/configuration database of the application.

AccountInfo implementations


AccountInfo with no persistence.


Implementing your own

When building a server-side application or a web service, you might want to implement your own AccountInfo class backed by a database. In such case, you should inherit from b2sdk.v2.UrlPoolAccountInfo, which has groundwork for url pool functionality). If you cannot use it, inherit directly from b2sdk.v2.AbstractAccountInfo.

>>> from b2sdk.v2 import UrlPoolAccountInfo
>>> class MyAccountInfo(UrlPoolAccountInfo):

b2sdk.v2.AbstractAccountInfo describes the interface, while b2sdk.v2.UrlPoolAccountInfo and b2sdk.v2.UploadUrlPool implement a part of the interface for in-memory upload token management.

AccountInfo interface

AccountInfo helper classes

class b2sdk.account_info.upload_url_pool.UploadUrlPool[source]

For each key (either a bucket id or large file id), hold a pool of (url, auth_token) pairs.


This class is not part of the public interface. To find out how to safely use it, read this.

put(key, url, auth_token)[source]

Add the url and auth token to the pool for the given key.

  • key (str) – bucket ID or large file ID

  • url (str) – bucket or file URL

  • auth_token (str) – authentication token


Return a (url, auth_token) if one is available, or (None, None) if not.


key (str) – bucket ID or large file ID

Return type



Remove an item from the pool by key.


key (str) – bucket ID or large file ID