Skip to main content

Overview

World Monitor uses a hybrid authentication system that combines origin-based trust with optional API keys. The authentication strategy depends on where requests originate.

Authentication Methods

1. Trusted Browser Origins (No Key Required)

Requests from trusted browser origins do not require an API key: Production Origins:
  • https://worldmonitor.app
  • https://*.worldmonitor.app (subdomains)
  • https://worldmonitor-*-elie-*.vercel.app (Vercel previews)
Development Origins (NODE_ENV !== ‘production’):
  • http://localhost:*
  • http://127.0.0.1:*
Desktop App Origins:
  • https://tauri.localhost:*
  • https://*.tauri.localhost:*
  • tauri://localhost
  • asset://localhost

2. Desktop Applications (API Key Required)

Desktop applications always require a valid API key, even from tauri://localhost origins.
string
required
Your World Monitor API key. Required for desktop apps and third-party integrations.

3. Third-Party Applications (API Key Required)

Requests from unknown origins or without an Origin header must provide a valid API key.

How to Authenticate

Browser Requests (Trusted Origins)

No authentication needed for same-origin requests:

Desktop App Requests

Include the X-WorldMonitor-Key header:

Third-Party Integration

Include the API key header:

CORS Configuration

The API implements Cross-Origin Resource Sharing (CORS) with strict origin validation.

Allowed Origins

CORS headers are set based on the request origin:
  • Trusted origins: Access-Control-Allow-Origin reflects the request origin
  • Untrusted origins: Request is rejected with 403 Forbidden
  • Missing origin: Falls back to https://worldmonitor.app

CORS Headers

All responses include:

Preflight Requests

The API handles OPTIONS preflight requests:
Response:

Authentication Flow

The API processes requests in this order:
  1. Origin Check: Validate request origin against allowed patterns
    • If origin is disallowed → 403 Forbidden
    • If origin is missing → Continue to key validation
  2. API Key Validation:
    • Desktop origin: API key required
    • Trusted browser origin: API key optional (if provided, must be valid)
    • Unknown origin: API key required
    • No origin + no key: 401 Unauthorized
  3. Rate Limiting: Check IP-based rate limits (see Rate Limits)
  4. Request Processing: Route to appropriate handler

Error Responses

Invalid API Key

HTTP Status: 401 Unauthorized

Missing API Key (Required)

HTTP Status: 401 Unauthorized

Desktop Access Without Key

HTTP Status: 401 Unauthorized

Origin Not Allowed

HTTP Status: 403 Forbidden

Security Best Practices

Never expose your API key in client-side code, public repositories, or browser JavaScript. API keys should only be used in server-side or desktop applications.

Key Management

  • Environment Variables: Store keys in .env files (never commit to git)
  • Rotation: Rotate keys periodically
  • Scoping: Use different keys for different environments (dev, staging, prod)

Origin Validation

The API uses strict origin validation:
  • Origin header from TCP connection (x-real-ip from Vercel/Cloudflare)
  • Referer header as fallback for same-origin requests
  • Client-settable headers like x-forwarded-for are ignored

Obtaining an API Key

API keys are currently issued manually. To request an API key:
  1. Contact the World Monitor team
  2. Provide your use case and expected request volume
  3. Receive your API key via secure channel
Valid keys are configured in the WORLDMONITOR_VALID_KEYS environment variable (comma-separated list).

Next Steps

Rate Limits

Understand rate limiting and quotas

API Reference

Explore available endpoints