---
title: "Call View Function"
method: POST
path: "/EXPERIMENTAL_call_function"
---

# Call View Function

`POST /EXPERIMENTAL_call_function`

Calls a view function on a contract and returns the result.

## Request body

- JsonRpcRequestForEXPERIMENTALCallFunction
  - `id` string, required
  - `jsonrpc` string, required
  - `method` 'EXPERIMENTAL_call_function', 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) ```
      - `args_base64` string, bytes, required — This type is used to mark function arguments. NOTE: The main reason for this to exist (except the type-safety) is that the value is transparently serialized and deserialized as a base64-encoded string when serde is used (serde_json).
      - `method_name` string, required
    - 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) ```
      - `args_base64` string, bytes, required — This type is used to mark function arguments. NOTE: The main reason for this to exist (except the type-safety) is that the value is transparently serialized and deserialized as a base64-encoded string when serde is used (serde_json).
      - `method_name` string, required
    - 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) ```
      - `args_base64` string, bytes, required — This type is used to mark function arguments. NOTE: The main reason for this to exist (except the type-safety) is that the value is transparently serialized and deserialized as a base64-encoded string when serde is used (serde_json).
      - `method_name` string, required

## Response `200`

- union
  - object
    - `result` RpcCallFunctionResponse, required — A result returned by contract method
      - `block_hash` string, required
      - `block_height` integer, required
      - `logs` string[], required
      - `result` integer[], required
    - `id` string, required
    - `jsonrpc` string, required
  - object
    - `error` union, required
      - ErrorWrapperForRpcCallFunctionErrorVariant0
        - `cause` union, required
          - RpcRequestValidationErrorKindVariant0
            - `info` object, required
              - …
            - `name` 'METHOD_NOT_FOUND', required
          - RpcRequestValidationErrorKindVariant1
            - `info` object, required
              - …
            - `name` 'PARSE_ERROR', required
        - `name` 'REQUEST_VALIDATION_ERROR', required
      - ErrorWrapperForRpcCallFunctionErrorVariant1
        - `cause` union, required
          - RpcCallFunctionErrorVariant0
            - `info` object, required
              - …
            - `name` 'UNKNOWN_BLOCK', required
          - RpcCallFunctionErrorVariant1
            - `info` object, required
              - …
            - `name` 'INVALID_ACCOUNT', required
          - RpcCallFunctionErrorVariant2
            - `info` object, required
              - …
            - `name` 'UNKNOWN_ACCOUNT', required
          - RpcCallFunctionErrorVariant3
            - `info` object, required
              - …
            - `name` 'NO_CONTRACT_CODE', required
          - RpcCallFunctionErrorVariant4
            - `info` object, required
              - …
            - `name` 'CONTRACT_EXECUTION_ERROR', required
          - RpcCallFunctionErrorVariant5
            - `info` object, required
              - …
            - `name` 'INTERNAL_ERROR', required
        - `name` 'HANDLER_ERROR', required
      - ErrorWrapperForRpcCallFunctionErrorVariant2
        - `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-2.md) · [All operations](https://skmtc.net/near/apis/near-protocol-json-rpc-api-2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/near/near-protocol-json-rpc-api-2/versions/2985730b17e5/schema)
