Skip to main content
The NEAR Command Line Interface (CLI) is a tool that enables you to interact with the NEAR network directly from the shell. Among other things, the NEAR CLI enables you to create and manage accounts, send tokens such as NEAR, FTs and NFTs, deploy smart contracts, call functions on those contracts, and manage access keys.

Installation

Configuration file

The directory with access keys and available connection networks are defined in the configuration file (near-cli/config.toml), which is located depending on the operating system in the following places:
  • macOS: $HOME/Library/Application Support (e.g. /Users/Alice/Library/Application Support)
  • Linux: $XDG_CONFIG_HOME or $HOME/.config (e.g. /home/alice/.config)
  • Windows: {FOLDERID_RoamingAppData} (e.g. C:\Users\Alice\AppData\Roaming)
You can learn more about working with the configuration file here.
You can set up a custom RPC server by changing the rpc_url parameter in near-cli settings:

Localnet configuration values

When setting up a localnet connection with near config add-connection, several optional fields can be configured. Most of them can be skipped or set to placeholder URLs — they are only used for specific commands and are not required for basic localnet usage. A minimal localnet connection requires only rpc_url. The other values are only needed when using the specific commands listed above.

Interactive mode

To use the near-cli simply run the following in your terminal.
You should then see the following. Use the arrow keys and hit enter or simply type out one of the available options to select an option. NEAR CLI interactive mode
We provide examples only of the most used commands. Such commands may have two versions — a full one and a short one. If you want to explore all options provided by near-cli, use the interactive mode described above.

Account

This option will allow you to manage, control, and retrieve information on your accounts.

Summary

view-account-summary - view properties for an account.

Import

import-account - import existing account (a.k.a. “sign in”).

Export

export-account - export existing account.

Create

create-account - create a new account.

Delete

delete-account - delete an account.

Keys

Showing, adding and removing account keys.

List keys

list-keys - view a list of keys for an account.

Add key

add-key - add an access key to an account.

Delete key

delete-keys - delete an access key from an account.

Tokens

This will allow you to manage your token assets such as NEAR, FTs and NFTs.

Send NEAR

send-near - transfers NEAR to a specified recipient in units of NEAR or yoctoNEAR.

Send FT

send-ft - transfer Fungible Tokens to a specified user.

Send NFT

send-nft - transfers NFTs between accounts.

View NEAR balance

view-near-balance - view the balance of NEAR tokens.

View FT balance

view-ft-balance - view the balance of Fungible Tokens.

View NFT balance

view-nft-assets - view the balance of NFT tokens.

Contract

This option allows you to manage and interact with your smart contracts.

Call

call-function - execute function (contract method).

Deploy

deploy - add a new contract code.

Inspect

inspect - get a list of available function names.

Transaction

Operate transactions.

View status

view-status - view a transaction status.

Config

Manage the connection parameters inside the config.toml file for near-cli. This will allow you to change or modify the network connections for your CLI.

Show connections

show-connections - show a list of network connections.

Edit connection

edit-connection - edit a network connection.
We provide examples only of the most used commands. If you want to explore all options provided by near-cli, use the interactive mode.

Validators

You can use the following commands to interact with the blockchain and view validator stats. There are three reports used to monitor validator status:
To use these commands, you must install the CLI validator extension.

Validator extension

If you want to interact with NEAR Validators from command line, you can install the NEAR Validator CLI Extension:

Proposals

A proposal by a validator indicates they would like to enter the validator set. In order for a proposal to be accepted it must meet the minimum seat price.

Current validators

This shows a list of active validators in the current epoch, the number of blocks produced, number of blocks expected, and online rate. Used to monitor if a validator is having issues.

Next validators

This shows validators whose proposal was accepted one epoch ago, and that will enter the validator set in the next epoch.

Staking

For validators, there’s also an option to stake NEAR tokens without deploying a staking pool smart contract.

View validator stake

To view the validator’s stake on the last block:

Stake directly without a staking pool

To stake the amount:

Unstake directly without a staking pool

To unstake: