---
title: NEAR Enhanced API
language_tabs:
- shell: Shell
- http: HTTP
- javascript: JavaScript
- ruby: Ruby
- python: Python
- php: PHP
- java: Java
- go: Go
toc_footers: []
includes: []
search: true
highlight_theme: darkula
headingLevel: 2
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
:::warning
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.
- https://near-testnet.api.pagoda.co/eapi/v1
- https://near-mainnet.api.pagoda.co/eapi/v1
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:
* https://near-testnet.api.pagoda.co/eapi/v1
## 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
# 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'
```
```http
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
```
```javascript
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);
});
```
```ruby
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)
```
```python
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
'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());
}
// ...
```
```java
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());
```
```go
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`.
|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[NftResponse](#schemanftresponse)|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|See the inner `code` value to get more details|None|
### Get NFT history
> Code samples
```shell
# 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'
```
```http
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
```
```javascript
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);
});
```
```ruby
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)
```
```python
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
'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());
}
// ...
```
```java
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());
```
```go
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.
|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[HistoryResponse](#schemahistoryresponse)|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|See the inner `code` value to get more details|None|
### Get user's NFT collection overview
> Code samples
```shell
# 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'
```
```http
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
```
```javascript
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);
});
```
```ruby
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)
```
```python
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
'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());
}
// ...
```
```java
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());
```
```go
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.
|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[HistoryResponse](#schemahistoryresponse)|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|See the inner `code` value to get more details|None|
---
## Fungible Tokens
### Get user's coin balances
> Code samples
```shell
# You can also use wget
curl -X GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins \
-H 'Accept: application/json' \
-H 'x-api-key: API_KEY'
```
```http
GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins HTTP/1.1
Host: near-testnet.api.pagoda.co
Accept: application/json
```
```javascript
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
```
```ruby
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}/coins',
params: {
}, headers: headers
p JSON.parse(result)
```
```python
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}/coins', headers = headers)
print(r.json())
```
```php
'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}/coins', 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());
}
// ...
```
```java
URL obj = new URL("https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins");
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());
```
```go
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}/coins", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
```
`GET /accounts/{account_id}/coins`
*Get user's coin balances*
This endpoint returns all the countable coin balances (including NEAR, fungible tokens, and _multi-tokens_)
of the given `account_id`, at the given `timestamp`/`block_height`.
**Limitations**
* For now, we only support the balance for NEAR and FT contracts that implement the Events NEP standard.
We are working on a solution to support other FT contracts, including `wrap.near` and bridged tokens.
* We are in the process of supporting Multi Token balances.
* We currently provide the most recent 100 items.
Full-featured pagination will be provided in an upcoming update.
|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[CoinBalancesResponse](#schemacoinbalancesresponse)|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|See the inner `code` value to get more details|None|
### Get user's coin balances by contract
> Code samples
```shell
# You can also use wget
curl -X GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id} \
-H 'Accept: application/json' \
-H 'x-api-key: API_KEY'
```
```http
GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id} HTTP/1.1
Host: near-testnet.api.pagoda.co
Accept: application/json
```
```javascript
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
```
```ruby
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}/coins/{contract_account_id}',
params: {
}, headers: headers
p JSON.parse(result)
```
```python
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}/coins/{contract_account_id}', headers = headers)
print(r.json())
```
```php
'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}/coins/{contract_account_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());
}
// ...
```
```java
URL obj = new URL("https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_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());
```
```go
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}/coins/{contract_account_id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
```
`GET /accounts/{account_id}/coins/{contract_account_id}`
*Get user's coin balances by contract*
This endpoint returns all the countable coin balances of the given `account_id`,
for the given contract and `timestamp`/`block_height`.
For FT contracts, the response has only 1 item in the list.
For MT contracts, there could be several balances (MT support is still under development).
**Limitations**
* For now, we support only the balance for FT contracts that implement the Events NEP standard.
We are working on a solution to support other FT contracts, including `wrap.near` and bridged tokens.
* We are in the process of supporting Multi Token balances.
|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[CoinBalancesResponse](#schemacoinbalancesresponse)|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|See the inner `code` value to get more details|None|
### Get user's coin history by contract
> Code samples
```shell
# You can also use wget
curl -X GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id}/history \
-H 'Accept: application/json' \
-H 'x-api-key: API_KEY'
```
```http
GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id}/history HTTP/1.1
Host: near-testnet.api.pagoda.co
Accept: application/json
```
```javascript
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id}/history',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
```
```ruby
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}/coins/{contract_account_id}/history',
params: {
}, headers: headers
p JSON.parse(result)
```
```python
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}/coins/{contract_account_id}/history', headers = headers)
print(r.json())
```
```php
'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}/coins/{contract_account_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());
}
// ...
```
```java
URL obj = new URL("https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_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());
```
```go
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}/coins/{contract_account_id}/history", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
```
`GET /accounts/{account_id}/coins/{contract_account_id}/history`
*Get user's coin history by contract*
This endpoint returns the history of coin operations (FT, other standards)
for the given `account_id`, `contract_id`, `timestamp`/`block_height`.
**Limitations**
* For now, we support only FT contracts that implement the Events NEP standard.
We are working on a solution to support other FT contracts, including `wrap.near` and bridged tokens.
* We are in the process of supporting Multi Token history.
* We currently provide the most recent 100 items.
Full-featured pagination will be provided in an upcoming update.