Fetch Price
curl --request GET \
--url https://api.example.com/api/fetch-price/:token \
--header 'x-payment-signature: <x-payment-signature>' \
--header 'x-payment-wallet: <x-payment-wallet>'import requests
url = "https://api.example.com/api/fetch-price/:token"
headers = {
"x-payment-signature": "<x-payment-signature>",
"x-payment-wallet": "<x-payment-wallet>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'x-payment-signature': '<x-payment-signature>',
'x-payment-wallet': '<x-payment-wallet>'
}
};
fetch('https://api.example.com/api/fetch-price/:token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/fetch-price/:token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-payment-signature: <x-payment-signature>",
"x-payment-wallet: <x-payment-wallet>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/fetch-price/:token"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-payment-signature", "<x-payment-signature>")
req.Header.Add("x-payment-wallet", "<x-payment-wallet>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/fetch-price/:token")
.header("x-payment-signature", "<x-payment-signature>")
.header("x-payment-wallet", "<x-payment-wallet>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/fetch-price/:token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-payment-signature"] = '<x-payment-signature>'
request["x-payment-wallet"] = '<x-payment-wallet>'
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"mintSymbol": "<string>",
"vsToken": "<string>",
"vsTokenSymbol": "<string>",
"price": 123
}
}API Reference
Fetch Price
Live token pricing via the Jupiter Price API
GET
/
api
/
fetch-price
/
:token
Fetch Price
curl --request GET \
--url https://api.example.com/api/fetch-price/:token \
--header 'x-payment-signature: <x-payment-signature>' \
--header 'x-payment-wallet: <x-payment-wallet>'import requests
url = "https://api.example.com/api/fetch-price/:token"
headers = {
"x-payment-signature": "<x-payment-signature>",
"x-payment-wallet": "<x-payment-wallet>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'x-payment-signature': '<x-payment-signature>',
'x-payment-wallet': '<x-payment-wallet>'
}
};
fetch('https://api.example.com/api/fetch-price/:token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/fetch-price/:token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-payment-signature: <x-payment-signature>",
"x-payment-wallet: <x-payment-wallet>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/fetch-price/:token"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-payment-signature", "<x-payment-signature>")
req.Header.Add("x-payment-wallet", "<x-payment-wallet>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/fetch-price/:token")
.header("x-payment-signature", "<x-payment-signature>")
.header("x-payment-wallet", "<x-payment-wallet>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/fetch-price/:token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-payment-signature"] = '<x-payment-signature>'
request["x-payment-wallet"] = '<x-payment-wallet>'
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"mintSymbol": "<string>",
"vsToken": "<string>",
"vsTokenSymbol": "<string>",
"price": 123
}
}Provides real-time pricing data for SPL tokens by querying the Jupiter aggregator.
Authentication
This endpoint requires an x402 payment. A402 Payment Required response is returned if the payment signature is missing or invalid.
Cost: 0.05 USDC per request.
Header Parameters
string
required
A valid Solana transaction signature proving the USDC transfer to the merchant’s vault address.
string
required
The public key of the wallet that made the payment.
Path Parameters
string
required
The token symbol (e.g.,
SOL, BONK, JUP) or mint address.Response
object
Example
# First call returns 402 — discover payment requirements
curl -i http://localhost:3000/api/fetch-price/SOL
# After payment, include signature to receive data
curl -H "x-payment-signature: <TX_SIGNATURE>" \
-H "x-payment-wallet: <YOUR_PUBKEY>" \
http://localhost:3000/api/fetch-price/SOL
⌘I