POSTgas_price

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

Returns the gas price (yoctoNEAR per gas unit) for the given block.

Set block_id to a block height or block hash to get that block's gas price, or to null to get the latest block's gas price. Specifying a block the node does not have returns the UNKNOWN_BLOCK error.

Request Body
jsonrpcstringrequired
idstringrequired

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

methodstringrequired
block_idinteger

Height (integer) or hash (base58 string) of the block to query. null means the latest block.

Responses
jsonrpcstring

JSON-RPC version

idstring

Request ID

gas_pricestring

Price per gas unit (yoctoNEAR, decimal string).

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
RequestCU10
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": "gas_price",
    "params": {
      "block_id": 220785385
    }
  }'
Response
Example · 200
{
  "jsonrpc": "2.0",
  "result": {
    "gas_price": "100000000"
  },
  "id": "dontcare"
}