Get Asset

Get an asset by its ID.

This method is the fastest way to lookup NFTs (including metadata) on Solana.

Overview

This method will return all relevant information for a given standard or compressed NFT.

Fungible Token Extension

At Helius, we've extended this method to support all tokens (SPL and Token22). We include all token information (supply, balance, and price), and parse Token22 extensions. To enable this feature, set the showFungible flag to true.

To learn more, please visit Fungible Token Extension (Beta).

Inscriptions & SPL-20

You can optionally display inscription and SPL-20 token data with the showInscription flag. You can learn more about inscriptions and SPL-20 here.

Please note that this is an experimental feature.

The Helius API does not verify SPL-20 tokens. Trade at your own risk. For more information, please use the validator tool or join the Libreplex Discord channel.

Example

Get info on Mad Lad #8613

const url = `https://mainnet.helius-rpc.com/?api-key=<api_key>`

const getAsset = async () => {
  const response = await fetch(url, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      jsonrpc: '2.0',
      id: 'my-id',
      method: 'getAsset',
      params: {
        id: 'F9Lw3ki3hJ7PF9HQXsBzoY8GyE6sPoEZZdXJBsTTD2rk'
      },
    }),
  });
  const { result } = await response.json();
  console.log("Asset: ", result);
};
getAsset();

Fungible token example

const url = `https://mainnet.helius-rpc.com/?api-key=<api_key>`

const getAsset = async () => {
  const response = await fetch(url, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      jsonrpc: '2.0',
      id: 'my-id',
      method: 'getAsset',
      params: {
        id: 'J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn',
        displayOptions: {
	    showFungible: true //return details about a fungible token
	}
      },
    }),
  });
  const { result } = await response.json();
  console.log("Asset: ", result);
};
getAsset();

Inscription & SPL-20 example

const url = `https://mainnet.helius-rpc.com/?api-key=<api_key>`

const getAsset = async () => {
    const response = await fetch(url, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
        },
        body: JSON.stringify({
            jsonrpc: '2.0',
            id: 'my-id',
            method: 'getAsset',
            params: {
                id: 'AKo9P7S8FE9NYeAcrtZEpimwQAXJMp8Lrt8p4dMkHkY2',
                displayOptions: {
                    showInscription: true, // shows inscription and spl-20 data
                },
            },
        }),
    });
    const { result } = await response.json();
    console.log([result.inscription, result.spl20]);
};
getAsset();

// Example output:
// [
//     {
//         order: 308332,
//         size: 52,
//         contentType: 'application/text',
//         encoding: 'base64',
//         validationHash: '907e00a18f952ade319c21b90764e5d0a08ec31c92e792f806a995e8524535ca',
//         inscriptionDataAccount: '9qM9ThkVPxjq4TyBjCs1qpY15VYVim2Qh7uR5yG1Da3T',
//     },
//     { p: 'spl-20', op: 'mint', tick: 'helius', amt: '1' },
// ];

Last updated