Get sparkline BTC price data
curl --request GET \
--url https://api.moralis.com/v1/chains/{chainAlias}/tokens/{tokenAliasOrTokenAddress}/price/sparkline \
--header 'X-Api-Key: <api-key>'import requests
url = "https://api.moralis.com/v1/chains/{chainAlias}/tokens/{tokenAliasOrTokenAddress}/price/sparkline"
headers = {"X-Api-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Api-Key': '<api-key>'}};
fetch('https://api.moralis.com/v1/chains/{chainAlias}/tokens/{tokenAliasOrTokenAddress}/price/sparkline', 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.moralis.com/v1/chains/{chainAlias}/tokens/{tokenAliasOrTokenAddress}/price/sparkline",
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-Api-Key: <api-key>"
],
]);
$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.moralis.com/v1/chains/{chainAlias}/tokens/{tokenAliasOrTokenAddress}/price/sparkline"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Api-Key", "<api-key>")
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.moralis.com/v1/chains/{chainAlias}/tokens/{tokenAliasOrTokenAddress}/price/sparkline")
.header("X-Api-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moralis.com/v1/chains/{chainAlias}/tokens/{tokenAliasOrTokenAddress}/price/sparkline")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Api-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"chain": "bitcoin",
"range": "7d",
"fromDate": "2025-01-01T00:00:00.000Z",
"toDate": "2025-01-08T00:00:00.000Z",
"page": 1,
"cursor": null,
"result": [
{
"timestamp": "2025-01-02T09:00:00.000Z",
"price": "0.00123"
}
],
"meta": {
"syncedAt": {
"bitcoin": "latest"
}
}
}Price API
Sparkline
Get a small set of recent BTC price points suitable for sparkline charts. Returns a fixed number of points based on the selected range.
GET
/
v1
/
chains
/
{chainAlias}
/
tokens
/
{tokenAliasOrTokenAddress}
/
price
/
sparkline
Get sparkline BTC price data
curl --request GET \
--url https://api.moralis.com/v1/chains/{chainAlias}/tokens/{tokenAliasOrTokenAddress}/price/sparkline \
--header 'X-Api-Key: <api-key>'import requests
url = "https://api.moralis.com/v1/chains/{chainAlias}/tokens/{tokenAliasOrTokenAddress}/price/sparkline"
headers = {"X-Api-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Api-Key': '<api-key>'}};
fetch('https://api.moralis.com/v1/chains/{chainAlias}/tokens/{tokenAliasOrTokenAddress}/price/sparkline', 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.moralis.com/v1/chains/{chainAlias}/tokens/{tokenAliasOrTokenAddress}/price/sparkline",
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-Api-Key: <api-key>"
],
]);
$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.moralis.com/v1/chains/{chainAlias}/tokens/{tokenAliasOrTokenAddress}/price/sparkline"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Api-Key", "<api-key>")
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.moralis.com/v1/chains/{chainAlias}/tokens/{tokenAliasOrTokenAddress}/price/sparkline")
.header("X-Api-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moralis.com/v1/chains/{chainAlias}/tokens/{tokenAliasOrTokenAddress}/price/sparkline")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Api-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"chain": "bitcoin",
"range": "7d",
"fromDate": "2025-01-01T00:00:00.000Z",
"toDate": "2025-01-08T00:00:00.000Z",
"page": 1,
"cursor": null,
"result": [
{
"timestamp": "2025-01-02T09:00:00.000Z",
"price": "0.00123"
}
],
"meta": {
"syncedAt": {
"bitcoin": "latest"
}
}
}For BTC, pass
bitcoin as chainAlias and native as tokenAliasOrTokenAddress. The response is a compact, chart-ready price array — drop it directly into a sparkline widget without resampling.Authorizations
Path Parameters
Bitcoin chain alias. Pass bitcoin or bitcoin-mainnet.
Available options:
bitcoin, bitcoin-mainnet For BTC price, pass native.
Available options:
native Query Parameters
The time range for the sparkline. Determines the interval and window size.
Available options:
24h, 7d, 30d, 90d, 1y Example:
"7d"
Response
200 - application/json
The resolved blockchain chain ID
Example:
"bitcoin"
The sparkline range used for this result
Available options:
24h, 7d, 30d, 90d, 1y Example:
"7d"
ISO-8601 timestamp of the computed window start
Example:
"2025-01-01T00:00:00.000Z"
ISO-8601 timestamp of the computed window end
Example:
"2025-01-08T00:00:00.000Z"
Always 1. Sparkline responses are not paginated.
Example:
1
Always null. Sparkline responses are not paginated.
Example:
null
Array of price data points
Show child attributes
Show child attributes
Show child attributes
Show child attributes

