Docs · Reference

REST API

A read-only HTTP API for your Statlark numbers — pull revenue, visitors and traffic sources into a script, a spreadsheet, a Slack digest, or an LLM.

The base URL is https://app.statlark.com/api/v1. Every response is JSON. Every request needs a bearer token, and every token is read-only and scoped to a single site.

Authentication

Create a token under Settings → API keys for the site you want to read. The full token (slk_…) is shown once, at creation — copy it then; Statlark stores only a hash and can’t show it again. Lost it? Revoke it and create another.

Send it in the Authorizationheader on every request. Treat it like a password: it’s meant for server-side use — don’t embed it in a web page or app you ship to users.

curl "https://app.statlark.com/api/v1/overview?site=sl_xxxx&from=2026-06-01&to=2026-07-01" \
  -H "Authorization: Bearer slk_your_token_here"

Common parameters

Every analytics endpoint takes the same three query parameters:

  • site — your site id (sl_…), the same value on your tracker snippet. Required. A token can only read the site it was created for; any other id returns 403.
  • from and to — the window, as an ISO date (YYYY-MM-DD) or full timestamp. Both required. The range is interpreted in UTC and is half-open [from, to)from is included, to is not. The window can span at most 366 days per request.

Overview

GET /api/v1/overview — the headline metrics: revenue, visitors, paying conversion and revenue-per-visitor, each with the value for the preceding equal-length period (so you can compute a delta).

{
  "site": "sl_xxxx",
  "range": { "from": "2026-06-01T00:00:00.000Z", "to": "2026-07-01T00:00:00.000Z" },
  "metrics": {
    "revenue": 4820.5,
    "previous_revenue": 3910,
    "visitors": 12840,
    "previous_visitors": 11002,
    "paying_conversion": 0.021,
    "previous_paying_conversion": 0.018,
    "revenue_per_visitor": 0.375,
    "previous_revenue_per_visitor": 0.355
  }
}

Revenue timeseries

GET /api/v1/timeseries— revenue over time, gap-filled into buckets in the site’s timezone. The optional bucket parameter is one of hour, day (default), week or month.

curl "https://app.statlark.com/api/v1/timeseries?site=sl_xxxx&from=2026-06-01&to=2026-07-01&bucket=day" \
  -H "Authorization: Bearer slk_your_token_here"
{
  "site": "sl_xxxx",
  "range": { "from": "2026-06-01T00:00:00.000Z", "to": "2026-07-01T00:00:00.000Z" },
  "bucket": "day",
  "points": [
    { "bucket_start": "2026-06-01T00:00:00.000Z", "revenue": 120 },
    { "bucket_start": "2026-06-02T00:00:00.000Z", "revenue": 0 }
  ]
}

Traffic sources

GET /api/v1/sources — your traffic sources ranked by revenue, each with visitors, revenue-per-visitor and paying conversion. The optional grouping parameter is one of channel (default), utm_source, referrer or adclick.

curl "https://app.statlark.com/api/v1/sources?site=sl_xxxx&from=2026-06-01&to=2026-07-01&grouping=channel" \
  -H "Authorization: Bearer slk_your_token_here"
{
  "site": "sl_xxxx",
  "range": { "from": "2026-06-01T00:00:00.000Z", "to": "2026-07-01T00:00:00.000Z" },
  "grouping": "channel",
  "sources": [
    {
      "source": "Organic Search",
      "visitors": 5120,
      "revenue": 2400,
      "revenue_per_visitor": 0.468,
      "paying_conversion": 0.021
    }
  ]
}

Errors

Errors come back with the matching HTTP status and a JSON body of the shape below. 401 means the token is missing, malformed or revoked; 403 means it can’t read the requested site; 400 means a parameter is missing or invalid.

{ "error": "This token can't read that site." }

Amounts are in the site’s configured currency, as major units (e.g. dollars, not cents). Want a write API to send goals, payments or identity server-side? That’s on the roadmap — this read API is the first step.