Get asset price history
curl --request GET \
--url https://demo-api.mobula.io/api/2/asset/price-historyimport requests
url = "https://demo-api.mobula.io/api/2/asset/price-history"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://demo-api.mobula.io/api/2/asset/price-history', 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://demo-api.mobula.io/api/2/asset/price-history",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://demo-api.mobula.io/api/2/asset/price-history"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://demo-api.mobula.io/api/2/asset/price-history")
.asString();require 'uri'
require 'net/http'
url = URI("https://demo-api.mobula.io/api/2/asset/price-history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"priceHistory": [
[
123
]
],
"id": 123,
"name": "<string>",
"symbol": "<string>",
"chainId": "<string>",
"address": "<string>",
"error": "<string>"
}
}History - Prices & OHLCV Candles
Get Asset Price History
Retrieve historical price data for one or multiple assets.
GET
/
2
/
asset
/
price-history
Get asset price history
curl --request GET \
--url https://demo-api.mobula.io/api/2/asset/price-historyimport requests
url = "https://demo-api.mobula.io/api/2/asset/price-history"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://demo-api.mobula.io/api/2/asset/price-history', 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://demo-api.mobula.io/api/2/asset/price-history",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://demo-api.mobula.io/api/2/asset/price-history"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://demo-api.mobula.io/api/2/asset/price-history")
.asString();require 'uri'
require 'net/http'
url = URI("https://demo-api.mobula.io/api/2/asset/price-history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"priceHistory": [
[
123
]
],
"id": 123,
"name": "<string>",
"symbol": "<string>",
"chainId": "<string>",
"address": "<string>",
"error": "<string>"
}
}Batch Support Available: This endpoint supports batch queries via POST method for fetching price history for up to 10 assets in a single request. Jump to Batch Query section
Timestamps are in MS, it’s JS timestamps.
Overview
This endpoint retrieves historical price data for assets. Use GET for a single asset or POST for batch requests (up to 10 assets).How to get the asset ID?You can retrieve an asset’s ID using:
- The Search endpoint - search by asset name and get the ID from the response
- The All Assets endpoint - list all assets with their IDs
GET Request (Single Asset)
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | number | Cond. | Mobula’s internal asset ID. Either id or address must be provided. |
address | string | Cond. | Contract address. Either id or address must be provided. |
chainId | string | Cond. | Chain identifier (e.g., "ethereum", "base"). Required when using address. |
period | string | No | Candle resolution. Supported: 5m, 15m, 1h, 6h, 1d. Defaults to auto-granularity. |
from | number | No | Start timestamp (ms). Defaults to 0 (epoch). |
to | number | No | End timestamp (ms). Defaults to current time. |
Example
curl -X GET "https://api.mobula.io/api/2/asset/price-history?id=100001628&period=1h"
POST Request (Batch)
Request Body
Send an array of asset queries directly (minimum 1, maximum 10 per request). Each item uses the same parameters as the GET request.Example
curl -X POST "https://api.mobula.io/api/2/asset/price-history" \
-H "Content-Type: application/json" \
-d '[
{ "id": 100001628, "period": "1h" },
{ "address": "0xc4ce8e63921b8b6cbdb8fcb6bd64cc701fb926f2", "chainId": "ethereum" }
]'
Response Format
All response fields use camelCase naming convention:| Field | Type | Description |
|---|---|---|
priceHistory | number[][] | Array of [timestamp, price] tuples |
id | number | Mobula’s internal asset ID |
name | string | Asset name |
symbol | string | Asset symbol |
chainId | string | Chain identifier |
address | string | Contract address |
error | string | Error message if the asset could not be fetched (batch only) |
GET Response Example
{
"data": {
"priceHistory": [
[1754337900000, 0.00123456],
[1754338200000, 0.00124567]
],
"id": 100001628,
"name": "Example Token",
"symbol": "EXT",
"chainId": "ethereum",
"address": "0xc4ce8e63921b8b6cbdb8fcb6bd64cc701fb926f2"
}
}
POST Response Example
{
"data": [
{
"priceHistory": [[1754337900000, 0.00123456]],
"id": 100001628,
"name": "Token A",
"symbol": "TKNA"
},
{
"priceHistory": [[1754337900000, 1.25]],
"id": 100002000,
"name": "Token B",
"symbol": "TKNB",
"chainId": "ethereum",
"address": "0xc4ce8e63921b8b6cbdb8fcb6bd64cc701fb926f2"
}
]
}
Data Granularity
- 5 minutes for the last 7 days
- 6 hours for the last 30 days
- 1 day for the remaining of history
Period Options
5mfor 5 minutes15mfor 15 minutes1hfor 1 hour6hfor 6 hours1dfor 1 day
Notes
- Maximum 10 assets per POST request
- Rate limit: 5 credits (GET), 10 credits (POST)
Query Parameters
Token contract address
Blockchain chain ID (required when using address)
Asset ID (alternative to address+chainId)
Candle period (e.g., "5m", "1h", "1d")
Start timestamp (unix seconds)
End timestamp (unix seconds)
Response
200 - application/json
Asset price history response
Show child attributes
Show child attributes