Skip to main content
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
{
  "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

Requires Api-Key header (or api_key query parameter).

Request Parameters

ParameterTypeRequiredDescription
periodstringNoTime 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

FieldDescription
total_quotesNumber of quote requests in the period
total_depositsNumber of deposit (swap initiation) calls
conversion_ratePercentage of quotes that converted to deposits
avg_response_time_msAverage quote response time in milliseconds
near_ecosystem_fees_usdNEAR-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:
PeriodBucket Size
1h5 minutes
24h1 hour
7d1 day
30d1 day
all1 day

Caching

Responses are cached for 30 seconds (Cache-Control: private, max-age=30).

Errors

StatusCodeDescription
401INVALID_API_KEYMissing or invalid Api-Key header
400INVALID_PERIODperiod must be one of 1h, 24h, 7d, 30d, all
500INTERNAL_ERRORServer-side error while aggregating analytics
See the error codes catalog for the full list.

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

Api-Key
string
header
required

Demo API-Key (Sandbox): 7037d2b3-9c76-4f62-b730-c544f7570fa4

Query Parameters

period
enum<string>
default:24h
Available options:
1h,
24h,
7d,
30d,
all

Response

Analytics for the authenticated client.

period
enum<string>
required
Available options:
1h,
24h,
7d,
30d,
all
generated_at
string<date-time>
required
client
object
required
summary
object
required
top_pairs
object[]
required
protocols
object[]
required
timeline
object[]
required