REST API for querying analytics data and managing your Sealmetrics account programmatically.
At a glance
Quick Start
GET/stats/overview
curl -X GET "https://my.sealmetrics.com/api/v1/stats/overview?site_id=YOUR_SITE_ID&period=7d" \
-H "X-API-Key: sm_your_api_key_here"
Response:
{
"success": true,
"data": {
"date_range": {
"start_date": "2025-01-01",
"end_date": "2025-01-07",
"days": 7
},
"traffic": {
"entrances": 12543,
"engaged_entrances": 7234,
"page_views": 28976,
"microconversions": 892,
"conversions": 156,
"revenue": "12450.00",
"bounce_rate": 42.3,
"pages_per_session": 2.31
},
"conversions": {
"conversions": 156,
"revenue": "12450.00",
"microconversions": 892,
"conversion_rate": 1.24,
"average_order_value": "79.81"
}
},
"meta": {},
"timestamp": "2025-01-08T00:00:00Z"
}
API Sections
Analytics Data
| Endpoint | Method | Description |
|---|
/stats/overview | GET | Dashboard overview with all key metrics |
/stats/pages | GET | Page metrics with pagination |
/stats/mediums | GET | Traffic by UTM medium |
/stats/sources | GET | Traffic by UTM source |
/stats/campaigns | GET | Traffic by UTM campaign |
/stats/terms | GET | Traffic by UTM term |
/stats/contents | GET | Traffic by UTM content |
/stats/referrers | GET | Referrer domain traffic |
/stats/geo/countries | GET | Geographic breakdown |
/stats/devices | GET | Device, browser, OS breakdown |
Multi-Site Aggregate (superadmin)
| Endpoint | Method | Description |
|---|
/stats/aggregate/overview | GET | Portfolio overview across multiple sites |
/stats/aggregate/pages | GET | Pages aggregated across sites |
/stats/aggregate/mediums | GET | UTM mediums aggregated across sites |
/stats/aggregate/sources | GET | UTM sources aggregated across sites |
/stats/aggregate/geo/countries | GET | Countries aggregated across sites |
/stats/aggregate/devices | GET | Devices aggregated across sites |
/stats/aggregate/landing-pages | GET | Landing pages aggregated across sites |
/stats/aggregate/conversions | GET | Conversions by type across sites |
See Multi-Site Aggregate Stats.
Billing
| Endpoint | Method | Description |
|---|
/billing/plans | GET | List pricing plans (public) |
/billing/overview | GET | Billing overview (subscription, usage, payment method) |
/billing/checkout | POST | Create Stripe Checkout session |
/billing/portal | POST | Create Stripe customer portal session |
/billing/subscription | GET | Subscription details |
/billing/subscription/cancel | POST | Schedule cancellation at period end |
/billing/subscription/resume | POST | Undo a scheduled cancellation |
/billing/subscription/history | GET | Subscription audit log |
/billing/invoices | GET | List invoices |
/billing/usage/current | GET | Current period event usage |
/billing/usage/history | GET | Past period event usage |
/billing/overage-status | GET | Overage history and forgiveness status |
/billing/coupons/validate | POST | Validate a discount code |
/billing/accounting-email | GET, PUT | Accounting email for invoices |
/billing/seal-ai/* | POST | Seal AI Private add-on (subscribe, unsubscribe, token packs) |
See Billing API.
Site Management
| Endpoint | Method | Description |
|---|
/sites | GET, POST | List and create sites |
/sites/{id} | GET, PATCH, DELETE | Manage specific site |
/sites/{id}/domains | GET, POST, DELETE | Authorized domains |
/sites/{id}/utm-mappings | GET, POST, PATCH, DELETE | UTM parameter mappings |
/sites/{id}/pixel | GET | Get tracking pixel code |
/sites/{id}/pixel/status | GET | Check pixel installation |
Organizations
| Endpoint | Method | Description |
|---|
/organizations | GET, POST | List and create organizations |
/organizations/{slug} | GET, PATCH, DELETE | Manage specific organization |
/organizations/{slug}/members | GET, POST, PATCH, DELETE | Team member management |
/organizations/{slug}/sites | GET | List organization sites |
/organizations/{slug}/invitations | GET, POST, DELETE | Manage invitations |
Authentication
| Endpoint | Method | Description |
|---|
/auth/token | POST | Login with email/password |
/auth/refresh | POST | Refresh access token |
/auth/logout | POST | Logout current session |
/auth/me | GET | Get current user info |
/auth/sessions | GET, DELETE | Manage active sessions |
/auth/forgot-password | POST | Request password reset |
/auth/reset-password | POST | Reset password with token |
API Tokens
| Endpoint | Method | Description |
|---|
/api-tokens | GET, POST | List and create API tokens |
/api-tokens/{id} | GET, DELETE | Get or revoke token |
/api-tokens/scopes | GET | List available scopes |
OAuth 2.1 (third-party apps and AI assistants)
| Endpoint | Method | Description |
|---|
/.well-known/oauth-authorization-server | GET | RFC 8414 discovery metadata (served at the host root) |
/oauth/register | POST | Dynamic client registration (RFC 7591) |
/oauth/authorize | GET | Start the authorization code + PKCE flow |
/oauth/token | POST | Exchange a code, or refresh a token |
/oauth/revoke | POST | Revoke a token (RFC 7009) |
/oauth/connections | GET | List the user's active grants |
/oauth/connections/{grant_id} | DELETE | Revoke one grant |
See OAuth 2.1.
Provisioning
| Endpoint | Method | Description |
|---|
/provision | POST | Create a free-tier account headlessly (X-Provision-Key required) |
See Provisioning.
Segments
| Endpoint | Method | Description |
|---|
/segments | GET, POST | List and create saved segments |
/segments/{id} | GET, PUT, DELETE | Manage specific segment |
/segments/{id}/duplicate | POST | Duplicate a segment |
Webhooks
| Endpoint | Method | Description |
|---|
/webhooks | GET, POST | List and create webhook endpoints |
/webhooks/{id} | GET, PATCH, DELETE | Manage specific webhook |
/webhooks/{id}/test | POST | Send test webhook |
/webhooks/{id}/rotate-secret | POST | Rotate webhook secret |
/webhooks/{id}/deliveries | GET | List delivery history |
/webhooks/event-types | GET | List available event types |
Alerts
| Endpoint | Method | Description |
|---|
/alerts/rules | GET, POST | List and create alert rules |
/alerts/rules/{id} | GET, PATCH, DELETE | Manage alert rule |
/alerts/rules/{id}/test | POST | Test alert rule |
/alerts/history | GET | Get alert history |
/alerts/stats | GET | Get alert statistics |
Bulk Exports
| Endpoint | Method | Description |
|---|
/exports | GET, POST | List and create export jobs |
/exports/{id} | GET, DELETE | Get or cancel export |
/exports/estimate | POST | Estimate export size |
/exports/stream | POST | Stream small export directly |
/exports/download/{token} | GET | Download export file |
BigQuery Integration
| Endpoint | Method | Description |
|---|
/integrations/bigquery | GET, POST, PATCH, DELETE | Configure BigQuery integration |
/integrations/bigquery/setup | POST | Create BigQuery tables |
/integrations/bigquery/sync | POST | Trigger manual sync |
/integrations/bigquery/backfill | POST | Backfill historical data |
/integrations/bigquery/logs | GET | List sync logs |
/integrations/bigquery/schema | GET | Get table schema |
IP Allowlist
| Endpoint | Method | Description |
|---|
/ip-allowlist/settings | GET, PUT | Manage allowlist settings |
/ip-allowlist/patterns | GET, POST | List and add IP patterns |
/ip-allowlist/patterns/{id} | PATCH, DELETE | Manage specific pattern |
/ip-allowlist/patterns/bulk | POST | Add multiple patterns |
/ip-allowlist/check | POST | Validate an IP address |
/ip-allowlist/export | GET | Export patterns |
/ip-allowlist/import | POST | Import patterns |
/ip-allowlist/audit | GET | Access audit log |
Common Query Parameters
These parameters are available on most analytics endpoints:
| Parameter | Type | Description | Example |
|---|
site_id | string | Required. Site identifier | my-site |
period | string | Time period shortcut | today, 7d, 30d, 90d |
start_date | date | Start date (YYYY-MM-DD) | 2025-01-01 |
end_date | date | End date (YYYY-MM-DD) | 2025-01-31 |
segment | string | Apply saved segment filters | paid-traffic |
country | string | Filter by country: ISO-3166-1 alpha-2 code or Unknown — see below | ES, US, Unknown |
utm_source | string | Filter by UTM source | google |
utm_medium | string | Filter by UTM medium | cpc |
utm_campaign | string | Filter by UTM campaign | brand-2025 |
compare | string | Comparison mode | previous, yoy |
page | int | Page number (default: 1) | 1 |
page_size | int | Results per page (default: 50) | 100 |
sort_by | string | Sort field | entrances, revenue |
sort_order | string | Sort direction | asc, desc |
Filtering by country
country takes an ISO-3166-1 alpha-2 code (ES, US, DE, case-insensitive) or the literal Unknown, and never a country name. Any other value returns 422 validation_error naming the parameter, for example country=Spain:
{
"error": {
"code": "validation_error",
"message": "Request validation failed",
"detail": [
{"field": "query.country", "message": "String should match pattern '^(?i:[a-z]{2}|unknown)$'", "type": "string_pattern_mismatch"}
]
}
}
The check is on format: two letters, or Unknown. A well-formed code with no traffic, such as XX or a country that never visited, returns empty results, not an error.
Earlier, an invalid value was ignored by some endpoints (they returned unfiltered totals) and caused a 500 on others. On endpoints that accept the parameter repeated (?country=ES&country=FR), each value is validated, and a malformed one is no longer dropped silently.
Unknown is the value stored when the visitor's browser timezone maps to no country. The country always comes from the timezone, never from the IP address; see country detection. country=Unknown isolates that traffic. To see which codes have traffic, call GET /stats/geo/countries.
device_type follows the same rule: desktop, mobile or tablet (case-insensitive), and any other value returns 422.
Period Shortcuts
| Value | Description |
|---|
today | Current day |
yesterday | Previous day |
7d | Last 7 days |
30d | Last 30 days |
90d | Last 90 days |
12m | Last 12 months |
this_week | Current week |
last_week | Previous week |
this_month | Current month |
last_month | Previous month |
this_quarter | Current quarter |
last_quarter | Previous quarter |
this_year | Current year |
last_year | Previous year |
wtd | Week to date |
mtd | Month to date |
qtd | Quarter to date |
ytd | Year to date |
All successful responses wrap data in a data field:
Paginated responses include pagination metadata:
{
"data": [...],
"total": 156,
"page": 1,
"page_size": 50,
"has_next": true,
"has_prev": false
}
Error Responses
All errors return JSON with this structure:
{
"error": {
"code": "error_code",
"message": "Human-readable description"
},
"request_id": "ae817c5b-82df-430f-83e6-10c937e4e5e4"
}
error.code is stable — branch on it. error.message is for humans and may change. request_id is also returned in the X-Request-ID header.
| HTTP Code | Error Code | Description |
|---|
| 400 | bad_request | Invalid parameters |
| 401 | unauthorized | Missing or invalid authentication |
| 403 | forbidden | Valid auth but insufficient permissions |
| 404 | not_found | Resource does not exist |
| 409 | conflict | Resource already exists |
| 422 | validation_error | Schema validation failed; error.detail lists the fields |
| 429 | rate_limit_exceeded | Too many requests — honour Retry-After |
| 500 | internal_error | Server error |
| 503 | database_unavailable | Temporary — honour Retry-After |
Full list, including which codes are retryable: Error codes.
Documentation
- For AI Agents - Everything an LLM or agent needs, on one page
- Interactive API Reference - Every endpoint, generated from the OpenAPI spec
- Quick Start - First API call in 5 minutes
- Authentication - API keys and JWT tokens
- OAuth 2.1 - Connect third-party apps and AI assistants to other people's accounts
- Provisioning - Create a free-tier account headlessly
- Error codes - Every
error.code, and what to retry
- Stats Endpoints - Analytics data endpoints
- Multi-Dimensional Query - Dimensions, metrics and filters in one request
- Batch API - Up to 50 queries per request
- Multi-Site Aggregate Stats - Portfolio metrics across multiple sites
- Billing API - Plans, subscriptions, invoices, usage, Seal AI Private add-on
- Sites - Site management
- Organizations - Team management
- Segments - Saved segments
- Exports - Asynchronous bulk data exports
- Webhooks - Webhook subscriptions
- BigQuery Integration - Export to Google BigQuery
- IP Allowlist - Restrict access by IP
- Rate Limits - Limits per plan tier
- API FAQ - Common integration questions (
account_id vs site_id, event-level conversions, JWT scopes)