Get Prices At Timestamp
curl --request POST \
--url https://api.allium.so/api/v1/developer/prices/at-timestamp \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"addresses": [
{
"chain": "string",
"token_address": "string"
},
{
"chain": "string",
"token_address": "string"
}
],
"staleness_tolerance": "1h",
"time_granularity": "5m",
"timestamp": "2025-03-07T00:00:00Z"
}
'import requests
url = "https://api.allium.so/api/v1/developer/prices/at-timestamp"
payload = {
"addresses": [
{
"chain": "string",
"token_address": "string"
},
{
"chain": "string",
"token_address": "string"
}
],
"staleness_tolerance": "1h",
"time_granularity": "5m",
"timestamp": "2025-03-07T00:00:00Z"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
addresses: [
{chain: 'string', token_address: 'string'},
{chain: 'string', token_address: 'string'}
],
staleness_tolerance: '1h',
time_granularity: '5m',
timestamp: '2025-03-07T00:00:00Z'
})
};
fetch('https://api.allium.so/api/v1/developer/prices/at-timestamp', 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.allium.so/api/v1/developer/prices/at-timestamp",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'addresses' => [
[
'chain' => 'string',
'token_address' => 'string'
],
[
'chain' => 'string',
'token_address' => 'string'
]
],
'staleness_tolerance' => '1h',
'time_granularity' => '5m',
'timestamp' => '2025-03-07T00:00:00Z'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.allium.so/api/v1/developer/prices/at-timestamp"
payload := strings.NewReader("{\n \"addresses\": [\n {\n \"chain\": \"string\",\n \"token_address\": \"string\"\n },\n {\n \"chain\": \"string\",\n \"token_address\": \"string\"\n }\n ],\n \"staleness_tolerance\": \"1h\",\n \"time_granularity\": \"5m\",\n \"timestamp\": \"2025-03-07T00:00:00Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.allium.so/api/v1/developer/prices/at-timestamp")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"addresses\": [\n {\n \"chain\": \"string\",\n \"token_address\": \"string\"\n },\n {\n \"chain\": \"string\",\n \"token_address\": \"string\"\n }\n ],\n \"staleness_tolerance\": \"1h\",\n \"time_granularity\": \"5m\",\n \"timestamp\": \"2025-03-07T00:00:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.allium.so/api/v1/developer/prices/at-timestamp")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"addresses\": [\n {\n \"chain\": \"string\",\n \"token_address\": \"string\"\n },\n {\n \"chain\": \"string\",\n \"token_address\": \"string\"\n }\n ],\n \"staleness_tolerance\": \"1h\",\n \"time_granularity\": \"5m\",\n \"timestamp\": \"2025-03-07T00:00:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"items": [
{
"input_timestamp": "2023-11-07T05:31:56Z",
"price_timestamp": "2023-11-07T05:31:56Z",
"mint": "<string>",
"chain": "<string>",
"price": 123
}
],
"cursor": "<string>",
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Prices
Fetch token price at timestamp
Price of a token at a given timestamp.
POST
/
api
/
v1
/
developer
/
prices
/
at-timestamp
Get Prices At Timestamp
curl --request POST \
--url https://api.allium.so/api/v1/developer/prices/at-timestamp \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"addresses": [
{
"chain": "string",
"token_address": "string"
},
{
"chain": "string",
"token_address": "string"
}
],
"staleness_tolerance": "1h",
"time_granularity": "5m",
"timestamp": "2025-03-07T00:00:00Z"
}
'import requests
url = "https://api.allium.so/api/v1/developer/prices/at-timestamp"
payload = {
"addresses": [
{
"chain": "string",
"token_address": "string"
},
{
"chain": "string",
"token_address": "string"
}
],
"staleness_tolerance": "1h",
"time_granularity": "5m",
"timestamp": "2025-03-07T00:00:00Z"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
addresses: [
{chain: 'string', token_address: 'string'},
{chain: 'string', token_address: 'string'}
],
staleness_tolerance: '1h',
time_granularity: '5m',
timestamp: '2025-03-07T00:00:00Z'
})
};
fetch('https://api.allium.so/api/v1/developer/prices/at-timestamp', 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.allium.so/api/v1/developer/prices/at-timestamp",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'addresses' => [
[
'chain' => 'string',
'token_address' => 'string'
],
[
'chain' => 'string',
'token_address' => 'string'
]
],
'staleness_tolerance' => '1h',
'time_granularity' => '5m',
'timestamp' => '2025-03-07T00:00:00Z'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.allium.so/api/v1/developer/prices/at-timestamp"
payload := strings.NewReader("{\n \"addresses\": [\n {\n \"chain\": \"string\",\n \"token_address\": \"string\"\n },\n {\n \"chain\": \"string\",\n \"token_address\": \"string\"\n }\n ],\n \"staleness_tolerance\": \"1h\",\n \"time_granularity\": \"5m\",\n \"timestamp\": \"2025-03-07T00:00:00Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.allium.so/api/v1/developer/prices/at-timestamp")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"addresses\": [\n {\n \"chain\": \"string\",\n \"token_address\": \"string\"\n },\n {\n \"chain\": \"string\",\n \"token_address\": \"string\"\n }\n ],\n \"staleness_tolerance\": \"1h\",\n \"time_granularity\": \"5m\",\n \"timestamp\": \"2025-03-07T00:00:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.allium.so/api/v1/developer/prices/at-timestamp")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"addresses\": [\n {\n \"chain\": \"string\",\n \"token_address\": \"string\"\n },\n {\n \"chain\": \"string\",\n \"token_address\": \"string\"\n }\n ],\n \"staleness_tolerance\": \"1h\",\n \"time_granularity\": \"5m\",\n \"timestamp\": \"2025-03-07T00:00:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"items": [
{
"input_timestamp": "2023-11-07T05:31:56Z",
"price_timestamp": "2023-11-07T05:31:56Z",
"mint": "<string>",
"chain": "<string>",
"price": 123
}
],
"cursor": "<string>",
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}This endpoint returns the price of a token at or before a given timestamp. If the token doesn’t have a price at the given timestamp (because there weren’t any trades at that time), the price will be the price at the closest timestamp before the given timestamp.
Use
staleness_tolerance to specify the max lookback time for a price.
time_granularity
time_granularity is the size of the aggregation window over which we aggregate the price. It can be one of the following values: 15s, 1m, 5m, 1h, 1d.
Examples:
-
If you request a price at 3:15 with
1hgranularity, we will return the price at 3:00. Note that the price at 3:00 is the volume-weighted price of the token between 3:00 and 4:00. -
If you request a price at 3:12 with
5mgranularity, we will return the price at 3:10 (aggregating the price of the token between 3:10 and 3:15).
Retention Periods
Data at each granularity is retained for different periods. The following are the retention periods for each supported granularity:| Granularity | Retention |
|---|---|
| 15s | 5 days |
| 1m | 30 days |
| 5m | 30 days |
| 1h | All |
| 1d | All |
staleness_tolerance
staleness_tolerance is an optional string containing a number of seconds, minutes, hours, or days. Use this value to define the max lookback time for a price. For example: 60s, 5m, 2h, 2d.
Some lower volume tokens are often not traded for hours or days before trading starts again. In these instances, we do not return a price for periods of inactivity to prevent returning a stale price that doesn’t represent the actual value of a token.
To customize this behavior, you can use staleness_tolerance to define the max lookback time for a price.
Default Values
| Time Granularity | Default Staleness Tolerance |
|---|---|
| 15s | 60s |
| 1m | 5m |
| 5m | 10m |
| 1h | 2h |
| 1d | 2d |
Response
The response contains two timestamps:input_timestamp: The requested timestamp in the payloadprice_timestamp: The timestamp of the latest price found for the token
Pagination
This endpoint returns prices for up to 200 tokens in a single request.Supported Chains
Authorizations
Body
application/json
List of token address+chain pairs
Required array length:
1 - 200 elementsShow child attributes
Show child attributes
Target timestamp (UTC ISO 8601)
Candle granularity (15s, 1m, 5m, 1h, 1d)
Available options:
15s, 1m, 5m, 1h, 1d Max lookback for price data (e.g. 1h, 30m)
Was this page helpful?