Get Asset

Get an asset by its ID.

Overview

This method will return all relevant information, including metadata for a given Token or Any NFT (cNFT, pNFT, core NFT). To support tokens (Fungible Extensions), set the showFungible flag to true. You can optionally display inscription and SPL-20 token data with the showInscription flag.

Code 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