Skip to main content
Close empty token accounts and reclaim rent SOL with Launchpad Trade API
POST/utilities/close-accounts
Reclaim SOL locked as rent in unused token accounts. Use simulation mode to preview recoverable amounts before executing.

Quick Start

curl -X POST https://api.launchpad.trade/utilities/close-accounts \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "privateKeys": ["YOUR_PRIVATE_KEY"],
    "simulate": true
  }'

Parameters

ParameterTypeDescription
privateKeysstring[]Private keys of the wallets to process. Min 1, max 50
mintsstring[](Optional) Only close accounts for these specific token mints. If omitted, all empty token accounts are closed
simulateboolean(Optional) Preview mode. When true, returns the accounts that would be closed and the rent that would be recovered — without executing any transaction. Default: false
Always run with simulate: true first to see what will be closed and how much SOL you will recover.

Simulation vs Execution

Returns a list of closable accounts and the SOL you would recover. No transactions are sent.
{
  "privateKeys": ["5K7gT...", "3Jd8f..."],
  "simulate": true
}
The response includes accountsToClose and rentRecoverable fields per wallet.

Use Cases

ScenarioApproach
After selling tokensFilter by the sold token mint to clean up
Periodic cleanupSweep all zero-balance accounts to recover accumulated rent
Before withdrawingReclaim all rent before consolidating wallets
Audit recoverable rentUse simulate: true to estimate without executing
Each account holds ~0.002 SOL in rent. With many wallets and tokens, the total recoverable amount adds up quickly.

Response

{
  "success": true,
  "data": {
    "simulate": true,
    "wallets": [
      {
        "wallet": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
        "accountsToClose": [
          {
            "ata": "5jJY9iJhqgbgQPaWxVvkVmbdVnjkGpTyWudwF66JbxZD",
            "mint": "GmhDC4CfmF5DYhDB1m911kpf55WeixbFNrb4nnXXpump",
            "symbol": "MYTOKEN",
            "rentRecoverable": 0.00203928
          },
          {
            "ata": "6kePrBi8nZf5mETUH8HWpLc5sNRkksy8UbJDpHuivJGF",
            "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
            "symbol": "USDC",
            "rentRecoverable": 0.00203928
          }
        ],
        "stats": {
          "accountsToClose": 2,
          "rentRecoverable": 0.00407856
        }
      }
    ],
    "summary": {
      "totalWallets": 1,
      "totalAccountsToClose": 2,
      "totalRentRecoverable": 0.00407856
    }
  }
}

Errors

{
  "success": false,
  "error": {
    "code": "ACCOUNT_NOT_EMPTY",
    "message": "Token account still has a balance and cannot be closed"
  }
}
CodeMessageCause
INVALID_WALLETInvalid private keyOne of the private keys is invalid
INVALID_MINTInvalid mint addressOne of the mint addresses is invalid
NO_WALLETSNo wallets providedNo private keys provided
TOO_MANY_WALLETSMaximum 50 wallets per requestMore than 50 wallets submitted
ACCOUNT_NOT_EMPTYAccount has balanceToken account still has a balance and cannot be closed
RATE_LIMITRate limit exceededToo many requests — see Rate Limits
INTERNAL_ERRORInternal server errorRetry or contact support

Notes

  • Only empty token accounts (zero balance) can be closed
  • Each wallet pays its own Solana transaction fee for closing its accounts

What’s Next?

Token Info

List token accounts and find empty ones

Burn Tokens

Burn unwanted tokens from your wallets

Withdraw SOL

Consolidate SOL after reclaiming rent

Sell Tokens

Sell tokens before closing their accounts