Welcome to thepump.fun Buy & Sell quote api’s.

To fetch a swap quote for Pump.fun tokens, send a POST request to:

https://pumpapi.fun/api/quote

The outAmount indicates the amount of tokens in lamports, which futher dividing by the token decimals (6) gives exact amount as in the pump.fun website.

Your request Body Parameters for /api/quote Endpoint:

ParameterTypeDescriptionRequired
quote_typestring“buy” or “sell” to specify the quote typeYes
mintstringToken mint addressYes
amountnumberAmount of SOL or tokens in lamportsYes
slippagenumberDesired slippage tolerance (integer)No

Example usage:

import requests
 
response = requests.post(url="https://pumpapi.fun/api/quote", data={
    "quote_type": "buy",                # "buy" or "sell"
    "mint": "YOUR_MINT_ADDRESS",      
    "amount": 100000,                   # amount of SOL or tokens in lamports
    "slippage": 5,                      # Desired slippage 
})
 
data = response.json()           

Response Type:

The API returns JSON data upon successful execution:

{
  quote_type: 'buy',
  inputMint: 'So11111111111111111111111111111111111111112',
  inAmount: 1000000,
  outputMint: '3WXu8TskGXSJzhSM61hxbbFqAT9g7FbDuhifCEwRfhRN',
  outAmount: 35765474313
}

Error Codes

  • 400 Bad Request: Invalid request parameters or missing required fields.
  • 401 Unauthorized: Authentication failed.
  • 404 Not Found: The requested resource (endpoint) is not found.
  • 429 Too Many Requests: Rate limit exceeded.
  • 500 Internal Server Error: Unexpected server-side error.

API Codes

  • 200 OK: The request was successful.