Sign up

API reference

API playground

Pick an endpoint, set its parameters and send it with an account token (mr_…) or a website's secret key (ana_sec_…). Signed in, you can also read reports for your own websites without a key. Every request goes to /api/v1 on this site and returns live data.

Endpoint

GET/api/v1/stats/traffic

Visitors, pageviews, sessions, bounce rate and revenue: totals, time series and top breakdowns.

Site secret keyAccount token · read scopeDashboard sessionReference

Authentication

Create one in Settings → API & MCP (token) or the website's settings (secret key).

Your key stays in this browser tab (memory only) and is sent only to /api/v1 on this site, as an Authorization header. It is never added to the URL or the code samples. Don't share your screen, record or hand over this tab while a key is entered, and prefer a read-only token.

Parameters

Period

Start, ISO timestamp with time zone. Required unless range=all.

End (exclusive), ISO timestamp with time zone. Required unless range=all.

all: every retained day instead of from/to.

Start of a previous period, ISO timestamp before from: adds the comparison line to the chart.

More optionsgranularity, time zone, currency, filters

Chart interval. Hourly becomes daily for ranges over three days.

IANA time zone for calendar grouping (default UTC).

Three-letter currency for revenue (default: the site's reporting currency). Other currencies are converted at ECB daily rates.

Up to six visitor filters as JSON, e.g. [{"dim":"country","op":"is","values":["US"]}].

Start of the comparison window (same length as the range, before from): every change figure compares with it. Default: the window right before.

1 bypasses the short report cache.

Sent from your browser to this site's /api/v1.

Response

Send a request to see the response here.

Code

terminal
curl --request GET \
  --url 'https://metricraven.com/api/v1/stats/traffic?from=2026-10-27T00%3A00%3A00Z&to=2026-11-02T22%3A46%3A18Z' \
  --header "Authorization: Bearer $METRICRAVEN_SECRET_KEY"

Samples read the key from METRICRAVEN_TOKEN or METRICRAVEN_SECRET_KEY; run them on your server, never in browser code.

Which key to use

  • Account token: reports, settings and account endpoints across your websites. Add the website ID; the token's scopes (read, visitors, write) decide what it can do. Team members and your email preferences act as you, so they need a token, never the secret key.
  • Site secret key: one website, including server tracking (events, payments, identify, crawlers) and deleting a person's data.
  • Signed in: read-only requests with your dashboard session. Writes always need a key and an explicit confirmation.

Keeping your key safe

  • The key is kept in memory, or in this tab's sessionStorage if you tick Keep for this tab. It is sent only as an Authorization header and never added to the page URL or the code samples.
  • Don't share your screen or hand over the tab while a key is entered. Use Clear when you're done.
  • Prefer a read-only token for exploring; revoke it in Settings → API & MCP if it may have leaked.