POSTaccount_changes

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

Returns, per block, the account info changes of the given accounts. Each item holds the account state after the change (balance, locked amount, storage usage, code hash) and the cause of the change.

Call the changes method with changes_type: "account_changes". If an account changes several times in one block, there is one item per change. If nothing changed, changes is an empty array. If the block cannot be found, the UNKNOWN_BLOCK error is returned. EXPERIMENTAL_changes is the former name of this method.

Request Body
jsonrpcstringrequired
idstringrequired

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

methodstringrequired
changes_typestring (enum)required

Change query type. Fixed to account_changes.

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_idsstring[]required

Account IDs to get changes for

Responses
jsonrpcstring

JSON-RPC version

idstring

Request ID

block_hashstring

Hash of the queried block (base58)

changesobject[]

List of account changes

causeobject

Cause of the change

typestring (enum)

Cause type

  • transaction_processing: transaction processing (includes tx_hash)
  • receipt_processing: receipt processing (includes receipt_hash)
  • action_receipt_processing_started: action receipt processing started (includes receipt_hash)
  • action_receipt_gas_reward: gas reward paid for receipt execution (includes receipt_hash)
  • postponed_receipt: receipt postponed while waiting for data (includes receipt_hash)
  • updated_delayed_receipts: delayed receipt queue updated
  • validator_accounts_update: validator accounts updated at an epoch change
  • migration: protocol migration
  • initial_state: genesis initial state
  • not_writable_to_disk: change that is not written to disk
  • bandwidth_scheduler_state_update: bandwidth scheduler state updated
tx_hashstring

Hash of the causing transaction. Present only when type is transaction_processing. (base58)

receipt_hashstring

Hash of the causing receipt. Present only for receipt-related causes. (base58)

typestring (enum)

Change type

  • account_update: account info changed
  • account_deletion: account deleted
changeobject

Account state after the change. For account_deletion, only account_id is present.

account_idstring

Account ID

amountstring

Available balance (yoctoNEAR, decimal string)

lockedstring

Amount locked for staking (yoctoNEAR, decimal string)

code_hashstring

Hash of the deployed contract code (base58). 11111111111111111111111111111111 when no contract is deployed.

storage_usageinteger

Storage used by the account (bytes)

storage_paid_atinteger

Deprecated field; always 0.

global_contract_hashstring

Code hash of the global contract referenced by hash, if used. Present only when applicable.

global_contract_account_idstring

Account ID of the global contract referenced by account ID, if used. Present only when applicable.

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
RequestCU30
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": "changes",
    "params": {
      "changes_type": "account_changes",
      "finality": "final",
      "block_id": 220785385,
      "account_ids": [
        "wrap.near"
      ]
    }
  }'
Response
Example · 200
{
  "jsonrpc": "2.0",
  "id": "dontcare",
  "result": {
    "block_hash": "8EjuQRnAJiWkRmqxfexQFJWXXonuSMbz5AZziJLCWnWS",
    "changes": [
      {
        "cause": {
          "receipt_hash": "Htzihke1wZHo1sK92JGfsWuufG9RKG11MgHMeRCdSsJu",
          "type": "receipt_processing"
        },
        "change": {
          "account_id": "wrap.near",
          "amount": "35723915907827417930574725046263",
          "code_hash": "DL2f5xmZ44cQRP6vBMt94rvseH5d5KKnAGis2WkTAsh1",
          "locked": "0",
          "storage_paid_at": 0,
          "storage_usage": 166761807
        },
        "type": "account_update"
      },
      {
        "cause": {
          "receipt_hash": "Htzihke1wZHo1sK92JGfsWuufG9RKG11MgHMeRCdSsJu",
          "type": "action_receipt_gas_reward"
        },
        "change": {
          "account_id": "wrap.near",
          "amount": "35723915907881588108301325046263",
          "code_hash": "DL2f5xmZ44cQRP6vBMt94rvseH5d5KKnAGis2WkTAsh1",
          "locked": "0",
          "storage_paid_at": 0,
          "storage_usage": 166761807
        },
        "type": "account_update"
      }
    ]
  }
}