api-pump.fun
  • General
    • Getting started
  • Reference
    • API Reference
      • Generate API Key
      • Balance
      • Token information
      • Get Quote
      • Bonding Curve
      • King of The Hill
      • Trade tokens
      • Trade tokens [local RPC]
      • Create token
  • Streams
    • Websocket subscription
Powered by GitBook
On this page
  1. Reference
  2. API Reference

Get Quote

Get quote information

GET /quote

Method is used to get a quote for buying or selling a specified amount of a token

Headers

Name
Value

Content-Type

application/json

x-api-key

The API key for authentication

Parameters

Parameter
Description
Required

token

The token for which the quote is requested

Yes

amount

The amount of the token to be traded

Yes

mode

The trade mode (e.g., “buy”, “sell”)

Yes

Body

Response

{
    "bondingCurve": "25uW6hChv3HV5y1tWKWAdFSn52W7MXbjVzfydpE95MCW",
    "mode": "buy",
    "tokenIn": "GBUua9eDwR3iBSv9EkDHPLRxEqrhkw5xHLcz5vVkpump",
    "amountIn": 1,
    "amountInRaw": "1000000000",
    "tokenOut": "So11111111111111111111111111111111111111112",
    "amountOut": 4458617.224765,
    "amountOutRaw": "4458617224765"
}
{
  "error": true,
  "message": "Token not found"
}
{
  "error": true,
  "message": "Wallet not found"
}
{
  "error": true,
  "message": "Curve is complete"
}

Examples

curl --location 'https://rpc.api-pump.fun/quote?token=your_token&amount=your_amount&mode=your_mode' \
--header 'Content-Type: application/json' \
--header 'x-api-key: your_api_key'
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://rpc.api-pump.fun/quote?token=your_token&amount=your_amount&mode=your_mode"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("x-api-key", "your_api_key")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'rpc.api-pump.fun',
  'path': '/quote?token=your_token&amount=your_amount&mode=your_mode',
  'headers': {
    'Content-Type': 'application/json',
    'x-api-key': 'your_api_key'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
import requests
import json

url = "https://rpc.api-pump.fun/quote?token=your_token&amount=your_amount&mode=your_mode"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'x-api-key': 'your_api_key'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
PreviousToken informationNextBonding Curve

Last updated 10 months ago