Skip to main content
GET
/
analytics
Per-client usage analytics
curl --request GET \
  --url https://api.leokit.dev/analytics \
  --header 'Api-Key: <api-key>'
{
  "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
    }
  ]
}

Documentation Index

Fetch the complete documentation index at: https://docs.leokit.dev/llms.txt

Use this file to discover all available pages before exploring further.

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