This API gives you an easy way to
-- Burn any token or NFT type
-- Close all empty token accounts, both regular and token 2022
We support both transactions that you just need to sign and send, or instructions that you can compose further.
Base URL: https://v1.api.sol-incinerator.com/
Quick Start Examples
Here are the two most common operations to get you started:
Close All Empty Token Accounts
import axios from 'axios';
import { Connection, Keypair, VersionedTransaction } from '@solana/web3.js';
import base58 from 'bs58';
const response = await axios.post('https://v1.api.sol-incinerator.com/batch/close-all', {
userPublicKey: '4CsWE4mhp5LQDATR25sauR6umW21NQFLEsj27rSP1Muf'
}, {
headers: {
'x-api-key': 'your-api-key-here'
}
});
// Process each transaction
const connection = new Connection('https://api.mainnet-beta.solana.com');
const wallet = Keypair.fromSecretKey(/* your secret key */);
for (const serializedTx of response.data.transactions) {
const transaction = VersionedTransaction.deserialize(base58.decode(serializedTx));
transaction.sign([wallet]);
await connection.sendTransaction(transaction);
}
Burn an NFT
import axios from 'axios';
import { Connection, Keypair, VersionedTransaction } from '@solana/web3.js';
import base58 from 'bs58';
const response = await axios.post('https://v1.api.sol-incinerator.com/burn', {
userPublicKey: '4CsWE4mhp5LQDATR25sauR6umW21NQFLEsj27rSP1Muf',
assetId: '7tPfzEm87ao3UCK54w1K73CkTz1WmvXWLXeijzDCrn2C'
}, {
headers: {
'x-api-key': 'your-api-key-here'
}
});
// Deserialize and sign the transaction
const transaction = VersionedTransaction.deserialize(base58.decode(response.data.serializedTransaction));
const wallet = Keypair.fromSecretKey(/* your secret key */);
transaction.sign([wallet]);
// Send the transaction
const connection = new Connection('https://api.mainnet-beta.solana.com');
const signature = await connection.sendTransaction(transaction);
Authentication
All endpoints except the status endpoint require an API key. Include your API key in the request headers:
x-api-key: your-api-key-here
or
Authorization: your-api-key-here
To acquire an API key, open a ticket in the Sol Slugs Discord server.
NFT Types Supported
The API supports burning and closing the following asset types:
Tokens: Standard SPL Token Program tokens
Token2022: SPL Token-2022 Program tokens, includeing those with transfer fees enabled
Regular Metaplex NFTs: Standard Metaplex NFTs with metadata accounts
Metaplex pNFTs: Programmable NFTs with token records
Metaplex Editions: Metaplex edition NFTs derived from master editions
Metaplex pNFT Editions: Programmable NFTs with token records derived from master editions
MPL Core: Metaplex Core NFTs
NFT Types Not Supported
Magiceden Open Creator Protocol
Bubblegum cNFTs
Endpoints
GET / - Status Check
Check if the API is online.
Response
interface StatusResponse {
status: string;
}
{
"status": "ok"
}
cURL Example
curl -X GET https://v1.api.sol-incinerator.com/
POST /burn - Burn Asset
Destructive Operation: This permanently destroys the asset.
Creates and returns a transaction to burn the provided NFT or token.
You can also use this endpoint with an empty token account to close if desired - it's a unified handler for anything
Request Parameters
Parameter
Type
Required
Description
userPublicKey
string
Yes
Public key of the asset owner
assetId
string
Yes
Token account or mint address of the asset to burn
feePayer
string
No
Account to pay transaction fees (defaults to userPublicKey)
autoCloseTokenAccounts
boolean
No
Auto-close token account after burn (default: true)
priorityFeeMicroLamports
number
No
Custom priority fee in micro-lamports
asLegacyTransaction
boolean
No
Use legacy transaction format (default: false)
burnAmount
number
No
Amount to burn in atomic units (defaults to full balance)
Response
interface BurnResponse {
assetId: string; // Asset that was processed
serializedTransaction: string; // Base58 encoded transaction
lamportsReclaimed: number; // Lamports returned to user
solanaReclaimed: number; // SOL equivalent of lamports
transactionType: string; // Type of burn operation
isDestructiveAction: boolean; // Always true for burns
}
Non-Destructive Operation: Closes an empty token account and reclaims rent.
Creates a transaction that will close the provided token account and reclaim the rent to the user.
Request Parameters
Parameter
Type
Required
Description
userPublicKey
string
Yes
Public key of the account owner
assetId
string
Yes
Token account address to close
feePayer
string
No
Account to pay transaction fees
priorityFeeMicroLamports
number
No
Custom priority fee
asLegacyTransaction
boolean
No
Use legacy transaction format
Special Requirements
Token account must have zero balance
User must be the account owner or close authority
Response
interface CloseResponse {
assetId: string; // Token account that was closed
serializedTransaction: string; // Base58 encoded transaction
lamportsReclaimed: number; // Lamports returned to user (typically 2000000)
solanaReclaimed: number; // SOL equivalent (typically 0.002)
transactionType: string; // Type of close operation
isDestructiveAction: boolean; // Always false for closes
}
Node.js Example
import axios from 'axios';
import { Connection, Keypair, VersionedTransaction } from '@solana/web3.js';
import base58 from 'bs58';
async function closeAccount() {
const response = await axios.post('https://v1.api.sol-incinerator.com/close', {
userPublicKey: '4CsWE4mhp5LQDATR25sauR6umW21NQFLEsj27rSP1Muf',
assetId: 'AX8hSyM7j7Qcn7dDQezqu4QVHPqhEbje9DnmoPcRigU9'
}, {
headers: {
'x-api-key': 'your-api-key-here'
}
});
// Response will show lamportsReclaimed: 2000000 for standard accounts
console.log('Close response:', response.data);
const transaction = VersionedTransaction.deserialize(
base58.decode(response.data.serializedTransaction)
);
const wallet = Keypair.fromSecretKey(/* your secret key */);
transaction.sign([wallet]);
const connection = new Connection('https://api.mainnet-beta.solana.com');
const signature = await connection.sendTransaction(transaction);
}
Non-Destructive Operation: Batch closes all empty token accounts.
Creates transactions to close all empty accounts owned by the user, and return the rent to them.
This endpoint automatically batches into multiple transactions when required.
Request Parameters
Parameter
Type
Required
Description
userPublicKey
string
Yes
Public key of the account owner
feePayer
string
No
Account to pay transaction fees
priorityFeeMicroLamports
number
No
Custom priority fee
asLegacyTransaction
boolean
No
Use legacy transaction format
Response
interface BatchCloseAllResponse {
transactions: string[]; // Array of base58 encoded transactions
accountsClosed: number; // Total accounts to be closed
totalLamportsReclaimed: number; // Total lamports across all transactions
totalSolanaReclaimed: number; // SOL equivalent
}
Node.js Example
import axios from 'axios';
import { Connection, Keypair, VersionedTransaction } from '@solana/web3.js';
import base58 from 'bs58';
async function closeAllEmptyAccounts() {
const response = await axios.post('https://v1.api.sol-incinerator.com/batch/close-all', {
userPublicKey: '4CsWE4mhp5LQDATR25sauR6umW21NQFLEsj27rSP1Muf',
}, {
headers: {
'x-api-key': 'your-api-key-here'
}
});
console.log(`Found ${response.data.accountsClosed} accounts to close`);
console.log(`Will reclaim ${response.data.totalSolanaReclaimed} SOL`);
console.log(`Need to submit ${response.data.transactions.length} transactions`);
const connection = new Connection('https://api.mainnet-beta.solana.com');
const wallet = Keypair.fromSecretKey(/* your secret key */);
// Process each transaction
for (let i = 0; i < response.data.transactions.length; i++) {
const serializedTx = response.data.transactions[i];
const transaction = VersionedTransaction.deserialize(base58.decode(serializedTx));
transaction.sign([wallet]);
const signature = await connection.sendTransaction(transaction);
console.log(`Transaction ${i + 1} sent:`, signature);
await connection.confirmTransaction(signature);
}
}
POST /batch/close-all-instructions - Get All Close Instructions
Non-Destructive Operation: Returns instructions for closing all empty accounts.
Creates sets of instructions to close all empty accounts owned by the user, and return the rent to them.
One instruction group = one account closed. You can batch multiple into a single TX, but it adds complexity - see /batch/close-all if you want this behavior handled for you
Request Parameters
Parameter
Type
Required
Description
userPublicKey
string
Yes
Public key of the account owner
Response
interface BatchCloseAllInstructionsResponse {
instructionGroups: AccountCloseInstructionGroup[]; // Array of instruction groups
accountsClosed: number; // Total accounts to be closed
totalLamportsReclaimed: number; // Total lamports across all groups
totalSolanaReclaimed: number; // SOL equivalent
}
interface AccountCloseInstructionGroup {
accountId: string; // Account being closed
instructions: SerializedInstruction[]; // Instructions for this account
lamportsReclaimed: number; // Lamports for this specific account
solanaReclaimed: number; // SOL equivalent for this account
accountType: string; // Account type (TOKEN_CLOSE, TOKEN_2022_CLOSE, etc.)
}
interface SerializedInstruction {
programId: string; // Program ID as base58 string
accounts: SerializedAccount[]; // Account metadata
data: string; // Base64 encoded instruction data
}
interface SerializedAccount {
pubkey: string; // Account public key as base58 string
isSigner: boolean; // Whether account must sign
isWritable: boolean; // Whether account is writable
}
Node.js Example
import axios from 'axios';
import {
Connection,
Keypair,
TransactionInstruction,
TransactionMessage,
VersionedTransaction,
PublicKey
} from '@solana/web3.js';
async function getAllCloseInstructions() {
const response = await axios.post('https://v1.api.sol-incinerator.com/batch/close-all-instructions', {
userPublicKey: 'TABLEKRgHNkhGQFN8xmXmKhVXW6SGC9jwo7WNkkUpwm'
}, {
headers: {
'x-api-key': 'your-api-key-here'
}
});
console.log(`Total accounts: ${response.data.accountsClosed}`);
const connection = new Connection('https://api.mainnet-beta.solana.com');
const wallet = Keypair.fromSecretKey(/* your secret key */);
// Get fresh blockhash
const { blockhash } = await connection.getLatestBlockhash();
// Process each account's instructions
for (const group of response.data.instructionGroups) {
console.log(`Processing account: ${group.accountId}`);
console.log(`Type: ${group.accountType}`);
console.log(`SOL reclaimed: ${group.solanaReclaimed}`);
// Convert serialized instructions to TransactionInstruction objects
const instructions: TransactionInstruction[] = group.instructions.map(ix => {
return new TransactionInstruction({
programId: new PublicKey(ix.programId),
keys: ix.accounts.map(acc => ({
pubkey: new PublicKey(acc.pubkey),
isSigner: acc.isSigner,
isWritable: acc.isWritable
})),
data: Buffer.from(ix.data, 'base64')
});
});
// Create transaction message
const message = new TransactionMessage({
payerKey: wallet.publicKey, // Set fee payer
recentBlockhash: blockhash,
instructions: instructions
}).compileToV0Message();
// Create and sign transaction
const transaction = new VersionedTransaction(message);
transaction.sign([wallet]);
// Send transaction
const signature = await connection.sendTransaction(transaction);
console.log(`Transaction sent: ${signature}`);
}
}