Get video analytics
GET/api/video/:id/analytics
Fetch view count, watch time, and engagement metrics for a video. Query parameters:
- period (string) - Time range: "7d", "30d", "90d", or "all" (default: "30d")
- timezone (string) - IANA timezone for date grouping (default: "UTC")
Examples
curl "https://flare.link/api/video/VIDEO_ID/analytics?period=30d" \
-H "Authorization: Bearer flr_pat_..."const res = await fetch(
"https://flare.link/api/video/VIDEO_ID/analytics?period=30d",
{ headers: { Authorization: "Bearer flr_pat_..." } }
);
const data = await res.json();
console.log(data.analytics);import requests
res = requests.get(
"https://flare.link/api/video/VIDEO_ID/analytics",
headers={"Authorization": "Bearer flr_pat_..."},
params={"period": "30d"}
)
print(res.json())require "net/http"
uri = URI("https://flare.link/api/video/VIDEO_ID/analytics?period=30d")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer flr_pat_..."
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.bodypackage main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://flare.link/api/video/VIDEO_ID/analytics?period=30d", nil)
req.Header.Set("Authorization", "Bearer flr_pat_...")
resp, _ := http.DefaultClient.Do(req)
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}<?php
$ch = curl_init("https://flare.link/api/video/VIDEO_ID/analytics?period=30d");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer flr_pat_..."]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;using System.Net.Http.Headers;
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "flr_pat_...");
var res = await client.GetAsync("https://flare.link/api/video/VIDEO_ID/analytics?period=30d");
var body = await res.Content.ReadAsStringAsync();Expected response
{
"success": true,
"analytics": {
"videoId": "VIDEO_ID",
"period": "30d",
"totalViews": 1542,
"uniqueViewers": 892,
"totalWatchTimeSeconds": 48250,
"averageWatchPercent": 68.4,
"completionRate": 42.1,
"dailyViews": [
{ "date": "2025-01-01", "views": 45 },
{ "date": "2025-01-02", "views": 62 }
]
}
}