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.
Base URLs
Section titled “Base URLs”| Service | URL | Description |
|---|---|---|
| API | https://api.analyze.rocks | Dashboard & Analytics API |
| Ingest | https://ingest.analyze.rocks | Event ingestion |
| Dashboard | https://app.analyze.rocks | Web Dashboard |
Authentication
Section titled “Authentication”All API requests require authentication via API key:
API Key Types
Section titled “API Key Types”| Type | Prefix | Permissions |
|---|---|---|
| Public | pk_live_ | Client-side tracking only |
| Secret | sk_live_ | Full API access (server-side only) |
Rate Limits
Section titled “Rate Limits”| Plan | Requests/min | Burst |
|---|---|---|
| Free | 60 | 100 |
| Pro | 300 | 500 |
| Enterprise | Unlimited | - |
Rate limit headers are included in all responses:
X-RateLimit-Limit: 300X-RateLimit-Remaining: 299X-RateLimit-Reset: 1704067200Response Format
Section titled “Response Format”All responses are JSON:
{ "success": true, "data": { ... }, "fromCache": false, "workspaceId": "ws_xxxxx"}Caching
Section titled “Caching”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
Error Handling
Section titled “Error Handling”Errors return a consistent format:
{ "success": false, "error": { "code": "RATE_LIMIT", "message": "Rate limit exceeded" }}| HTTP Status | Code | Description |
|---|---|---|
| 400 | BAD_REQUEST | Invalid parameters |
| 401 | UNAUTHORIZED | Missing/invalid API key |
| 403 | FORBIDDEN | Insufficient permissions |
| 404 | NOT_FOUND | Resource not found |
| 429 | RATE_LIMIT | Rate limit exceeded |
| 500 | INTERNAL_ERROR | Server error |
Compression
Section titled “Compression”The API supports gzip compression. Include the Accept-Encoding header:
curl -X GET "https://api.analyze.rocks/api/v1/analytics/overview" \ -H "Authorization: Bearer sk_live_xxxxx" \ -H "Accept-Encoding: gzip"Next Steps
Section titled “Next Steps”- Authentication – Detailed auth guide
- Events API – Send events server-side
- Analytics API – Query your data