In this guide, you’ll learn how to retrieve comprehensive information about token creators and fee share users using the Bags TypeScript SDK with Node.js. This includes creator details, royalty percentages, and profile information.

Prerequisites

Before starting, make sure you have:

1. The Token Creators Script

Here is a comprehensive script to fetch token creator information. Save this as get-token-creators.ts. This script retrieves detailed information about both the token creator and any fee share users, displaying their usernames, profile pictures, and royalty percentages.
import dotenv from "dotenv";
dotenv.config({ quiet: true });

import { BagsSDK } from "@bagsfm/bags-sdk";
import { PublicKey, Connection } from "@solana/web3.js";

// Initialize SDK
const BAGS_API_KEY = process.env.BAGS_API_KEY;
const SOLANA_RPC_URL = process.env.SOLANA_RPC_URL;

if (!BAGS_API_KEY || !SOLANA_RPC_URL) {
    throw new Error("BAGS_API_KEY and SOLANA_RPC_URL are required");
}

const connection = new Connection(SOLANA_RPC_URL);
const sdk = new BagsSDK(BAGS_API_KEY, connection, "processed");

async function getTokenCreators(tokenMint: string) {
    try {
        console.log(`🔍 Fetching token creators for: ${tokenMint}`);
        
        const creators = await sdk.state.getTokenCreators(new PublicKey(tokenMint));
        
        console.log(`📊 Found ${creators.length} creator(s)`);
        
        const creator = creators.find(creator => creator.isCreator);
        const feeShareUser = creators.find(creator => !creator.isCreator);
        
        if (!creator) {
            throw new Error("❌ No creator found for this token!");
        }
        
        console.log("✨ Token Creator Details:");
        console.log(`👤 Username: ${creator.twitterUsername || creator.username}`);
        console.log(`🎨 Profile Picture: ${creator.pfp}`);
        console.log(`💰 Royalty: ${creator.royaltyBps / 100}%`);
        
        if (feeShareUser) {
            console.log("\n🤝 Fee Share User Details:");
            console.log(`𝕏 TwitterUsername: ${feeShareUser.twitterUsername || "N/A"}`);
            console.log(`👤 Username: ${feeShareUser.username || "N/A"}`);
            console.log(`🎨 Profile Picture: ${feeShareUser.pfp}`);
            console.log(`💰 Royalty: ${feeShareUser.royaltyBps / 100}%`);
        } else {
            console.log("\n📝 No fee share user found for this token");
        }
        
        console.log("✅ Successfully retrieved token creators!");
    }
    catch (error) {
        console.error("🚨 Error fetching token creators:", error);
    }
}

getTokenCreators("CyXBDcVQuHyEDbG661Jf3iHqxyd9wNHhE2SiQdNrBAGS");

2. Run Your Script

To analyze a token’s creators, edit the getTokenCreators function call at the bottom of the script with the actual mint address you want to analyze. Then, run the script from your terminal:
npx ts-node get-token-creators.ts

What You’ll See

The script will output detailed information about the token’s creators and fee share users: Example output:
🔍 Fetching token creators for: CyXBDcVQuHyEDbG661Jf3iHqxyd9wNHhE2SiQdNrBAGS
📊 Found 2 creator(s)
✨ Token Creator Details:
👤 Username: tokenCreator
🎨 Profile Picture: https://example.com/pfp.jpg
💰 Royalty: 5%

🤝 Fee Share User Details:
𝕏 TwitterUsername: feeShareUser
👤 Username: feeShareUser
🎨 Profile Picture: https://example.com/pfp2.jpg
💰 Royalty: 2%
✅ Successfully retrieved token creators!

Understanding the Data

The script distinguishes between two types of users:
  • Token Creator (isCreator: true): The original creator of the token who receives the primary royalty
  • Fee Share User (isCreator: false): A user who shares in the token’s fees, typically through a fee-sharing arrangement
There will always be at most one token creator and one fee share user.

Key Information Retrieved:

  • Username: The user’s Bags internal username
  • Twitter Username: Their Twitter/X handle (if available)
  • Profile Picture: URL to their profile image (if available)
  • Royalty: Their royalty percentage (shown in basis points, converted to percentage)

Use Cases

This information is valuable for:
  • Due Diligence: Research token creators before investing
  • Creator Discovery: Find and follow successful token creators
  • Fee Analysis: Understand how token fees are distributed
  • Partnership Opportunities: Identify potential collaborators
  • Portfolio Research: Learn about the teams behind your investments
For token performance metrics, also check out our Get Token Lifetime Fees guide.