Skip to content

API Introduction

import { Aside, Tabs, TabItem } from ‘@astrojs/starlight/components’;

The analyze.rocks API allows you to programmatically access your analytics data and send events.

ServiceURLDescription
APIhttps://api.analyze.rocksDashboard & Analytics API
Ingesthttps://ingest.analyze.rocksEvent ingestion
Dashboardhttps://app.analyze.rocksWeb Dashboard

All API requests require authentication via API key:

```bash curl -X GET "https://api.analyze.rocks/api/v1/analytics/overview" \ -H "Authorization: Bearer sk_live_xxxxx" ``` ```bash curl -X GET "https://api.analyze.rocks/api/v1/analytics/overview" \ -H "X-API-Key: sk_live_xxxxx" ```
TypePrefixPermissions
Publicpk_live_Client-side tracking only
Secretsk_live_Full API access (server-side only)
PlanRequests/minBurst
Free60100
Pro300500
EnterpriseUnlimited-

Rate limit headers are included in all responses:

X-RateLimit-Limit: 300
X-RateLimit-Remaining: 299
X-RateLimit-Reset: 1704067200

All responses are JSON:

{
"success": true,
"data": { ... },
"fromCache": false,
"workspaceId": "ws_xxxxx"
}

Many endpoints return cached data for improved performance. Check the fromCache field:

{
"data": [...],
"fromCache": true,
"period": { "start": "2025-01-01", "end": "2025-01-05" }
}

Cache TTLs:

  • Overview: 5 minutes
  • Sources/Devices/Geo: 10 minutes
  • Realtime: 60 seconds

Errors return a consistent format:

{
"success": false,
"error": {
"code": "RATE_LIMIT",
"message": "Rate limit exceeded"
}
}
HTTP StatusCodeDescription
400BAD_REQUESTInvalid parameters
401UNAUTHORIZEDMissing/invalid API key
403FORBIDDENInsufficient permissions
404NOT_FOUNDResource not found
429RATE_LIMITRate limit exceeded
500INTERNAL_ERRORServer error

The API supports gzip compression. Include the Accept-Encoding header:

Terminal window
curl -X GET "https://api.analyze.rocks/api/v1/analytics/overview" \
-H "Authorization: Bearer sk_live_xxxxx" \
-H "Accept-Encoding: gzip"