Skip to content

Get Key Names


This operation retrieves key names from a specific store type. Key names are retrieved with paging, the default page size is 10,000 items. The operation supports filtering, where the returned key names match the specified pattern.


[[[Backendless.shared hive:(NSString *)hiveName] storeType] keysWithResponseHandler:^(StoreKeysResult *)responseHandler errorHandler:^(Fault *)errorHandler];

// with options parameter
[[[Backendless.shared hive:(NSString *)hiveName] storeType] keysWithStoreKeyOptions:(StoreKeysOptions *)options responseHandler:^(StoreKeysResult *)responseHandler errorHandler:^(Fault *)errorHandler];
Backendless.shared.hive(hiveName: String).storeType.keys(responseHandler: ((StoreKeysResult) -> Void)!, errorHandler: ((Fault) -> Void)!)

// with options parameter
Backendless.shared.hive(hiveName: String).storeType.keys(storeKeyOptions: StoreKeysOptions, responseHandler: ((StoreKeysResult) -> Void)!, errorHandler: ((Fault) -> Void)!)


Argument                Description
hiveName Name of a hive where the operation is performed. String value.
storeType This placeholder must be substituted with one of the following stores types: keyValueStore, listStore, mapStore, setStore, sortedSetStore.
StoreKeysOptions Object containing parameters to specify the page size and the filter pattern.
StoreKeysResult Object returned after the invocation containing an array of string values(key names). It also returns a cursor value which should be used in the subsequent request to get additional key names.

The StoreKeysOptions must be an object with the structure shown below:

@interface StoreKeysOptions : NSObject

@property (nonatomic, copy) NSString *filterPattern;
@property (nonatomic, strong) NSNumber *cursor;
@property (nonatomic, strong) NSNumber *pageSize;

@objcMembers public class StoreKeysOptions: NSObject {
    var filterPattern: String?
    var cursor: NSNumber?
    var pageSize: NSNumber?


Argument                Description
filterPattern Optional parameter. A pattern the returned key names must match. Supports the glob format for pattern expressions. If the parameter is not set, defaults to * (all keys).  You can specify a pattern with a prefix and/or suffix, for example: filterPattern=leaderboard1*_new_york.
It is not recommended to change the filterPattern value during the paging process, since you can retrieve inconsistent data and the cursor value may become invalid. Must be a string value.
cursor Optional parameter. This is a special value used to retrieved additional key names in a paged data set. The value of the cursor is returned in the prior invocation of the operation. The cursor value should be used in conjunction with the pageSize parameter described below. To iterate through all keys in the store, start by setting the cursor to 0; By doing so, you instruct the operation to start the key names retrieval from the very beginning of the collection. Must be a string value.
pageSize Optional parameter. Identifies the number of key names to return in the response. The operation may return key names up to the number specified in the pageSize parameter.Defaults to 5000.

Return Value

An object with the following structure:

  "keys": [  
  "cursor": "182"  

The cursor value of "0" in the response indicates that you have reached the end of the store and there are no keys left to return. In some cases you can get more keys than specified in the pageSize parameter.


The example below may return up to six key names from the key-value store, since the pageSize parameter is set to 6.

StoreKeysOptions *options = [StoreKeysOptions new];
options.filterPattern = @"*";
options.cursor = 0;
options.pageSize = @6;

[[[Backendless.shared hive:@"groceryStore"] keyValueStore] keysWithStoreKeyOptions:options responseHandler:^(StoreKeysResult *response) {
    // handle response
} errorHandler:^(Fault *fault) {
    // handle error
let options = StoreKeysOptions()
options.filterPattern = "*"
options.cursor = 0
options.pageSize = 6

Backendless.shared.hive("groceryStore").keyValueStore.keys(storeKeyOptions: options, responseHandler: { response in
    // response
}, errorHandler: { fault in
    // handle error


Argument                Description
"groceryStore" Name of a hive where the operation is performed.


    "keys": [  
    "cursor": "185"  

Codeless Reference



Argument                Description
hive name Name of a hive where the operation is performed.
type Storage type, can be one of the following: Key / Value, Sorted Set, Set, Map, List.
filter pattern A pattern to filter the keys with. Only the keys matching the pattern will be returned by the operation
page size Identifies the number of keys to return in the response. Operation may return up to the specified number of key names. Refer to the section above for more information.
cursor A value received in the response of a prior call of the same block. Refer to the section above for more information.

Returns an object containing key names and the cursor position.

Consider the following Key Value storage:


The example below retrieves the key names from the key-value storage:

The output will look as shown below after the Codeless logic runs.