← All posts

How to get the metadata of a Solana Metaplex candy machine

• Written by Josh Wolff

Let’s explore how to use the API to get a Solana Metaplex candy machine’s price, supply, items available, and go live date.

How to get a Solana Metaplex candy machine’s price, supply, items available, and go live date

To get info about a Metaplex candy machine, we will use the Blockchain API. Specifically we will use the “Get a Metaplex candy machine’s details” endpoint, documented here.

First, create and save an API key pair here.

Now retrieve the candy machine ID of the candy machine. For some help on how to do this, see this article.

Install the Python wrapper.

pip install theblockchainapi

Finally, let’s consider this example. In this example, we call the get_candy_machine_info function.

from theblockchainapi import TheBlockchainAPIResource, SolanaNetwork 
# Get an API key pair for free here: 
# https://dashboard.theblockchainapi.com/api-keys
BLOCKCHAIN_API_RESOURCE = TheBlockchainAPIResource(    
def example():    
        assert MY_API_KEY_ID is not None        
        assert MY_API_SECRET_KEY is not None    
    except AssertionError:        
        raise Exception("Fill in your key ID pair!")     
    the_goat_society_candy_machine_id = \    
    candy_machine_data = \
    print(f"Candy Machine Data: {config_address}")

if __name__ == '__main__':    

The output will look something like this:

    'go_live_date': 1635343002.0,  # The mint start time (Unix time)
    'items_available': 8888.0,  # The number of items available in the collection (not the number of items available to mint)
    'price': 100000000.0,  # The price in Lamports (1 billion Lamports per SOL)
    'uuid': 'FVbP4u'
Written by Josh Wolff

Hi! I'm Josh. I'm building a platform to make interacting with blockchains easy. The blog highlights how to use the API, feature developments, newletters, and other important information.