S
ScreamUp Developer & API Portal OpenAPI 3.1 • v1.0 k ≥ 5 Privacy Enforced
Download OpenAPI YAML

ScreamUp Public & Corporate Aggregate API

ScreamUp transforms anonymous, ephemeral 15-second emotional voice releases into privacy-preserving, civic and regional emotional pulse intelligence. The Public Aggregate API (/v1) exposes real-time H3 hexagonal frustration hotspots without ever storing or exposing consumer identity, raw audio, transcripts, or exact GPS coordinates.

Zero Consumer Identity

No consumer login, signup, email, phone number, or user profile exists in the ScreamUp architecture.

H3 Resolution 7 Spatial Cells

Coordinates are converted transiently at submission into Uber H3 resolution 7 cells (~5.16 km²) and discarded.

Hard k ≥ 5 Threshold

Cells with fewer than 5 completed screams inside the active rolling time window are strictly suppressed.

OpenAPI 3.1 Contract

Generated directly from backend/openapi/public-v1.yaml. Internal operational routes are strictly isolated.

2. Getting Started

All public aggregate endpoints are served over HTTPS from the ScreamUp Cloudflare Worker edge network. Every response includes a correlation header X-Request-ID and strict security headers (Cache-Control: no-store, X-Content-Type-Options: nosniff).

Environment Base URL Authentication
Development / Public Sandbox https://screamup-api.shared-backend.workers.dev Unauthenticated (Public Aggregate Read)
Corporate B2B Intelligence (Phase D2) https://screamup-api.shared-backend.workers.dev/v1 Authorization: Bearer sk_live_su_<key>
curl -s "https://screamup-api.shared-backend.workers.dev/v1/hotspots?time_window=24h" \
  -H "Accept: application/json"

3. Architecture Concepts

H3 Resolution 7 Hexagonal Indexing

ScreamUp never persists raw latitude or longitude in Cloudflare D1. When a user optionally grants foreground location at the moment of analysis, the Worker maps the coordinate to an H3 resolution 7 index (e.g., 8760a24b3ffffff) covering approximately 5.16 km² and immediately discards the raw coordinates.

Active Rolling Time Windows

Hotspot queries require evaluating events strictly within one of the four supported rolling windows. Historical lifetime events outside the requested window never cause a sparse cell to appear active:

Query Value Window Duration Consumer UI Label Default
1hPast 60 Minutes (3,600,000 ms)Past 60mYes (Default)
6hPast 6 HoursPast 6hNo
24hPast 24 HoursPast 24hNo
7dPast 7 DaysPast 7dNo

Scream Score vs. Hotspot Intensity

Frozen Formula Governance: Individual scream analysis computes overall_score = round(0.40*F + 0.30*I + 0.15*Q + 0.15*C). For geographic cells, the conceptual Hotspot Score formula (0.45F + 0.25I + 0.15V + 0.15C) leaves velocity/volume parameter V undefined pending an Approved Product Decision Record (PDR). Therefore, hotspot_score is explicitly returned as null, and visual map intensity is driven by average_frustration (0..100).

4. Authentication

Layer 1 (Public V1 Aggregate Endpoints): GET /health and GET /v1/hotspots are readable without authentication under standard IP/edge rate limits.

Layer 2 (Corporate Developer Portal — Phase D2 Foundation): B2B research and civic partners authenticate using scoped Bearer API keys:

Authorization: Bearer sk_live_su_4f8b92a1e7c04d3a9b8e112233445566

Corporate API keys are displayed only once at creation, stored exclusively as SHA-256 hashes (key_hash) with a visible prefix (key_prefix), and can be rotated or revoked immediately without affecting anonymous consumer access.

5. Rate Limits

Tier / Surface Rate Limit Burst Allowance Behavior on Exceed
Public Anonymous Hotspot Read (GET /v1/hotspots) 60 requests / minute 15 requests HTTP 429 RATE_LIMITED
Corporate Sandbox Key (hotspots:read) 120 requests / minute 30 requests HTTP 429 RATE_LIMITED

6. Error Catalog & Retry Semantics

All error responses use the canonical ApiError envelope containing code, human-safe message, and request_id. Stack traces, SQL queries, and upstream secrets are never leaked.

HTTP Status Error Code Retryable? Developer Action
400 INVALID_TIME_WINDOW No Use one of the supported rolling windows: 1h, 6h, 24h, or 7d.
400 INVALID_VIEWPORT No Supply all four bounds (min_lat, max_lat, min_lng, max_lng) within valid WGS84 ranges with min_lat ≤ max_lat.
400 INVALID_LIMIT No Pass a positive integer between 1 and 500 for limit.
404 NOT_FOUND No Verify the endpoint path matches /health or /v1/hotspots.
405 METHOD_NOT_ALLOWED No Use HTTP GET for health and hotspot queries.
429 RATE_LIMITED Yes Apply exponential backoff with jitter (e.g., 2s, 4s, 8s) before retrying.
500 INTERNAL_ERROR Yes Retry with exponential backoff and include request_id if contacting support.

7. Public API Reference

