Read analytics
method
GET
host
strait.
version
/v1
resource
/
GET /v1/analytics
Auth: secret key as Authorization: Bearer. Server-side only.
Request
Taps, app opens, installs, conversions and revenue for your workspace in [from, to), for every link or one, optionally grouped by day, channel, link, platform, campaign, country or one of the five UTM tags. The numbers use the same definitions as the dashboard. Each item counts at its own time (a tap at its tap time, an install at its install time); days are UTC. Secret key only (a publishable key gets 401). At most 92 days per call and 30 calls a minute per workspace (429 with Retry-After).
Parameters
fromstring query- Inclusive start: ISO date (2026-10-01, UTC), ISO date-time or epoch ms. Default: 30 days before
to. tostring query- Exclusive end, same formats. Default: now.
linkstring query- Only this link: an active link's slug, e.g.
summer. group"none" | "day" | "channel" | "link" | "platform" | "campaign" | "country" | "utm_source" | "utm_medium" | "utm_campaign" | "utm_term" | "utm_content" | "app_version" | "sdk_version" query- Split the numbers into rows. Default none (totals only).
campaignis the link's campaign (as in the dashboard).countryis the visitor's country from their network address (2-letter code; taps since 5 Nov 2026).utm_source,utm_medium,utm_campaign,utm_term,utm_contentare the tap's UTM tags: the ones on the tapped link (?utm_medium=story), else the ones in its destination URL (taps since 5 Nov 2026; utm_source as tagged, wherechannelis cleaned and also uses the app or site the tap came from). App opens, installs and conversions take the country and UTM tags of the tap they came from.app_versionandsdk_versionare the app's and the Strait SDK's version an app open or install itself reported (appVersion/sdkVersion, accepted since 5 Nov 2026 from SDKs that send them); taps and conversions have no version, so they count undernull, as do opens that sent none.
Response
- 200 Totals, plus one row per group value (biggest first; by date for group=day).
rowsis empty for group=none. - 400 Bad from / to (or a range over 92 days), unknown group, malformed link
- 401 Missing or invalid secret key, or a publishable key
- 404 No active link with this slug in the key's workspace
- 429 Over 30 calls a minute for this workspace
curl -X GET https://strait.link/v1/analytics \
-H "Authorization: Bearer $SECRET_KEY"const res = await fetch('https://strait.link/v1/analytics', {
headers: { Authorization: `Bearer ${process.env.SECRET_KEY}` },
});
const data = await res.json();
console.log(res.status, data);import os
import requests
res = requests.get(
"https://strait.link/v1/analytics",
headers={"Authorization": f"Bearer {os.environ['SECRET_KEY']}"},
)
print(res.status_code, res.json())<?php
// Plain PHP with ext-curl, no packages. In Laravel, Http::withToken($secretKey)->get($url) sends the same request.
$ch = curl_init('https://strait.link/v1/analytics');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SECRET_KEY'),
],
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
echo $status, PHP_EOL;
print_r(json_decode($response, true));import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
// Java 17+, java.net.http only (no dependencies).
public class Main {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder(URI.create("https://strait.link/v1/analytics"))
.header("Authorization", "Bearer " + System.getenv("SECRET_KEY"))
.GET()
.build();
HttpResponse<String> res = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(res.statusCode() + " " + res.body());
}
}package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest(http.MethodGet, "https://strait.link/v1/analytics", nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("SECRET_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(res.StatusCode, string(data))
}The response, printed
{
"from": "2026-09-01T00:00:00.000Z",
"to": "2026-10-01T00:00:00.000Z",
"timezone": "UTC",
"link": null,
"group": "channel",
"totals": {
"taps": 1840,
"billableTaps": 1795,
"appOpens": 1210,
"installs": 312,
"conversions": 96,
"revenue": {
"INR": 48210
}
},
"rows": [
{
"key": "whatsapp",
"taps": 1320,
"billableTaps": 1290,
"appOpens": 905,
"installs": 241,
"conversions": 71,
"revenue": {
"INR": 35400
}
},
{
"key": "instagram",
"taps": 380,
"billableTaps": 368,
"appOpens": 221,
"installs": 52,
"conversions": 19,
"revenue": {
"INR": 10010
}
},
{
"key": "direct",
"taps": 140,
"billableTaps": 137,
"appOpens": 84,
"installs": 19,
"conversions": 6,
"revenue": {
"INR": 2800
}
}
]
}