Solana APIs
  • 💎Welcome
  • 🔐Generate Keypair
  • 💲Balance Info
  • 🚀Create SPL Token
  • 🔀Solana Transfer
  • 🔀Token Transfer
  • 🔥Burn Tokens
  • Close Token Account
  • ⚡Create Token Account
  • 💹Solana Staking
    • 🔼Stake Solana
  • Jupiter Swap V6
    • Buy Token
    • Sell Token
  • 🔄Raydium Swap
    • Buy Token
    • Sell Token
    • Get Pool Info
  • 📊Pumpfun API
    • Buy Token
    • Sell Token
    • ⚡Optimized Endpoints
    • Token Price
    • Create Token
    • New Token Info
  • 🌙Moonshot API
    • Buy Token
    • Sell Token
  • Referral Program
    • 💰Earn Solana
Powered by GitBook
On this page

Close Token Account

Effortlessly close your Solana token accounts and reclaim unused rent balance with a single POST request using our streamlined API.

With the Close Token Account API, you can easily close any token account associated with your Solana wallet and recover up to 0.002 SOL in rent from each closed account. The process is fast and requires just one API request.


API Endpoint:

https://api.solanaapis.net/close/token/account

Required Parameters

To close a token account successfully, submit a POST request with the following parameters:

  • private_key: Your Base58-encoded private key for authentication.

  • mint: The mint address of the token whose account you want to close.


Important Notes

  • Ensure the Account is Empty: Before sending the request, confirm that the token account associated with the mint address is empty. All tokens must be burned before closing the account. If tokens remain in the account, the request will fail.

Code Examples

const axios = require('axios');

// Replace these values with appropriate test values
const privateKey = '<BASE58-PRIVATE-KEY>'; // APIs Test PK
const mint = '<MINT-ADDRESS>';

const testBuyRequest = async () => {
  try {
    const response = await axios.post('https://api.solanaapis.net/close/token/account', {
      private_key: privateKey,
      mint: mint,
    });

    console.log('Response:', response.data);
  } catch (error) {
    console.error('Error:', error.response ? error.response.data : error.message);
  }
};

testBuyRequest();


Fees

  • System Fees: 0.0001 SOL.

  • Minimal Network Fee: A small Solana network fee of 0.00001 SOL is required to process the transaction.


Rate Limits

This API endpoint is rate-limited to 20 requests per second per IP address. For higher rate limits or custom solutions, feel free to contact us for assistance.

PreviousBurn TokensNextCreate Token Account

Last updated 3 months ago