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

Generating, showing, adding and removing account keys. NEAR keys can use any of the supported signature schemes: ed25519 (default), secp256k1, or the post-quantum ml-dsa-65.

Generate a key pair

generate-keypair - create a fresh key pair offline, without touching an account or the network. Use --signature-scheme to choose the scheme (defaults to ed25519).
Run in an interactive terminal without --signature-scheme and the CLI prompts you to pick a scheme; otherwise it defaults to ed25519. Unlike ed25519, ml-dsa-65 key pairs are generated randomly and have no seed phrase or implicit-account address — be sure to back up the saved key file.

List keys

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

Add key

add-key - add an access key to an account.
Instead of providing a key, you can have the CLI autogenerate one and add it in a single step with autogenerate-new-keypair --signature-scheme <scheme>:
The same --signature-scheme flag is available on the account create-account fund-myself and sponsor-by-faucet-service autogenerate flows. You can also add an externally generated ml-dsa-65:<base58> key through the use-manually-provided-public-key flow shown above. An ml-dsa-65 key has no implicit-account form — you can’t derive a new implicit account from one — but you can add it to any existing account, named or implicit, just like any other key.

Delete key

delete-keys - delete an access key from an account.
The interactive key picker only lists ed25519 and secp256k1 keys. A post-quantum ml-dsa-65 key is stored on-chain only as a hash, so its full public key can’t be read back from the network — to delete one, pass the full ml-dsa-65:<base58> key explicitly to the public-keys argument of near account delete-keys (the full command form shown above).

Gas keys

Gas keys are access keys with their own prepaid gas balance and up to 1,024 parallel nonces. The add-key command can create them through the grant-gas-key-full-access and grant-gas-key-function-call modes, and dedicated commands manage their balance and nonces. A gas key is always created empty — fund it with fund-gas-key before using it:
To sign a transaction with a gas key, pass --nonce-index to the signing option to choose which nonce lane to use (defaults to lane 0):
Gas keys also work with meta transactions. The CLI signs as a delegate action when the selected network connection has a relayer configured (a meta_transaction_relayer_url, set on the connection with near config add-connection). Signing such a transaction with --nonce-index then produces a DelegateV2 delegate action bound to that nonce lane, which the relayer wraps and pays for.
Deleting a gas key burns any balance left on it, and fails if the balance exceeds 1 NEAR — withdraw first with withdraw-from-gas-key, then delete with the regular delete-keys command. Gas-key meta transactions are supported for all software signers; Ledger is the exception, since the device firmware cannot yet produce a DelegateV2 signature.

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: