Skip to main content
POST https://swarms.world/api/product/claimfees Claims accumulated fees for a token on Solana. You provide the token mint (contract address) and your wallet’s private key; the endpoint builds the claim transaction, signs it with your key, submits it on-chain, and returns the transaction signature and how much SOL was claimed. The private key is used only in memory to sign the transaction and is never stored or logged.

Request

Headers

Body Parameters (JSON)


Response

Success (HTTP 200)

Example success response:
If fee info could not be fetched, amountClaimedSol and fees will be null; signature is still returned on success.

HTTP Status Codes


Example Request


Error Responses

Error response body (4xx / 5xx)

Example error responses

Missing parameters (400):
Invalid token mint (400):
Invalid private key (400):
Claim / submit failed (500): Returned when the claim transaction fails (e.g. no fees to claim, network error).

Advanced Examples

These examples include additional features like retry logic, async support, context/timeout handling, and custom error types.

Security Notes

Private Key Security: The privateKey is used only in memory to sign the claim transaction and is not stored or logged. However, sending a private key in any API request is inherently risky.
  • Use HTTPS: Always use HTTPS in production to encrypt the private key in transit.
  • Consider Client-Side Signing: For production applications where security is paramount, consider implementing client-side signing using a wallet adapter. This avoids sending the private key to the server entirely.
  • Key Rotation: If you suspect your private key has been compromised, immediately transfer funds to a new wallet.
  • Environment Variables: Never hardcode private keys in your source code. Use environment variables or secure secret management systems.

See Also