HTTP API
The API lives under /api/v1 on your Beacon URL. Endpoints that need a key take an
API key as a bearer token:
Authorization: Bearer bcn_…Errors come back as JSON with an error message:
| Status | Meaning |
|---|---|
400 |
Invalid query or body. issues lists what’s wrong. |
401 |
Missing, unknown or expired key. |
403 |
The key lacks the scope, or doesn’t cover the website. |
429 |
Too many requests with this key. |
Get stats
Section titled “Get stats”GET /api/v1/stats returns a website’s headline numbers. Scope: read:stats.
| Query parameter | Required | Notes |
|---|---|---|
websiteId |
yes | The website’s UUID. |
from |
no | ISO 8601 date-time. Default: 30 days before to. |
to |
no | ISO 8601 date-time. Default: now. |
curl "https://beacon.example.com/api/v1/stats?websiteId=your-website-uuid&from=2026-11-01T00:00:00Z" \ -H "Authorization: Bearer $BEACON_API_KEY"{ "websiteId": "your-website-uuid", "from": "2026-11-01T00:00:00.000Z", "to": "2026-12-06T12:00:00.000Z", "pageviews": 37512, "visitors": 12504, "visits": 16311, "bounceRate": 0.45, "avgDuration": 105}bounceRate is a fraction and avgDuration is in seconds.
Add an annotation
Section titled “Add an annotation”POST /api/v1/annotations adds a marker to the website’s chart, for example from a deploy job.
Scope: write:annotations.
| Field | Required | Notes |
|---|---|---|
websiteId |
yes | The website’s UUID. |
title |
yes | Up to 200 characters. |
description |
no | Up to 2,000 characters. |
category |
no | Up to 50 characters. Default: deploy. |
occurredAt |
no | ISO 8601 date-time with an offset. Default: now. |
curl -X POST "https://beacon.example.com/api/v1/annotations" \ -H "Authorization: Bearer $BEACON_API_KEY" \ -H "Content-Type: application/json" \ -d '{"websiteId":"your-website-uuid","title":"v2.3 deployed"}'It answers 201 with the new annotation. In GitHub Actions, run this as the last step of your
deploy job with the key in a repository secret.
GET /api/v1/badge/:websiteId.svg returns an SVG badge with the website’s all-time pageviews.
GET /api/v1/badge/:websiteId.json returns the number as JSON. No key is needed, but the
website must have an open share link.
Health
Section titled “Health”GET /api/health answers 200 when the dashboard is up. Docker uses it as a health check.
Events
Section titled “Events”Events go to the ingest service, not to /api/v1: POST to <your Beacon URL>/x/e. See
Server-side events.