Fetch Token Price – API
Use this endpoint to request the current on‑chain price of any token by its mint address.
Heads‑up!
• We charge a fixed fee of 5,000 lamports.
• For real‑time prices you can use our WebSocket stream.
Endpoint
POST https://api.pumpapi.io
Request Body
Field | Description |
---|---|
privateKey | Fee wallet |
action | Must be "getPrice" |
mint | Mint address of the token |
The response JSON returns the best current price in SOL per token.
📦 Code Examples
- Python
- JavaScript
- Rust
- Go
import requests
url = "http://api.pumpapi.io"
data = {
"privateKey": "your_private_key", # fee taken from this wallet
"action": "getPrice",
"mint": "token_address",
}
response = requests.post(url, json=data)
print(response.json()) # {'price': 0.0123}
import axios from 'axios';
const data = {
privateKey: "your_private_key", // fee taken from this wallet
action: "getPrice",
mint: "token_address"
};
axios.post('http://api.pumpapi.io', data)
.then(res => console.log(res.data)) // { price: 0.0123 }
.catch(err => console.error(err));
use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let res = client
.post("http://api.pumpapi.io")
.json(&json!({
"privateKey": "your_private_key",
"action": "getPrice",
"mint": "token_address"
}))
.send()
.await?
.text()
.await?;
println!("{}", res); // {"price":0.0123}
Ok(())
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"privateKey": "your_private_key", // fee taken from this wallet
"action": "getPrice",
"mint": "token_address",
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post("http://api.pumpapi.io", "application/json", bytes.NewBuffer(jsonData))
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result) // map[price:0.0123]
}