NEAR Enhanced API
Please be advised that these tools and services will be discontinued soon.
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Try out our newly released Enhanced APIs - Balances (in Beta) and get what you need for all kinds of balances and token information at ease. Call Enhanced APIs using the endpoint in the API URL box, varies by Network.
Grab your API keys and give it a try! We will be adding more advanced Enhanced APIs in our offering, so stay tuned. Get the data you need without extra processing, NEAR Blockchain data query has never been easier!
We would love to hear from you on the data APIs you need, please leave feedback using the widget in the lower-right corner.
Base URLs:
Authentication
- API Key (apiKey)
- Parameter Name: x-api-key, in: header. Use Pagoda DevConsole API key here
Non Fungible Tokens
Get NFT
Code samples
- Shell
- HTTP
- JS
- Ruby
- Python
- PHP
- Java
- Go
# You can also use wget
curl -X GET https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id} \
-H 'Accept: application/json' \
-H 'x-api-key: API_KEY'
GET https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id} HTTP/1.1
Host: near-testnet.api.pagoda.co
Accept: application/json
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'API_KEY'
}
result = RestClient.get 'https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'API_KEY'
}
r = requests.get('https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'x-api-key' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"x-api-key": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /NFT/{contract_account_id}/{token_id}
Get NFT
This endpoint returns detailed information on the NFT
for the given token_id
, NFT contract_id
, timestamp
/block_height
.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
contract_account_id | path | string | true | none |
token_id | path | string | true | none |
block_height | query | string | false | none |
block_timestamp_nanos | query | string | false | none |
Example responses
200 Response
{
"block_height": "string",
"block_timestamp_nanos": "string",
"contract_metadata": {
"base_uri": "string",
"icon": "string",
"name": "string",
"reference": "string",
"reference_hash": "string",
"spec": "string",
"symbol": "string"
},
"nft": {
"metadata": {
"copies": 0,
"description": "string",
"extra": "string",
"media": "string",
"media_hash": "string",
"reference": "string",
"reference_hash": "string",
"title": "string"
},
"owner_account_id": "string",
"token_id": "string"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | NftResponse |
500 | Internal Server Error | See the inner code value to get more details | None |
Get NFT history
Code samples
- Shell
- HTTP
- JS
- Ruby
- Python
- PHP
- Java
- Go
# You can also use wget
curl -X GET https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}/history \
-H 'Accept: application/json' \
-H 'x-api-key: API_KEY'
GET https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}/history HTTP/1.1
Host: near-testnet.api.pagoda.co
Accept: application/json
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}/history',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'API_KEY'
}
result = RestClient.get 'https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}/history',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'API_KEY'
}
r = requests.get('https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}/history', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'x-api-key' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}/history', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}/history");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"x-api-key": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}/history", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /NFT/{contract_account_id}/{token_id}/history
Get NFT history
This endpoint returns the transaction history for the given NFT and timestamp
/block_height
.
Note: The result is centered around the history of the specific NFT and will return list of its passing owners and metadata.
Limitations
- For now, we only support NFT contracts that implement the Events NEP standard.
- We currently provide the most recent 100 items. Full-featured pagination will be provided in later phases.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
contract_account_id | path | string | true | none |
token_id | path | string | true | none |
limit | query | integer(int32) | false | none |
Example responses
200 Response
{
"block_height": "string",
"block_timestamp_nanos": "string",
"history": [
{
"block_height": "string",
"block_timestamp_nanos": "string",
"cause": "string",
"new_account_id": "string",
"old_account_id": "string",
"status": "string"
}
],
"nft": {
"metadata": {
"copies": 0,
"description": "string",
"extra": "string",
"media": "string",
"media_hash": "string",
"reference": "string",
"reference_hash": "string",
"title": "string"
},
"owner_account_id": "string",
"token_id": "string"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | HistoryResponse |
500 | Internal Server Error | See the inner code value to get more details | None |
Get user's NFT collection overview
Code samples
- Shell
- HTTP
- JS
- Ruby
- Python
- PHP
- Java
- Go
# You can also use wget
curl -X GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT \
-H 'Accept: application/json' \
-H 'x-api-key: API_KEY'
GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT HTTP/1.1
Host: near-testnet.api.pagoda.co
Accept: application/json
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'API_KEY'
}
result = RestClient.get 'https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'API_KEY'
}
r = requests.get('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'x-api-key' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"x-api-key": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /accounts/{account_id}/NFT
Get user's NFT collection overview
For the given account_id
and timestamp
or block_height
, this endpoint returns
the number of NFTs grouped by contract_id
, together with the corresponding NFT contract metadata.
The NFT contract will be present in the response if the account_id
has at least one NFT there.
Note: block_timestamp_nanos
helps you choose a moment in time, fixing the blockchain state at that time.
Limitations
- We currently provide the most recent 100 items. Full-featured pagination will be provided in later phases.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
account_id | path | string | true | none |
block_height | query | string | false | none |
block_timestamp_nanos | query | string | false | none |
limit | query | integer(int32) | false | Maximum available limit 100 |
Example responses
200 Response
{
"block_height": "string",
"block_timestamp_nanos": "string",
"nft_counts": [
{
"contract_account_id": "string",
"contract_metadata": {
"base_uri": "string",
"icon": "string",
"name": "string",
"reference": "string",
"reference_hash": "string",
"spec": "string",
"symbol": "string"
},
"last_updated_at_timestamp_nanos": "string",
"nft_count": 0
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | NftCountsResponse |
500 | Internal Server Error | See the inner code value to get more details | None |
Get user's NFT collection by contract
Code samples
- Shell
- HTTP
- JS
- Ruby
- Python
- PHP
- Java
- Go
# You can also use wget
curl -X GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT/{contract_account_id} \
-H 'Accept: application/json' \
-H 'x-api-key: API_KEY'
GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT/{contract_account_id} HTTP/1.1
Host: near-testnet.api.pagoda.co
Accept: application/json
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT/{contract_account_id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'API_KEY'
}
result = RestClient.get 'https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT/{contract_account_id}',
params: {
}, headers: headers
p JSON.parse(result)