Setup
In order to use the RPC API you will need to setup the correct RPC endpoints.
RPC Endpoint Setup
POSTfor all methodsJSON RPC 2.0id: "dontcare"- endpoint URL varies by network:
- mainnet
https://rpc.mainnet.near.org - testnet
https://rpc.testnet.near.org - betanet
https://rpc.betanet.near.org(may be unstable) - localnet
http://localhost:3030
- mainnet
Limits
- Maximum number of requests per IP: 600 req/min
Querying Historical Data
Querying historical data (older than 5 epochs or ~2.5 days), you may get responses that the data is not available anymore. In that case, archival RPC nodes will come to your rescue:
- mainnet
https://archival-rpc.mainnet.near.org - testnet
https://archival-rpc.testnet.near.org
You can see this interface defined in nearcore here.
Limits
- Maximum number of requests per IP: 600 req/min
Postman Setup
An easy way to test the queries in this documentation page is to use an API request tool such as Postman. You only need to configure two things:
-
Make sure you add a header with a key of
Content-Typeand value ofapplication/json.
-
Then select the
Bodytab and choose therawradio button and ensureJSONis the selected format.
After that is set up, just copy/paste the JSON object example snippets below into the body of your request, on Postman, and click send.
JavaScript Setup
All of the queries listed in this documentation page can be called using near-api-js.
- For
near-api-jsinstallation and setup please refer tonear-api-jsquick reference documentation. - All JavaScript code snippets require a
nearobject. For examples of how to instantiate, click here.