Candy Machine
Candy machine APIs to create, mint and list nfts from the same. Currently we support reading from all the versions of candy machine. For creating and minting we support Candy Machine V3 account V1
Get All NFT addresses
Get All NFT addresses minted using a particular candy machine by providing a Candy machine address.
Query Params
network: Solana blockchain environment (testnet/devnet/mainnet-beta)
address: Candy machine address
version (optional): Candy machine version (v2/v3). By default, it takes v3 if no query is passed.
GET /sol/v1/candy_machine/nft_addresses
var myHeaders = new Headers();
myHeaders.append("x-api-key", "<YOUR_API_KEY>");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch(
"https://api.shyft.to/sol/v1/candy_machine/nft_addresses?network=devnet&address=CZ7zmhqpUSFAtaW7BsyXmgsRaLjKBb6gWHiEnNFE9DNj&version=v3",
requestOptions
)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Get All NFTs
Get All NFTs minted using a particular candy machine by providing a Candy machine address. Returns on-chain and off-chain NFT data. This is a paginated API.
Query Params
network: Solana blockchain environment (testnet/devnet/mainnet-beta)
address: Candy machine address
version (optional): Candy machine version (v2/v3). By default, it takes v3 if no query is passed.
page (optional): From which page want to traverse, by default page is 1
size (optional): How many NFTs want to get on one page, by default size is 10
GET /sol/v1/candy_machine/nfts
var myHeaders = new Headers();
myHeaders.append("x-api-key", "<YOUR_API_KEY>");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch(
"https://api.shyft.to/sol/v1/candy_machine/nfts?network=devnet&address=H2oYLkXdkX38eQ6VTqs26KAWAvEpYEiCtLt4knEUJxpu&version=v2&page=1&size=3",
requestOptions
)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Create Candy Machine V3
POST /sol/v1/candy_machine/create
Body
network: Solana blockchain environment (testnet/devnet/mainnet-beta)
wallet: The public key of the creator of candy machine
symbol: The symbol for NFT's which are to be minted from candy machine
max_supply: Maximum number for edition NFTs that can be minted from each NFT individually minted NFT
royalty: The secondary sale royalties to be set on minted NFT's eg. 300 will give 3% royalty to the creator
collection: The address of the collection NFT. All the minted NFT's will have collection NFT set pointing to this address
items_available: Total number of tokens that can be minted from the candy machine
amount: The amount which has to be transferred to owner on each mint in SOL
creators (optional): Array of creators, default is creator address with 100% share
[
{ "address": "7iviPE2HZ15QCvHHCm8QzYdXKt9qReeT5P4aqSRAp7oY", "share": 100}
]
item_settings (optional): Config for each token which is minted from the candy machine. Either of item_settings or bulk_item_settings has to be set not both.
{
prefix_name: 'My token BYAC' // String, name set for all the tokens
name_length: 32 // Number, max length for each token name excluding prefix_name length
prefix_uri: 'https://some.uri/abc/path' // String, metadata path prefix for each token minted from candy machine
uri_length: 12 // Number, max length for each token metadata uri excluding prefix_uri length
is_sequential: false // Boolean, should candy machine mint tokens by the order in which they are inserted
}
Default values for item settings:
{
prefix_name: ''
name_length: 32
prefix_uri: ''
uri_length: 200
is_sequential: false
}
bulk_item_settings: (Optional) Item settings for bulk nft creation. Name and uri of metadata file. Either of item_settings or bulk_item_settings has to be set not both.
guards: (optional) An object containing guard configuration for different candy machine guards.
groups: (Optional) Array of candy guard groups with their configs to allow users to mint for different use cases
fee_payer (optional): Public key of the account from which all the fees for creating candy machine has to be taken. If providing this option, the resulting transaction must be signed by both, creator of candy machine (wallet field) and fee payer of this transaction (fee payer field)
For more details on groups and guards https://docs.metaplex.com/programs/candy-machine/available-guards
var myHeaders = new Headers();
myHeaders.append("x-api-key", "<YOUR_API_KEY>");
var raw = JSON.stringify({
"network": "devnet",
"wallet": "7iviPE2HZ15QCvHHCm8QzYdXKt9qReeT5P4aqSRAp7oY",
"symbol": "TSTSWG2",
"max_supply": 0,
"royalty": 333,
"collection": "7KnYuwbcG3EDLBnpYTovGN1WjpB1WvvyNuMgjRezG33s",
"items_available": 3,
"amount": 0.4
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shyft.to/sol/v1/candy_machine/create", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));javas
Insert Items in Candy Machine V3
POST /sol/v1/candy_machine/insert
Body
network: Solana blockchain environment (testnet/devnet/mainnet-beta)
wallet: The public key of the creator of candy machine
candy_machine: Address of the candy machine V3
index (optional): index from which items should be entered in the candy machine
items: Array of items to be inserted in candy machine
[
{
"name": "TOKEN #30", // String, name of the token excluding prefix_name specified while creating candy machine
"uri": "https://example.com/path/to/some/json/metadata.json" // String, metadata uri of the token excluding prefix_uri
}
]
var myHeaders = new Headers();
myHeaders.append("x-api-key", "<YOUR_API_KEY>");
var raw = JSON.stringify({
"network": "devnet",
"wallet": "2fmz8SuNVyxEP6QwKQs6LNaT2ATszySPEJdhUDesxktc",
"candy_machine": "7yPeRofJpfPkjLJ8CLB7czuk4sKG9toXWVq8CcHr4DcU",
"items": [
{
"name": "Token #21",
"uri": "https://example.com/path/to/some/json/metadata.json"
}
]
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shyft.to/sol/v1/candy_machine/insert", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));javas
Mint NFTs from Candy Machine V3
POST /sol/v1/candy_machine/mint
Mint items from a ready candy machine V3. Items cannot be minted unless the candy machine is fully inserted with all the token details
Body
network: Solana blockchain environment (testnet/devnet/mainnet-beta)
wallet: The public key of the person who wants to mint token from candy machine
authority: The public key of the owner of the candy machine
candy_machine: The public key of candy machine V3
mint_group: (Optional) The group label from which token should be minted from candy machine
guard_settings: (Optional) Additional candy guard settings
fee_payer: (Optional) Public key of the account who should be charged the transaction costs. If this option is specified then the transaction has to be signed by this address and not the wallet address
Response:
encoded_tranaction
: A base64 encoded transaction string to be signed with thebuyer_wallet
.transaction_version
: returns either 'lagacy' or 0. To overcome legacy transaction size (1232 bytes), in some special condition returns 'v0' transaction.mint
: NFT mint addresssigners
(array of addresses): Generated transaction should be signed by these wallets before send the transaction.
https://docs.metaplex.com/programs/candy-machine/minting#introduction
var myHeaders = new Headers();
myHeaders.append("x-api-key", "<YOUR_API_KEY>");
var raw = JSON.stringify({
"network": "devnet",
"wallet": "Apeng15Pm8EjpAcaAXpNUxZjS2jMmGqikfs281Fz9hNj",
"authority": "7iviPE2HZ15QCvHHCm8QzYdXKt9qReeT5P4aqSRAp7oY",
"candy_machine": "6gWE4aRFEicA6WRdebax3Gfp7ya7ZVExHM8kLE1Kk38Q",
"fee_payer": "7iviPE2HZ15QCvHHCm8QzYdXKt9qReeT5P4aqSRAp7oY"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shyft.to/sol/v1/candy_machine/mint", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Create monitor (Deprecated)
⚠️ Soon it no longer be available.
POST /sol/v1/candy_machine/monitor
All mints from candy machine are watched and updated real time
Body
network: Solana blockchain environment (testnet/devnet/mainnet-beta)
address: The public key of candy machine
var myHeaders = new Headers();
myHeaders.append("x-api-key", "<api-key>");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"network": "devnet",
"address": "Apeng15Pm8EjpAcaAXpNUxZjS2jMmGqikfs281Fz9hNj",
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shyft.to/sol/v1/candy_machine/monitor", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Unmonitor candy machine (Deprecated)
⚠️ Soon it no longer be available.
DELETE /sol/v1/candy_machine/monitor
Stop monitoring candy machine
Body
network: Solana blockchain environment (testnet/devnet/mainnet-beta)
address: The public key of candy machine
var myHeaders = new Headers();
myHeaders.append("x-api-key", "<api-key>");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"network": "devnet",
"address": "Apeng15Pm8EjpAcaAXpNUxZjS2jMmGqikfs281Fz9hNj",
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shyft.to/sol/v1/candy_machine/unmonitor", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Get Candy Machine V3 Details
Get details of a V3 candy machine along with all the guards.
Query Params
network: Solana blockchain environment (testnet/devnet/mainnet-beta)
address: Candy machine V3 address
GET /sol/v1/candy_machine/details
var myHeaders = new Headers();
myHeaders.append("x-api-key", "<your-api-key>");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shyft.to/sol/v1/candy_machine/details?network=devnet&address=J4XzzSmwTfRBF2HdB2vRY99FdMpgLf5BS51wVZJrWhjz", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Last updated
Was this helpful?