POSTview_gas_key_nonces

NEAR Mainnethttps://near-mainnet.nodit.io/

Returns the current nonce of each parallel nonce lane of a gas key as an array. A gas key is an access key prefunded with NEAR to pay for gas, and its multiple nonce lanes let you send transactions in parallel.

Call the query method with request_type: "view_gas_key_nonces", passing account_id and the gas key's public_key. If the public key does not exist or is a regular access key rather than a gas key, it returns the UNKNOWN_GAS_KEY error. Use view_access_key to look up the gas key's balance and permission.

Request Body
jsonrpcstringrequired
idstringrequired

Request ID. Any string; it is returned unchanged in the response.

methodstringrequired
request_typestring (enum)required

Query type. Fixed to view_gas_key_nonces for looking up gas key nonces.

finalitystring (enum)

Specifies the block finality. Cannot be used together with block_id.

  • optimistic: the latest block the node has received (may be reorganized)
  • near-final: a Doomslug-final block (not reverted in most cases)
  • final: a fully finalized block
block_idinteger

Specifies the block to query by block height (integer) or block hash (base58 string). Cannot be used together with finality.

account_idstringrequired

NEAR account ID. A human-readable name (e.g. wrap.near) or a 64-character hex implicit account ID.

public_keystringrequired

Base58-encoded public key prefixed with ed25519: or secp256k1:.

Responses
jsonrpcstring

JSON-RPC version

idstring

Request ID

noncesinteger[]

Current nonce of each lane. The array index is the lane number (nonce_index); the first element is lane 0. Each lane starts at the block height at which the key was added × 10^6 and advances independently as transactions use it.

block_heightinteger

Block height.

Example: 220785385

block_hashstring

Base58-encoded 32-byte hash (block hash, chunk hash, transaction hash, etc.).

Example: 8EjuQRnAJiWkRmqxfexQFJWXXonuSMbz5AZziJLCWnWS

namestring (enum)

Error class. REQUEST_VALIDATION_ERROR (invalid request), HANDLER_ERROR (processing error), INTERNAL_ERROR (node internal error)

causeobject

The specific cause of the error.

namestring

Name of the error cause (e.g. UNKNOWN_BLOCK, UNKNOWN_ACCOUNT, PARSE_ERROR)

infoobject

Additional information about the error (block hash, height, account ID, etc.)

codeinteger

Legacy JSON-RPC error code (e.g. -32000 server error, -32700 parse error, -32601 method not found)

messagestring

Legacy error message

datastring

Legacy error details

X-API-KEY
RequestCU60
cURL
curl -X POST "https://near-mainnet.nodit.io/" \
  -H "X-API-KEY: {YOUR_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": "dontcare",
    "method": "query",
    "params": {
      "request_type": "view_gas_key_nonces",
      "finality": "final",
      "block_id": 220785385,
      "account_id": "wrap.near",
      "public_key": "ed25519:168vdqFUxij2yvsxYgAGoykJMX7tgrPKVCH484A8nHP"
    }
  }'
Response
Example · 200
{
  "jsonrpc": "2.0",
  "id": "dontcare",
  "result": {
    "nonces": [
      187438921000012,
      187438921000003,
      187438921000000,
      187438921000000
    ],
    "block_height": 187440904,
    "block_hash": "56xEo2LorUFVNbkFhCncFSWNiobdp1kzm14nZ47b5JVW"
  }
}