curl --request GET \
--url https://mainnet.mirrornode.hedera.com/api/v1/accounts/{idOrAliasOrEvmAddress}/nftsimport requests
url = "https://mainnet.mirrornode.hedera.com/api/v1/accounts/{idOrAliasOrEvmAddress}/nfts"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://mainnet.mirrornode.hedera.com/api/v1/accounts/{idOrAliasOrEvmAddress}/nfts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mainnet.mirrornode.hedera.com/api/v1/accounts/{idOrAliasOrEvmAddress}/nfts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://mainnet.mirrornode.hedera.com/api/v1/accounts/{idOrAliasOrEvmAddress}/nfts"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://mainnet.mirrornode.hedera.com/api/v1/accounts/{idOrAliasOrEvmAddress}/nfts")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.mirrornode.hedera.com/api/v1/accounts/{idOrAliasOrEvmAddress}/nfts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"nfts": [
{
"account_id": "0.1.2",
"created_timestamp": "1234567890.000000001",
"delegating_spender": "0.0.400",
"deleted": false,
"metadata": "VGhpcyBpcyBhIHRlc3QgTkZU",
"modified_timestamp": "1610682445.003266001",
"serial_number": 124,
"spender_id": "0.0.500",
"token_id": "0.0.222"
}
],
"links": {
"next": null
}
}{
"_status": {
"messages": [
{
"message": "Invalid parameter: account.id"
},
{
"message": "Invalid Transaction id. Please use \\shard.realm.num-sss-nnn\\ format where sss are seconds and nnn are nanoseconds"
}
]
}
}{
"_status": {
"messages": [
{
"message": "Not found"
}
]
}
}Get nfts for an account info
Returns information for all non-fungible tokens for an account.
Ordering
When considering NFTs, their order is governed by a combination of their numerical token.Id and serialnumber values, with token.id being the parent column. A serialnumbers value governs its order within the given token.id
In that regard, if a user acquired a set of NFTs in the order (2-2, 2-4 1-5, 1-1, 1-3, 3-3, 3-4), the following layouts illustrate the ordering expectations for ownership listing
- All NFTs in ASC order: 1-1, 1-3, 1-5, 2-2, 2-4, 3-3, 3-4
- All NFTs in DESC order: 3-4, 3-3, 2-4, 2-2, 1-5, 1-3, 1-1
- NFTs above 1-1 in ASC order: 1-3, 1-5, 2-2, 2-4, 3-3, 3-4
- NFTs below 3-3 in ASC order: 1-1, 1-3, 1-5, 2-2, 2-4
- NFTs between 1-3 and 3-3 inclusive in DESC order: 3-4, 3-3, 2-4, 2-2, 1-5, 1-3
Note: The default order for this API is currently DESC
Filtering
When filtering there are some restrictions enforced to ensure correctness and scalability.
The table below defines the restrictions and support for the NFT ownership endpoint
| Query Param | Comparison Operator | Support | Description | Example |
|---|---|---|---|---|
| token.id | eq | Y | Single occurrence only. | ?token.id=X |
| ne | N | |||
| lt(e) | Y | Single occurrence only. | ?token.id=lte:X | |
| gt(e) | Y | Single occurrence only. | ?token.id=gte:X | |
| serialnumber | eq | Y | Single occurrence only. Requires the presence of a token.id query | ?serialnumber=Y |
| ne | N | |||
| lt(e) | Y | Single occurrence only. Requires the presence of an lte or eq token.id query | ?token.id=lte:X&serialnumber=lt:Y | |
| gt(e) | Y | Single occurrence only. Requires the presence of an gte or eq token.id query | ?token.id=gte:X&serialnumber=gt:Y | |
| spender.id | eq | Y | ?spender.id=Z | |
| ne | N | |||
| lt(e) | Y | ?spender.id=lt:Z | ||
| gt(e) | Y | ?spender.id=gt:Z |
Note: When searching across a range for individual NFTs a serialnumber with an additional token.id query filter must be provided. Both filters must be a single occurrence of gt(e) or lt(e) which provide a lower and or upper boundary for search.
curl --request GET \
--url https://mainnet.mirrornode.hedera.com/api/v1/accounts/{idOrAliasOrEvmAddress}/nftsimport requests
url = "https://mainnet.mirrornode.hedera.com/api/v1/accounts/{idOrAliasOrEvmAddress}/nfts"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://mainnet.mirrornode.hedera.com/api/v1/accounts/{idOrAliasOrEvmAddress}/nfts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mainnet.mirrornode.hedera.com/api/v1/accounts/{idOrAliasOrEvmAddress}/nfts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://mainnet.mirrornode.hedera.com/api/v1/accounts/{idOrAliasOrEvmAddress}/nfts"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://mainnet.mirrornode.hedera.com/api/v1/accounts/{idOrAliasOrEvmAddress}/nfts")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.mirrornode.hedera.com/api/v1/accounts/{idOrAliasOrEvmAddress}/nfts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"nfts": [
{
"account_id": "0.1.2",
"created_timestamp": "1234567890.000000001",
"delegating_spender": "0.0.400",
"deleted": false,
"metadata": "VGhpcyBpcyBhIHRlc3QgTkZU",
"modified_timestamp": "1610682445.003266001",
"serial_number": 124,
"spender_id": "0.0.500",
"token_id": "0.0.222"
}
],
"links": {
"next": null
}
}{
"_status": {
"messages": [
{
"message": "Invalid parameter: account.id"
},
{
"message": "Invalid Transaction id. Please use \\shard.realm.num-sss-nnn\\ format where sss are seconds and nnn are nanoseconds"
}
]
}
}{
"_status": {
"messages": [
{
"message": "Not found"
}
]
}
}Path Parameters
Query Parameters
Was this page helpful?