API Reference

Internal API endpoints used by the OBSERVE platform. These are the same endpoints the frontend calls — useful if you want to automate refreshes, manage credentials, or integrate OBSERVE data into your own workflows.

Authentication: All endpoints require an active Supabase session cookie (obtained by signing in at /login). Unauthenticated requests return 401 Unauthorized. Subscriber-only endpoints additionally require an active Stripe subscription.

Base URL

https://www.observe.center

Data Refresh

Trigger on-demand data ingestion for platform sources.

POST/api/refresh

Run all platform ingestion pipelines in sequence

Auth
Session cookie (subscriber)
Response
{ ok: true, usgs, noaa, gdelt, crypto, fx }
Runs USGS → NOAA → CoinCap → ExchangeRate → GDELT (sequential due to GDELT rate limit). Takes 15–30s. Called by the Refresh button on intelligence pages.

Credentials (BYOK)

Manage encrypted third-party API keys stored in your account.

GET/api/credentials

List all saved credential slugs for the authenticated user

Auth
Session cookie
Response
{ credentials: [{ source_slug, has_key }] }
Never returns the actual key values — only confirms which slugs have a key set.
POST/api/credentials

Save or update an API key for a given source slug

Auth
Session cookie
Request body
{ source_slug: "newsapi", api_key: "your-key" }
Response
{ ok: true }
Keys are encrypted before storage. Supported slugs: newsapi, acled, opensky, openweathermap, perplexity.
DELETE/api/credentials

Delete a saved API key

Auth
Session cookie
Request body
{ source_slug: "newsapi" }
Response
{ ok: true }

Stripe Billing

Manage subscriptions via Stripe.

POST/api/stripe/checkout

Create a Stripe Checkout session for the Pro plan

Auth
Session cookie
Request body
{ plan: "pro" }
Response
{ url: "https://checkout.stripe.com/..." }
Redirect the user to the returned URL to complete payment.
POST/api/stripe/portal

Create a Stripe Customer Portal session to manage billing

Auth
Session cookie (subscriber)
Response
{ url: "https://billing.stripe.com/..." }
Redirect to the returned URL to manage payment method, view invoices, or cancel.
POST/api/stripe/sync-subscription

Sync subscription status from Stripe into the user profile

Auth
Session cookie
Response
{ ok: true, status: "active" | "canceled" | "none" }
Call this after returning from Stripe checkout to ensure the platform reflects the latest subscription state.

Briefings

Generate and retrieve AI intelligence briefings.

POST/api/briefings

Generate a new AI briefing using Perplexity AI

Auth
Session cookie (subscriber + Perplexity key)
Request body
{ topic?: string, region?: string }
Response
{ id, content, created_at }
Requires Perplexity API key saved in Settings → Integrations. Takes 10–30 seconds.

Auth

Authentication callback — handled automatically by Supabase.

GET/api/auth/callback

OAuth and magic link callback — exchanges code for session

Auth
None (public)
Response
Redirect to /dashboard or /reset-password
Used internally by Supabase for email confirmation and password reset flows. Do not call directly.