Skip to main content

Sell API

The Sell API endpoint executes a token sale on the Solana blockchain. It calculates the transaction, ensures token accounts are valid, signs the transaction, and returns the transaction signature.

Endpoint Details

  • Method: POST
  • URL: https://api.pumpfunapis.com/api/sell

Request Body

Example Request Body
{
"private_key": "PRIVATE_KEY", // Please only use a BURNER wallet
"mint": "Token_CA", // Mint Address
"percentage": 100, // 100% of the tokens will be sold
"slippage": 10 // Slippage 10%
}

Example Usage

Curl Example

cURL Example
curl --location --request POST 'https://api.pumpfunapis.com/api/sell' \
--header 'Content-Type: application/json' \
--data-raw '{
"private_key": "PRIVATE_KEY",
"mint": "Token_CA",
"percentage": 100,
"slippage": 10
}'

Python Example

Python Example
import requests

def sell_token():
url = "https://api.pumpfunapis.com/api/sell"
payload = {
"private_key": "PRIVATE_KEY",
"mint": "Token_CA",
"percentage": 100,
"slippage": 10
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

if response.status_code == 200:
print("Transaction Signature:", response.json().get("tx_signature"))
else:
print("Failed to execute sell transaction:", response.text)

sell_token()

JavaScript Example

JavaScript Example
const fetch = require('node-fetch');

const sellToken = async () => {
const response = await fetch('https://api.pumpfunapis.com/api/sell', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
private_key: 'PRIVATE_KEY', // Please only use a BURNER wallet
mint: 'Token_CA',
percentage: 100, // 100% of the tokens will be sold
slippage: 10 // Slippage 10%
}),
});

if (!response.ok) {
throw new Error('Failed to execute sell transaction');
}

const data = await response.json();
console.log('Transaction Signature:', data.tx_signature);
};

sellToken().catch(console.error);

Response

Successful Response

200 OK
{
"status": "success",
"tx_signature": "5ba4sCas...."
}

Error Response

Validation Error (422)

422 Unprocessable Entity
{
"detail": [
{
"loc": ["body", "private_key"],
"msg": "field required",
"type": "value_error.missing"
}
]
}

Notes

  • Ensure that the private_key used is from a secure burner wallet.
  • Use appropriate slippage settings to avoid failed transactions.