---
title: "POST /EXPERIMENTAL_view_state"
method: POST
path: "/EXPERIMENTAL_view_state"
---

# POST /EXPERIMENTAL_view_state

`POST /EXPERIMENTAL_view_state`

Returns the state (key-value pairs) of a contract based on the key prefix.

## Request body

- JsonRpcRequestForEXPERIMENTALViewState
  - `id` string — JSON-RPC request id. Auto-populated; can be any string.
  - `jsonrpc` '2.0' — JSON-RPC protocol version. Always `2.0`.
  - `method` 'EXPERIMENTAL_view_state', required
  - `params` union, required
    - object
      - `block_id` union, required
        - integer
        - string
      - `account_id` string, required — NEAR Account Identifier. This is a unique, syntactically valid, human-readable account identifier on the NEAR network. [See the crate-level docs for information about validation.](index.html#account-id-rules) Also see [Error kind precedence](AccountId#error-kind-precedence). ## Examples ``` use near_account_id::AccountId; let alice: AccountId = "alice.near".parse().unwrap(); assert!("ƒelicia.near".parse::<AccountId>().is_err()); // (ƒ is not f) ```
      - `after_key_base64` union
        - string, bytes — This type is used to mark keys (arrays of bytes) that are queried from store. NOTE: Currently, this type is only used in the view_client and RPC to be able to transparently pretty-serialize the bytes arrays as base64-encoded strings (see `serialize.rs`).
        - unknown
      - `include_proof` boolean
      - `limit` integer, nullable
      - `prefix_base64` string, bytes, required — This type is used to mark keys (arrays of bytes) that are queried from store. NOTE: Currently, this type is only used in the view_client and RPC to be able to transparently pretty-serialize the bytes arrays as base64-encoded strings (see `serialize.rs`).
    - object
      - `finality` 'optimistic' | 'near-final' | 'final', required — Different types of finality.
      - `account_id` string, required — NEAR Account Identifier. This is a unique, syntactically valid, human-readable account identifier on the NEAR network. [See the crate-level docs for information about validation.](index.html#account-id-rules) Also see [Error kind precedence](AccountId#error-kind-precedence). ## Examples ``` use near_account_id::AccountId; let alice: AccountId = "alice.near".parse().unwrap(); assert!("ƒelicia.near".parse::<AccountId>().is_err()); // (ƒ is not f) ```
      - `after_key_base64` union
        - string, bytes — This type is used to mark keys (arrays of bytes) that are queried from store. NOTE: Currently, this type is only used in the view_client and RPC to be able to transparently pretty-serialize the bytes arrays as base64-encoded strings (see `serialize.rs`).
        - unknown
      - `include_proof` boolean
      - `limit` integer, nullable
      - `prefix_base64` string, bytes, required — This type is used to mark keys (arrays of bytes) that are queried from store. NOTE: Currently, this type is only used in the view_client and RPC to be able to transparently pretty-serialize the bytes arrays as base64-encoded strings (see `serialize.rs`).
    - object
      - `sync_checkpoint` 'genesis' | 'earliest_available', required
      - `account_id` string, required — NEAR Account Identifier. This is a unique, syntactically valid, human-readable account identifier on the NEAR network. [See the crate-level docs for information about validation.](index.html#account-id-rules) Also see [Error kind precedence](AccountId#error-kind-precedence). ## Examples ``` use near_account_id::AccountId; let alice: AccountId = "alice.near".parse().unwrap(); assert!("ƒelicia.near".parse::<AccountId>().is_err()); // (ƒ is not f) ```
      - `after_key_base64` union
        - string, bytes — This type is used to mark keys (arrays of bytes) that are queried from store. NOTE: Currently, this type is only used in the view_client and RPC to be able to transparently pretty-serialize the bytes arrays as base64-encoded strings (see `serialize.rs`).
        - unknown
      - `include_proof` boolean
      - `limit` integer, nullable
      - `prefix_base64` string, bytes, required — This type is used to mark keys (arrays of bytes) that are queried from store. NOTE: Currently, this type is only used in the view_client and RPC to be able to transparently pretty-serialize the bytes arrays as base64-encoded strings (see `serialize.rs`).

## Response `200`

- union
  - object
    - `result` RpcViewStateResponse, required — Resulting state values for a view state query request
      - `block_hash` string, required
      - `block_height` integer, required
      - `last_key` union
        - string, bytes — This type is used to mark keys (arrays of bytes) that are queried from store. NOTE: Currently, this type is only used in the view_client and RPC to be able to transparently pretty-serialize the bytes arrays as base64-encoded strings (see `serialize.rs`).
        - unknown
      - `proof` string[]
      - `values` StateItem[], required
        - `key` string, bytes, required — This type is used to mark keys (arrays of bytes) that are queried from store. NOTE: Currently, this type is only used in the view_client and RPC to be able to transparently pretty-serialize the bytes arrays as base64-encoded strings (see `serialize.rs`).
        - `value` string, bytes, required — This type is used to mark values returned from store (arrays of bytes). NOTE: Currently, this type is only used in the view_client and RPC to be able to transparently pretty-serialize the bytes arrays as base64-encoded strings (see `serialize.rs`).
    - `id` string, required
    - `jsonrpc` string, required
  - object
    - `error` union, required
      - object
        - `cause` union, required
          - object
            - `info` object, required
              - …
            - `name` 'METHOD_NOT_FOUND', required
          - object
            - `info` object, required
              - …
            - `name` 'PARSE_ERROR', required
        - `name` 'REQUEST_VALIDATION_ERROR', required
      - object
        - `cause` union, required
          - object
            - `info` object, required
              - …
            - `name` 'UNKNOWN_BLOCK', required
          - object
            - `info` object, required
              - …
            - `name` 'INVALID_ACCOUNT', required
          - object
            - `info` object, required
              - …
            - `name` 'UNKNOWN_ACCOUNT', required
          - object
            - `info` object, required
              - …
            - `name` 'TOO_LARGE_CONTRACT_STATE', required
          - object
            - `info` object, required
              - …
            - `name` 'INTERNAL_ERROR', required
        - `name` 'HANDLER_ERROR', required
      - object
        - `cause` InternalError, required
          - `info` object, required
            - `error_message` string, required
          - `name` 'INTERNAL_ERROR', required
        - `name` 'INTERNAL_ERROR', required
    - `id` string, required
    - `jsonrpc` string, required

---

[API](https://skmtc.net/near/apis/near-protocol-json-rpc-api.md) · [All operations](https://skmtc.net/near/apis/near-protocol-json-rpc-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/near/near-protocol-json-rpc-api/versions/cb6bdde6167d/schema)
