---
title: "Get KeyValueStore Keys"
method: POST
path: "/state/key-value-store/keys"
tags: ["State"]
---

# Get KeyValueStore Keys

`POST /state/key-value-store/keys`

Allows to iterate over key value store keys.

## Request body

- StateKeyValueStoreKeysRequest — defines upper boundary (inclusive) for queried data. i.e `{ "at_state_version" = {"epoch" = 10} }`, will return data till 10 epoch.
  - `at_ledger_state` LedgerStateSelector, nullable — Optional. This allows for a request to be made against a historic state. If a constraint is specified, the Gateway will resolve the request against the ledger state at that time. If not specified, requests will be made with respect to the top of the committed ledger.
    - `state_version` integer, nullable — If provided, the latest ledger state lower than or equal to the given state version is returned.
    - `timestamp` string, date-time, nullable — If provided, the latest ledger state lower than or equal to the given round timestamp is returned.
    - `epoch` integer, nullable — If provided, the ledger state lower than or equal to the given epoch at round 0 is returned.
    - `round` integer, nullable — If provided must be accompanied with `epoch`, the ledger state lower than or equal to the given epoch and round is returned.
  - `cursor` string, nullable — This cursor allows forward pagination, by providing the cursor from the previous request.
  - `limit_per_page` integer, nullable — The page size requested.
  - `key_value_store_address` string, required — Bech32m-encoded human readable version of the address.

## Response `200`

KeyValueStore keys collection

- StateKeyValueStoreKeysResponse — Key value store items collection.
  - `ledger_state` LedgerState, required — The ledger state against which the response was generated. Can be used to detect if the Network Gateway is returning up-to-date information.
    - `network` string, required — The logical name of the network
    - `state_version` integer, required — The state version of the ledger. Each transaction increments the state version by 1.
    - `proposer_round_timestamp` string, required — The proposer round timestamp of the consensus round when this transaction was committed to ledger. This is not guaranteed to be strictly increasing, as it is computed as an average across the validator set. If this is significantly behind the current timestamp, the Network Gateway is likely reporting out-dated information, or the network has stalled.
    - `epoch` integer, required — The epoch number of the ledger at this state version.
    - `round` integer, required — The consensus round in the epoch that this state version was committed in.
  - `total_count` integer, nullable — Total number of items in underlying collection, fragment of which is available in `items` collection.
  - `next_cursor` string, nullable — If specified, contains a cursor to query next page of the `items` collection.
  - `items` StateKeyValueStoreKeysResponseItem[], required
    - `key` ScryptoSborValue, required
      - `raw_hex` string, required — Hex-encoded binary blob.
      - `programmatic_json` ProgrammaticScryptoSborValue, required — Arbitrary SBOR value represented as programmatic JSON with optional property name annotations. All scalar types (`Bool`, `I*`, `U*`, `String`, `Reference`, `Own`, `Decimal`, `PreciseDecimal`, `NonFungibleLocalId`) convey their value via `value` string property with notable exception of `Bool` type that uses regular JSON boolean type. Numeric values as string-encoded to preserve accuracy and simplify implementation on platforms with no native support for 64-bit long numerical values. Common properties represented as nullable strings: * `type_name` is only output when a schema is present and the type has a name, * `field_name` is only output when the value is a child of a `Tuple` or `Enum`, which has a type with named fields, * `variant_name` is only output when a schema is present and the type is an `Enum`. The following is a non-normative example annotated `Tuple` value with `String` and `U32` fields: ``` { "kind": "Tuple", "type_name": "CustomStructure", "fields": [ { "kind": "String", "field_name": "favorite_color", "value": "Blue" }, { "kind": "U32", "field_name": "usage_counter", "value": "462231" } ] } ```
        - `kind` 'Bool' | 'I8' | 'I16' | 'I32' | 'I64' | 'I128' | 'U8' | 'U16' | 'U32' | 'U64' | 'U128' | 'String' | 'Enum' | 'Array' | 'Bytes' | 'Map' | 'Tuple' | 'Reference' | 'Own' | 'Decimal' | 'PreciseDecimal' | 'NonFungibleLocalId', required — These are the Scrypto SBOR `ValueKind`s, but with `Bytes` added as an alias for `Vec`, to display such values as hex-encoded strings.
        - `type_name` string, nullable — The name of the type of this value. This is only output when a schema is present and the type has a name. This property is ignored when the value is used as an input to the API.
        - `field_name` string, nullable — The name of the field which hosts this value. This property is only included if this value is a child of a `Tuple` or `Enum` with named fields. This property is ignored when the value is used as an input to the API.
    - `last_updated_at_state_version` integer, required — The most recent state version underlying object was modified at.
  - `key_value_store_address` string, required — Bech32m-encoded human readable version of the address.

## Other responses

- `4XX` — Client-originated request error

---

[API](https://skmtc.net/radixdlt/apis/radix-gateway-api-babylon.md) · [All operations](https://skmtc.net/radixdlt/apis/radix-gateway-api-babylon/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/radixdlt/radix-gateway-api-babylon/versions/153aecf74342/schema)
