Get NFT info

A query that returns information about a non-fungible token (NFT). You request the info for an NFT by specifying the NFT ID.

Requesting NFT info by Token ID or Account ID is currently disabled in the 0.17 release.

The request returns the following information:

Item

Description

NFT ID

The ID of the non-fungible token in x.y.z format.

Account ID

The account ID of the current owner of the NFT

Creation Time

The effective consensus timestamp at which the NFT was minted

Metadata

Represents the unique metadata of the NFT

Constructor

Description

new TokenNftInfoQuery()

Initializes the TokenNFTInfoQuery object

new TokenNftInfoQuery()

Methods

V2
V1
V2

Method

Type

Description

Requirement

setNftId(<nftId>)

NftId

Applicable only to tokens of type NON_FUNGIBLE_UNIQUE. Gets info on a NFT for a given TokenID (of type NON_FUNGIBLE_UNIQUE) and serial number.

Optional

Java
//Returns the info for the specified NFT ID
List<TokenNftInfo> nftInfos = new TokenNftInfoQuery()
.setNftId(nftId)
.execute(client);
//v2.0.14
JavaScript
//Returns the info for the specified NFT ID
const nftInfos = await new TokenNftInfoQuery()
.setNftId(nftId)
.execute(client);
//v2.0.28
Go
//Returns the info for the specified NFT ID
nftInfo, err := NewTokenNftInfoQuery().
SetNftID(nftID).
Execute(client)
//v2.1.16
V1

Method

Type

Description

Requirement

byAccountId(<accountId, start, end>)

AccountId, long, long

Applicable only to tokens of type NON_FUNGIBLE_UNIQUE. Gets info on NFTs N through M owned by the specified accountId. Use setStart() and setEnd().

Optional

byNftId(<nftId>)

NftId

Applicable only to tokens of type NON_FUNGIBLE_UNIQUE. Gets info on a NFT for a given TokenID (of type NON_FUNGIBLE_UNIQUE) and serial number.

Optional

byTokenId(<tokenId, start, end>)

TokenId, long, long

Applicable only to tokens of type NON_FUNGIBLE_UNIQUE. Gets info on NFTs N through M on the list of NFTs associated with a given NON_FUNGIBLE_UNIQUE Start and End designates the index range to return the NFTs for.

Optional

Java
//Returns the info for the specified NFT ID
List<TokenNftInfo> nftInfos = new TokenNftInfoQuery()
.byNftId(nftId)
.execute(client);
//v1.5.0
JavaScript
//Returns the info for the specified NFT ID
const nftInfos = await new TokenNftInfoQuery()
.byNftId(nftId)
.execute(client);
//v1.4.10