GET /health operationId: getSystemHealth

Verifies service health and returns the active API contract version.

{
  "status": "HEALTHY",
  "service": "screamup-api",
  "version": "1.0"
}
GET /v1/hotspots operationId: listQualifyingHotspots

Returns qualifying H3 resolution 7 cells with at least 5 completed screams (k ≥ 5) inside the requested time_window (1h, 6h, 24h, 7d) and optional viewport bounding box.

{
  "time_window": "24h",
  "time_window_start_ms": 1760467200000,
  "time_window_end_ms": 1760553660000,
  "total_qualifying_cells": 1,
  "hotspots": [
    {
      "h3_index": "8760a24b3ffffff",
      "center": { "latitude": 19.07609, "longitude": 72.877426 },
      "polygon": [
        { "latitude": 19.089112, "longitude": 72.879814 },
        { "latitude": 19.081428, "longitude": 72.891342 },
        { "latitude": 19.068406, "longitude": 72.888954 },
        { "latitude": 19.063068, "longitude": 72.875038 },
        { "latitude": 19.070752, "longitude": 72.86351 },
        { "latitude": 19.083774, "longitude": 72.865898 }
      ],
      "event_count": 6,
      "scream_count": 6,
      "average_frustration": 78,
      "average_intensity": 74,
      "average_confidence": 86,
      "dominant_category": "TRAFFIC_TRANSIT",
      "time_window": "24h",
      "updated_epoch_ms": 1760553120000,
      "hotspot_score": null
    }
  ]
}

8. H3 Hotspots & Emotional Intensity Scale

Each qualifying hotspot object provides its H3 resolution 7 index, centroid coordinate, 6-vertex hexagon boundary polygon, aggregate counts, dominant problem category, and emotional averages.

Average Frustration Intensity Band Visual Hex Color Interpretation
0 – 25CALM#38BDF8 (Calm Cyan)Low ambient frustration
26 – 55MODERATE#FFB020 (Warm Amber)Noticeable localized friction
56 – 80HIGH#FF6B4A (Vibrant Coral)Elevated regional frustration
81 – 100EXTREME#FF2E54 (Electric Crimson)Peak collective emotional release

9. Canonical Data Schemas

Defined in backend/openapi/public-v1.yaml:

  • HealthResponse: { status: "HEALTHY", service: "screamup-api", version: "1.0" }
  • HotspotListResponse: { time_window, time_window_start_ms, time_window_end_ms, total_qualifying_cells, hotspots: Hotspot[] }
  • Hotspot: { h3_index, center: GeoPoint, polygon: GeoPoint[6], event_count (≥5), scream_count (≥5), average_frustration (0..100), average_intensity (0..100), average_confidence (0..100), dominant_category, time_window, updated_epoch_ms, hotspot_score: null }
  • ProblemCategoryCode: TRAFFIC_TRANSIT | CIVIC_INFRASTRUCTURE | WORK_CAREER | PUBLIC_SERVICES | ENVIRONMENT_WEATHER | DIGITAL_TECH | GENERAL_VENT | UNCATEGORIZED
  • ApiError: { code, message, request_id, error: { code, message, request_id } }

10. Multi-Language Code Examples

curl -X GET "https://screamup-api.shared-backend.workers.dev/v1/hotspots?time_window=24h&min_lat=18.85&max_lat=19.35&min_lng=72.70&max_lng=73.10" \
  -H "Accept: application/json" \
  -H "X-Request-ID: req_client_demo_01"

11. Privacy & k-Anonymity Guarantee

Mathematical & Architectural Privacy by Design:
  • Zero Raw Audio Persistence: Uploaded audio buffers are processed in Worker memory and overwritten with zeros (buffer.fill(0)) inside a finally block.
  • Zero Exact Coordinates: Only H3 resolution 7 cell identifiers are stored in D1.
  • SQL-Enforced k ≥ 5 Suppression: HAVING COUNT(*) ≥ 5 is enforced before any cell leaves the database. Cells with 1–4 screams are invisible publicly.

12. Acceptable Use Policy

Consumers of the ScreamUp Aggregate API must never attempt to de-anonymize, correlate, or combine H3 aggregate hotspot cells with external individual-level datasets to infer the identity or location of any individual person.

13. Versioning Policy

All public endpoints are versioned under /v1/*. Additive non-breaking fields may be introduced in minor releases; any breaking contract change will be published under /v2/* with at least a 90-day deprecation window.

14. Changelog

v1.0.0 (2026-10-16) — Initial OpenAPI 3.1 public release of GET /health, GET /v1/hotspots, and GET /v1/geo/hotspots with H3 resolution 7 and k ≥ 5 privacy enforcement.

15. Live Service Status

Checking live Worker health...

Endpoint: https://screamup-api.shared-backend.workers.dev/health

16. Support & Future Corporate Developer Portal

ScreamUp's database and Worker foundation include Phase D2 readiness for partner organizations (api_organizations), sandbox/production projects (api_projects), and SHA-256 hashed API keys (api_keys) with scoped access (hotspots:read) and zero billing coupling in V1.