COMING SOON - The application key APIs are under development, and will be available soon.

b2_list_keys

Lists application keys associated with an account.

Request

Request HTTP Headers

Authorization

required

An authorization token, obtained from b2_authorize_account. The token must have the listKeys capability.

Request HTTP Message Body Parameters

accountId

required

The ID of your account.

maxKeyCount

optional

The maximum number of keys to return in the response. Default is 100, maximum is 10000.
NOTE: b2_list_keys is a Class C transaction (see Pricing). The maximum number of keys returned per transaction is 1000. If you set maxKeyCount to more than 1000 and more than 1000 are returned, the call will be billed as multiple transactions, as if you had made requests in a loop asking for 1000 at a time. For example: if you set maxKeyCount to 10000 and 3123 keys are returned, you will be billed for 4 Class C transactions.

startApplicationKeyId

optional

The first key to return. Used when a query hits the maxKeyCount, and you want to get more. Set to the value returned as the nextApplicationKeyId in the previous query.

Response

Response HTTP Status 200

Key list as a JSON response:

keys

An array of key objects (see below).

nextApplicationKeyId

optional

Set if there are more keys beyond the ones that were returned. Pass this value the startApplicationKeyId in the next query to continue listing keys.
Note that this value may not be a valid application key ID, but can still be used as the starting point for the next query.

Each of the items in the array of keys:

accountId

required

The account that this application key is for.

applicationKeyId

required

The ID of the key.

keyName

required

The name assigned when the key was created.

capabilities

required

A list of strings, each one naming a capability the key has. Possibilities are: listKeys, writeKeys, deleteKeys, listBuckets, writeBuckets, deleteBuckets, listFiles, readFiles, shareFiles, writeFiles, and deleteFiles.

expirationTimestamp

optional

When present, says when this key will expire, in milliseconds since 1970.

bucketId

optional

When present, restricts access to one bucket.

namePrefix

optional

When present, restricts access to files whose names start with the prefix

Response Errors

Unable to return key list. If possible the server will return a JSON error structure. Errors include:

status

code

message

400

bad_request

Account <accountId> does not exist

400

bad_request

No Authorization header

401

unauthorized

Not authorized