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:
keyName
required
The name assigned when the key was created.
applicationKeyId
required
The ID of the newly created key.
capabilities
required
A list of strings, each one naming a capability the key has.
Possibilities are:
listKeys
,
writeKeys
,
deleteKeys
,
listAllBucketNames
,
listBuckets
,
readBuckets
,
writeBuckets
,
deleteBuckets
,
readBucketRetentions
,
writeBucketRetentions
,
readBucketEncryption
,
writeBucketEncryption
,
listFiles
,
readFiles
,
shareFiles
,
writeFiles
,
deleteFiles
,
readFileLegalHolds
,
writeFileLegalHolds
,
readFileRetentions
,
writeFileRetentions
, and
bypassGovernance
.
accountId
required
The account that this application key is for.
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.
options
optional
When present and set to s3
, the key can be used to sign requests to
the S3 Compatible API.
Response Errors
Unable to return key list.
If possible the server will return a JSON error structure. Errors include:
status |
code |
description |
---|---|---|
400 |
bad_request |
The request had the wrong fields or illegal values. The message returned with the error will describe the problem. |
401 |
unauthorized |
The auth token used is valid, but does not authorize this call with these parameters. The capabilities of an auth token are determined by the application key used with b2_authorize_account. |
401 |
bad_auth_token |
The auth token used is not valid. Call b2_authorize_account again to either get a new one, or an error message describing the problem. |
401 |
expired_auth_token |
The auth token used has expired. Call b2_authorize_account again to get a new one. |