Per-client usage analytics
curl --request GET \
--url https://api.leokit.dev/analytics \
--header 'Api-Key: <api-key>'import requests
url = "https://api.leokit.dev/analytics"
headers = {"Api-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'Api-Key': '<api-key>'}};
fetch('https://api.leokit.dev/analytics', 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.leokit.dev/analytics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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.leokit.dev/analytics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("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.leokit.dev/analytics")
.header("Api-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.leokit.dev/analytics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Api-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"period": "1h",
"generated_at": "2023-11-07T05:31:56Z",
"client": {
"name": "<string>"
},
"summary": {
"total_quotes": 123,
"total_deposits": 123,
"conversion_rate": "<string>",
"avg_response_time_ms": 123,
"near_ecosystem_fees_usd": 123
},
"top_pairs": [
{
"from_asset": "<string>",
"to_asset": "<string>",
"quotes": 123,
"deposits": 123
}
],
"protocols": [
{
"name": "<string>",
"quotes_offered": 123
}
],
"timeline": [
{
"timestamp": "2023-11-07T05:31:56Z",
"quotes": 123,
"deposits": 123
}
]
}{
"message": "<string>",
"code": "<string>"
}Core Endpoints
Analytics
Get per-client usage analytics — quotes, deposits, pair breakdowns, and timelines
GET
/
analytics
Per-client usage analytics
curl --request GET \
--url https://api.leokit.dev/analytics \
--header 'Api-Key: <api-key>'import requests
url = "https://api.leokit.dev/analytics"
headers = {"Api-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'Api-Key': '<api-key>'}};
fetch('https://api.leokit.dev/analytics', 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.leokit.dev/analytics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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.leokit.dev/analytics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("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.leokit.dev/analytics")
.header("Api-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.leokit.dev/analytics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Api-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"period": "1h",
"generated_at": "2023-11-07T05:31:56Z",
"client": {
"name": "<string>"
},
"summary": {
"total_quotes": 123,
"total_deposits": 123,
"conversion_rate": "<string>",
"avg_response_time_ms": 123,
"near_ecosystem_fees_usd": 123
},
"top_pairs": [
{
"from_asset": "<string>",
"to_asset": "<string>",
"quotes": 123,
"deposits": 123
}
],
"protocols": [
{
"name": "<string>",
"quotes_offered": 123
}
],
"timeline": [
{
"timestamp": "2023-11-07T05:31:56Z",
"quotes": 123,
"deposits": 123
}
]
}{
"message": "<string>",
"code": "<string>"
}GET /leokit/analytics
Returns aggregated analytics for the authenticated client, including quote/deposit counts, top trading pairs, protocol usage, and a time-bucketed activity timeline.Authentication
RequiresApi-Key header (or api_key query parameter).
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
period | string | No | Time window: 1h, 24h (default), 7d, 30d, all |
Response Format
Status Code:200 OK
{
"period": "24h",
"generated_at": "2026-02-07T12:00:00.000Z",
"client": {
"name": "My App"
},
"summary": {
"total_quotes": 150,
"total_deposits": 45,
"conversion_rate": "30%",
"avg_response_time_ms": 340,
"near_ecosystem_fees_usd": 12.45
},
"top_pairs": [
{
"from_asset": "ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"to_asset": "BTC.BTC",
"quotes": 25,
"deposits": 10
}
],
"protocols": [
{
"name": "chainflip",
"quotes_offered": 80
},
{
"name": "thorchain",
"quotes_offered": 60
}
],
"timeline": [
{
"timestamp": "2026-02-07T00:00:00.000Z",
"quotes": 12,
"deposits": 4
},
{
"timestamp": "2026-02-07T01:00:00.000Z",
"quotes": 8,
"deposits": 2
}
]
}
Fields Reference
Summary
| Field | Description |
|---|---|
total_quotes | Number of quote requests in the period |
total_deposits | Number of deposit (swap initiation) calls |
conversion_rate | Percentage of quotes that converted to deposits |
avg_response_time_ms | Average quote response time in milliseconds |
near_ecosystem_fees_usd | NEAR-ecosystem affiliate fees attributed to your client (USD) |
Top Pairs
Returns up to 20 most-quoted asset pairs, sorted by quote count. Each pair shows how many quotes and deposits it received.Protocols
Shows how many times each protocol returned a quote offer. A single quote request may produce offers from multiple protocols.Timeline
Time-bucketed activity data. Bucket size varies by period:| Period | Bucket Size |
|---|---|
1h | 5 minutes |
24h | 1 hour |
7d | 1 day |
30d | 1 day |
all | 1 day |
Caching
Responses are cached for 30 seconds (Cache-Control: private, max-age=30).
Errors
| Status | Code | Description |
|---|---|---|
401 | INVALID_API_KEY | Missing or invalid Api-Key header |
400 | INVALID_PERIOD | period must be one of 1h, 24h, 7d, 30d, all |
500 | INTERNAL_ERROR | Server-side error while aggregating analytics |
Examples
Get 24-hour analytics (default)
curl -H "Api-Key: YOUR_API_KEY" https://api.leokit.dev/leokit/analytics
Get 7-day analytics
curl -H "Api-Key: YOUR_API_KEY" "https://api.leokit.dev/leokit/analytics?period=7d"
Get all-time analytics
curl -H "Api-Key: YOUR_API_KEY" "https://api.leokit.dev/leokit/analytics?period=all"
Authorizations
Response
Analytics for the authenticated client.