Quick Start

The Underdog API allows you to mint, manage, and update your NFTs all-in-one place. We support compressed NFTs built on Metaplex's Bubblegum Program out-of-the-box.

Configuration

To get started with the Underdog API, you'll need to set up two pieces of configuration.

  • Underdog API Endpoint
  • API Key

Underdog API Endpoint

The Underdog API has two endpoints that connect to either Solana Mainnet or Solana Devnet.

For this example, we'll be using the Solana Devnet API endpoint because the Solana Mainnet API requires activating a paid Underdog plan.

const underdogApiEndpoint = "https://devnet.underdogprotocol.com";

API Key

You can get your API Key from the Underdog Dashboard.

const config = {
    headers: { Authorization: `Bearer ${UNDERDOG_API_KEY}` }
};

Create a Project

Finally, some on-chain interaction. Once you have your configuration set up, you can Create a Project which handles creating the collection NFT, securing it in a secure vault, and making sure all your NFTs are verified as part of the collection.

const projectData = { 
  "name": "Underdog Project", 
  "symbol": "UP", 
  "image": "https://i.imgur.com/jMHjy8x.jpeg" 
};

const createProjectResponse = await axios.post(
  `${underdogApiEndpoint}/v2/projects`, 
  projectData, 
  config,
); 

Create an NFT

Time to Create an NFT. You can grab the Project's ID from the API response, a human-readable identifier for your Project and then pass in the metadata for your NFT.

const nftData = { 
  "name": "Underdog #1", 
  "symbol": "UP", 
  "image": "https://i.imgur.com/Wch6qLE.png", 
};

const createNftResponse = await axios.post(
  `${underdogApiEndpoint}/v2/projects/${createProjectResponse.data.projectId}/nfts`, 
  nftData,
  config,
);

Full Code

Want to just copy-paste the full code and run it yourself?

import axios from "axios";

const underdogApiEndpoint = "https://devnet.underdogprotocol.com";

const config = {
    headers: { Authorization: `Bearer ${UNDERDOG_API_KEY}` }
};

const projectData = { 
  "name": "Underdog Project", 
  "symbol": "UP", 
  "image": "https://i.imgur.com/Wch6qLE.png", 
};

const createProjectResponse = await axios.post(
  `${underdogApiEndpoint}/v2/projects`, 
  projectData, 
  config,
);

const nftData = { 
  "name": "Underdog #1", 
  "symbol": "UP", 
  "image": "https://i.imgur.com/Wch6qLE.png", 
};

const createNftResponse = await axios.post(
  `${underdogApiEndpoint}/v2/projects/${createProjectResponse.data.projectId}/nfts`, 
  nftData,
  config,
); 

Additional Resources