Authentication

How to authenticate with the Analytics Service API using JWT tokens.

Overview

All endpoints (except Health and Public Stats) require a Bearer JWT token. The tenantId is extracted from the JWT claims automatically via the @CurrentTenant() decorator.

Obtaining a JWT Token

Login via auth-svcbash
curl -X POST https://535ubezkse.execute-api.us-east-1.amazonaws.com/auth/v1/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "dev@eventzr.com",
    "password": "Password123!"
  }'

# Response:
# {
#   "data": {
#     "accessToken": "eyJhbGciOiJSUzI1NiIs...",
#     "refreshToken": "eyJhbGciOiJSUzI1NiIs...",
#     "expiresIn": 3600
#   }
# }
Use the tokenbash
export TOKEN="<access-token-from-response>"

curl -X GET https://535ubezkse.execute-api.us-east-1.amazonaws.com/analytics/v1/metrics/event/<event-id> \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json"
Refresh an expired tokenbash
curl -X POST https://535ubezkse.execute-api.us-east-1.amazonaws.com/auth/v1/refresh \
  -H "Content-Type: application/json" \
  -d '{ "refreshToken": "eyJhbGciOiJSUzI1NiIs..." }'

Test Credentials

Staging Environment Credentials

Use these credentials to test the API in the Scalar playground above.

RoleEmailPasswordTenant ID
Developerdev@eventzr.comPassword123!a0000001-...-000001
Adminadmin@eventzr.comPassword123!a0000001-...-000001
Organizerorganizer@eventzr.comPassword123!a0000001-...-000001
Partnerpartner@eventzr.comPassword123!a0000001-...-000001

JWT Claims Structure

Decoded JWT payloadjson
{
  "sub": "user-uuid",
  "tenantId": "tenant-uuid",
  "email": "user@example.com",
  "roles": ["user", "organizer", "admin"],
  "planTier": "professional",
  "iat": 1740000000,
  "exp": 1740003600
}

Standard Headers

HeaderRequiredDescription
AuthorizationYesBearer JWT token
Content-TypePOST/PUT/PATCHapplication/json
x-request-idNoRequest trace ID (UUID), auto-generated if absent
x-tenant-idRecommendedTenant UUID for explicit tenant filtering
Idempotency-KeyNoIdempotency key for write operations (24h TTL)

Response Envelope

Standard response formatjson
{
  "data": { ... },
  "error": null,
  "page": {
    "next_cursor": "eyJwYWdlIjoyLCJsaW1pdCI6MjB9",
    "has_more": true,
    "limit": 20
  },
  "meta": {
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "trace_id": "abc123",
    "tenant_id": "tenant-uuid"
  }
}

Subscription Tier Requirements

Analytics features are gated by subscription tier. Higher tiers unlock more advanced analytics capabilities.

TierAvailable Features
BASE / STUDENTBasic metrics, health endpoints, public stats endpoints
STARTUPEntity dashboards, 30-day time range, basic engagement metrics
PROComparisons, forecasts, AI insights, custom reports (5/month), trend analysis
PROMAXML predictions, scheduled reports, recommendations, unlimited reports
ENTERPRISEHeatmaps, custom SQL queries, real-time on-site analytics, all features unlocked