openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: identity description: HexRunner anonymous device identity - name: runs description: HexRunner run persistence - name: territory description: HexRunner territory ownership - name: safety description: Privacy-preserving crowdsourced route safety signals - name: airQuality description: Sourced local air-quality guidance - name: civic description: Coarse, moderated community street-issue reports - name: users description: HexRunner user statistics and rankings - name: presence description: Ephemeral privacy-preserving live runner presence - name: connections description: Explicit runner connection and blocking controls - name: interactions description: Ephemeral one-way waves and territory-entry alerts - name: equity description: Privacy-thresholded cold-zone equity rewards paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /anonymous-identities: post: operationId: registerAnonymousIdentity tags: [identity] summary: Register an anonymous device identity description: Claims an unused locally generated device UID and returns a server-verifiable credential. requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AnonymousIdentityRegistration" responses: "200": description: Existing enrollment recovered idempotently content: application/json: schema: $ref: "#/components/schemas/AnonymousIdentityCredential" "201": description: Anonymous device identity registered content: application/json: schema: $ref: "#/components/schemas/AnonymousIdentityCredential" "400": description: Invalid identity registration content: application/json: schema: $ref: "#/components/schemas/ApiError" "409": description: Requested UID is already registered content: application/json: schema: $ref: "#/components/schemas/ApiError" "500": description: Identity could not be registered content: application/json: schema: $ref: "#/components/schemas/ApiError" /runs: post: operationId: saveRun tags: [runs] summary: Save a completed run description: Atomically saves a completed run and its claimed H3 array, then reassigns every claimed cell at the server's current time. Current territory totals are derived from live ownership. security: - anonymousDeviceCredential: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SaveRunRequest" responses: "200": description: Run already existed and was returned without duplication content: application/json: schema: $ref: "#/components/schemas/SaveRunResult" "201": description: Run saved content: application/json: schema: $ref: "#/components/schemas/SaveRunResult" "400": description: Invalid run payload content: application/json: schema: $ref: "#/components/schemas/ApiError" "401": description: Missing or invalid anonymous device credential content: application/json: schema: $ref: "#/components/schemas/ApiError" "500": description: Run could not be saved content: application/json: schema: $ref: "#/components/schemas/ApiError" /equity-zones/current: get: operationId: getCurrentEquityZone tags: [equity] summary: Get the caller's current privacy-safe equity zone status description: Uses only an unexpired live-run presence. It never exposes cells, counts, or individual runner activity. security: [{ anonymousDeviceCredential: [] }] responses: "200": description: Current equity eligibility without location detail content: application/json: schema: $ref: "#/components/schemas/EquityZoneStatus" "401": description: Missing or invalid anonymous device credential content: application/json: schema: $ref: "#/components/schemas/ApiError" /hex-ownership/lookup: post: operationId: lookupHexOwnership tags: [territory] summary: Look up ownership for H3 cells description: Returns ownership for at most 1000 supplied resolution-9 H3 indexes. Unclaimed cells are returned with null ownership. requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/HexOwnershipLookupRequest" responses: "200": description: Ownership snapshot content: application/json: schema: $ref: "#/components/schemas/HexOwnershipLookupResult" "400": description: Invalid or excessive lookup payload content: application/json: schema: $ref: "#/components/schemas/ApiError" "500": description: Ownership could not be loaded content: application/json: schema: $ref: "#/components/schemas/ApiError" /safety-reports: post: operationId: createSafetyReport tags: [safety] summary: Report feeling unsafe in the current area description: Authenticated report reduced server-side to a coarse resolution-8 H3 area. Raw coordinates are not retained. security: - anonymousDeviceCredential: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateSafetyReportRequest" responses: "200": description: Idempotent or duplicate report result content: application/json: schema: $ref: "#/components/schemas/CreateSafetyReportResult" "201": description: Safety report accepted content: application/json: schema: $ref: "#/components/schemas/CreateSafetyReportResult" "400": description: Invalid or stale report content: application/json: schema: $ref: "#/components/schemas/ApiError" "401": description: Missing or invalid device credential content: application/json: schema: $ref: "#/components/schemas/ApiError" /safety-areas/lookup: post: operationId: lookupSafetyAreas tags: [safety] summary: Look up aggregated coarse-area safety signals description: Returns no score until at least three distinct reporters contributed in the retention window. requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SafetyAreaLookupRequest" responses: "200": description: Privacy-thresholded advisory safety signals content: application/json: schema: $ref: "#/components/schemas/SafetyAreaLookupResult" /air-quality: get: operationId: getAirQuality tags: [airQuality] summary: Get sourced current and forecast air quality description: Proxies Open-Meteo air-quality data and returns explicit source, observation time, fetch time, freshness, and non-medical exercise guidance. parameters: - name: latitude in: query required: true schema: type: number minimum: -90 maximum: 90 - name: longitude in: query required: true schema: type: number minimum: -180 maximum: 180 responses: "200": description: Sourced AQI reading and guidance content: application/json: schema: $ref: "#/components/schemas/AirQualityResult" "400": description: Invalid coordinates content: application/json: schema: $ref: "#/components/schemas/ApiError" "503": description: Source unavailable or returned no usable current AQI content: application/json: schema: $ref: "#/components/schemas/ApiError" /civic-photo-uploads: post: operationId: requestCivicPhotoUpload tags: [civic] summary: Request a short-lived civic photo upload URL security: - anonymousDeviceCredential: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CivicPhotoUploadRequest" responses: "200": description: Short-lived App Storage upload URL content: application/json: schema: $ref: "#/components/schemas/CivicPhotoUploadResult" "400": description: Invalid photo metadata content: application/json: schema: $ref: "#/components/schemas/ApiError" "401": description: Missing or invalid device credential content: application/json: schema: $ref: "#/components/schemas/ApiError" /civic-reports: post: operationId: createCivicReport tags: [civic] summary: Submit a coarse civic issue report description: Persists photo-backed issue metadata without exposing reporter identity or exact coordinates publicly. security: - anonymousDeviceCredential: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateCivicReportRequest" responses: "200": description: Idempotent civic report result content: application/json: schema: $ref: "#/components/schemas/CreateCivicReportResult" "201": description: Civic report accepted for moderation content: application/json: schema: $ref: "#/components/schemas/CreateCivicReportResult" "400": description: Invalid report or missing uploaded photo content: application/json: schema: $ref: "#/components/schemas/ApiError" "401": description: Missing or invalid device credential content: application/json: schema: $ref: "#/components/schemas/ApiError" /civic-reports/{reportId}/flags: post: operationId: flagCivicReport tags: [civic] summary: Flag a duplicate or inappropriate civic report security: - anonymousDeviceCredential: [] parameters: - name: reportId in: path required: true schema: type: string minLength: 8 maxLength: 120 pattern: "^[A-Za-z0-9_-]+$" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/FlagCivicReportRequest" responses: "200": description: Flag recorded idempotently content: application/json: schema: $ref: "#/components/schemas/FlagCivicReportResult" "401": description: Missing or invalid device credential content: application/json: schema: $ref: "#/components/schemas/ApiError" "404": description: Report not found content: application/json: schema: $ref: "#/components/schemas/ApiError" /civic-map/lookup: post: operationId: lookupCivicMap tags: [civic] summary: Look up privacy-safe civic issues and informal caretakers requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CivicMapLookupRequest" responses: "200": description: Coarse public civic map layer content: application/json: schema: $ref: "#/components/schemas/CivicMapLookupResult" /civic-caretakers: post: operationId: adoptCivicZone tags: [civic] summary: Informally adopt a currently owned territory zone description: This community label grants no authority, exclusivity, or municipal role and does not change territory ownership. security: - anonymousDeviceCredential: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AdoptCivicZoneRequest" responses: "200": description: Existing or newly recorded informal adoption content: application/json: schema: $ref: "#/components/schemas/AdoptCivicZoneResult" "401": description: Missing or invalid device credential content: application/json: schema: $ref: "#/components/schemas/ApiError" "403": description: Zone is not currently owned by this runner content: application/json: schema: $ref: "#/components/schemas/ApiError" /leaderboard: get: operationId: getLeaderboard tags: [users] summary: Get the territory leaderboard description: Returns at most 20 runners ordered by totalHexesOwned descending, then total distance, run count, and user ID. parameters: - name: currentUserId in: query required: false schema: $ref: "#/components/schemas/UserId" - name: scope in: query required: false schema: $ref: "#/components/schemas/LeaderboardScope" responses: "200": description: Territory leaderboard content: application/json: schema: $ref: "#/components/schemas/LeaderboardResult" "500": description: Leaderboard could not be loaded content: application/json: schema: $ref: "#/components/schemas/ApiError" /users/{userId}/baseline: patch: operationId: updateUserBaseline tags: [users] summary: Save a runner's initial fitness baseline security: - anonymousDeviceCredential: [] parameters: - name: userId in: path required: true schema: $ref: "#/components/schemas/UserId" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UserBaselineUpdate" responses: "200": description: Baseline saved content: application/json: schema: $ref: "#/components/schemas/UserBaseline" "400": description: Invalid baseline content: application/json: schema: $ref: "#/components/schemas/ApiError" "401": description: Missing or invalid anonymous device credential content: application/json: schema: $ref: "#/components/schemas/ApiError" "403": description: Device credential does not match the runner content: application/json: schema: $ref: "#/components/schemas/ApiError" /users/{userId}/stats: get: operationId: getUserStats tags: [users] summary: Get user totals and recent runs parameters: - name: userId in: path required: true schema: $ref: "#/components/schemas/UserId" responses: "200": description: User totals and up to five recent runs content: application/json: schema: $ref: "#/components/schemas/UserStatsResult" "400": description: Invalid user ID content: application/json: schema: $ref: "#/components/schemas/ApiError" "500": description: Stats could not be loaded content: application/json: schema: $ref: "#/components/schemas/ApiError" /presence/heartbeat: post: operationId: heartbeatPresence tags: [presence] security: [{ anonymousDeviceCredential: [] }] requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/PresenceHeartbeatInput" } responses: "200": description: Presence refreshed content: { application/json: { schema: { $ref: "#/components/schemas/PresenceHeartbeatResult" } } } "400": { description: Invalid presence, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } "401": { description: Unauthorized, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } "409": { description: Another live run is active, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } "429": { description: Heartbeat frequency is too high, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } /presence/end: post: operationId: endPresence tags: [presence] security: [{ anonymousDeviceCredential: [] }] requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/PresenceEndInput" } responses: "204": { description: Presence ended } "400": { description: Invalid presence end data, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } "401": { description: Unauthorized, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } /presence/discovery-anchor: post: operationId: updateDiscoveryAnchor tags: [presence] summary: Set a short-lived private center for nearby discovery security: [{ anonymousDeviceCredential: [] }] requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/DiscoveryAnchorInput" } responses: "200": { description: Discovery anchor refreshed, content: { application/json: { schema: { $ref: "#/components/schemas/DiscoveryAnchorResult" } } } } "400": { description: Invalid discovery anchor, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } "401": { description: Unauthorized, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } "409": { description: Discovery session has ended, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } "429": { description: Anchor updates are too frequent, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } /presence/discovery-anchor/end: post: operationId: endDiscoveryAnchor tags: [presence] summary: Delete the caller's private discovery center security: [{ anonymousDeviceCredential: [] }] requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/DiscoveryAnchorEndInput" } responses: "204": { description: Discovery anchor deleted } "400": { description: Invalid discovery anchor end data, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } "401": { description: Unauthorized, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } /presence/nearby: get: operationId: getNearbyPresence tags: [presence] security: [{ anonymousDeviceCredential: [] }] parameters: - name: radiusMeters in: query required: true schema: { type: number, minimum: 25, maximum: 5000 } - name: limit in: query schema: { type: number, multipleOf: 1, minimum: 1, maximum: 100, default: 50 } responses: "200": description: Nearby live runners content: { application/json: { schema: { $ref: "#/components/schemas/NearbyPresenceResult" } } } "400": { description: Invalid query, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } "401": { description: Unauthorized, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } /connections: get: operationId: listConnections tags: [connections] security: [{ anonymousDeviceCredential: [] }] responses: "200": { description: Connections, content: { application/json: { schema: { type: array, items: { $ref: "#/components/schemas/Connection" } } } } } "401": { description: Unauthorized, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } /connections/{userId}/request: post: operationId: requestConnection tags: [connections] security: [{ anonymousDeviceCredential: [] }] parameters: [{ name: userId, in: path, required: true, schema: { type: string, minLength: 1, maxLength: 128 } }] responses: "200": { description: Connection requested, content: { application/json: { schema: { $ref: "#/components/schemas/Connection" } } } } "400": { description: Invalid action, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } "401": { description: Unauthorized, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } /connections/{userId}/accept: post: operationId: acceptConnection tags: [connections] security: [{ anonymousDeviceCredential: [] }] parameters: [{ name: userId, in: path, required: true, schema: { type: string, minLength: 1, maxLength: 128 } }] responses: "200": { description: Connection accepted, content: { application/json: { schema: { $ref: "#/components/schemas/Connection" } } } } "400": { description: Invalid action, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } "401": { description: Unauthorized, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } /connections/{userId}/reject: post: operationId: rejectConnection tags: [connections] security: [{ anonymousDeviceCredential: [] }] parameters: [{ name: userId, in: path, required: true, schema: { type: string, minLength: 1, maxLength: 128 } }] responses: "204": { description: Request rejected } "401": { description: Unauthorized, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } /connections/{userId}: delete: operationId: removeConnection tags: [connections] security: [{ anonymousDeviceCredential: [] }] parameters: [{ name: userId, in: path, required: true, schema: { type: string, minLength: 1, maxLength: 128 } }] responses: "204": { description: Connection removed } "401": { description: Unauthorized, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } /connections/{userId}/block: post: operationId: blockConnection tags: [connections] security: [{ anonymousDeviceCredential: [] }] parameters: [{ name: userId, in: path, required: true, schema: { type: string, minLength: 1, maxLength: 128 } }] responses: "200": { description: User blocked, content: { application/json: { schema: { $ref: "#/components/schemas/Connection" } } } } "400": { description: Invalid action, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } "401": { description: Unauthorized, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } /waves: post: operationId: sendWave tags: [interactions] summary: Send a short-lived one-way wave using an opaque nearby grant security: [{ anonymousDeviceCredential: [] }] requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/SendWaveInput" } responses: "200": { description: Idempotent replay, content: { application/json: { schema: { $ref: "#/components/schemas/SendWaveResult" } } } } "201": { description: Wave created, content: { application/json: { schema: { $ref: "#/components/schemas/SendWaveResult" } } } } "400": { description: Invalid request, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } "401": { description: Unauthorized, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } "403": { description: Interaction unavailable, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } "409": { description: Idempotency key resolved to another interaction, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } "429": { description: Wave limit reached, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } /live-interactions: get: operationId: getLiveInteractions tags: [interactions] summary: Poll focused unacknowledged live interactions security: [{ anonymousDeviceCredential: [] }] responses: "200": { description: Current live interactions, content: { application/json: { schema: { $ref: "#/components/schemas/LiveInteractionsResult" } } } } "400": { description: Current app-active location is required, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } "401": { description: Unauthorized, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } /live-interactions/ack: post: operationId: acknowledgeLiveInteractions tags: [interactions] summary: Acknowledge recipient-owned current interactions security: [{ anonymousDeviceCredential: [] }] requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/AcknowledgeLiveInteractionsInput" } responses: "204": { description: Acknowledgement applied idempotently } "400": { description: Invalid acknowledgement, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } "401": { description: Unauthorized, content: { application/json: { schema: { $ref: "#/components/schemas/ApiError" } } } } components: securitySchemes: anonymousDeviceCredential: type: http scheme: bearer bearerFormat: HexRunner anonymous device credential schemas: HealthStatus: type: object properties: status: type: string required: - status AnonymousIdentityRegistration: type: object properties: requestedUserId: type: string minLength: 8 maxLength: 120 pattern: "^[A-Za-z0-9_-]+$" enrollmentSecret: type: string minLength: 64 maxLength: 128 pattern: "^[0-9a-f]+$" required: [requestedUserId, enrollmentSecret] AnonymousIdentityCredential: type: object properties: userId: type: string minLength: 8 maxLength: 120 pattern: "^[A-Za-z0-9_-]+$" credential: type: string minLength: 32 maxLength: 1024 required: [userId, credential] RunPoint: type: object properties: lat: type: number minimum: -90 maximum: 90 lng: type: number minimum: -180 maximum: 180 timestamp: type: number multipleOf: 1 minimum: 0 accuracyMeters: type: number minimum: 0 speedMetersPerSecond: type: number minimum: 0 mocked: type: boolean required: [lat, lng, timestamp] UserId: type: string minLength: 8 maxLength: 120 pattern: "^[A-Za-z0-9_-]+$" RunAntiSpoofAdvisory: type: object description: Client-observed telemetry retained for future anti-spoof analysis. These fields are advisory and do not reject a run. properties: flaggedSuspicious: type: boolean reason: type: string maxLength: 200 mockLocationDetected: type: boolean averageAccuracyMeters: type: number minimum: 0 maxSpeedMetersPerSecond: type: number minimum: 0 RunAntiSpoofResult: type: object properties: flaggedSuspicious: type: boolean reason: type: [string, "null"] mockLocationDetected: type: [boolean, "null"] averageAccuracyMeters: type: [number, "null"] maxSpeedMetersPerSecond: type: [number, "null"] required: [flaggedSuspicious, reason, mockLocationDetected, averageAccuracyMeters, maxSpeedMetersPerSecond] SaveRunRequest: type: object properties: clientRunId: type: string minLength: 8 maxLength: 120 pattern: "^[A-Za-z0-9_-]+$" startedAt: type: string format: date-time endedAt: type: string format: date-time elapsedSeconds: type: number multipleOf: 1 minimum: 0 pausedSeconds: type: number multipleOf: 1 minimum: 0 distanceKm: type: number minimum: 0 points: type: array maxItems: 20000 items: $ref: "#/components/schemas/RunPoint" claimedHexes: type: array maxItems: 10000 uniqueItems: true items: type: string minLength: 15 maxLength: 16 pattern: "^89[0-9a-f]{13}$" antiSpoof: $ref: "#/components/schemas/RunAntiSpoofAdvisory" required: - clientRunId - startedAt - endedAt - elapsedSeconds - distanceKm - points - claimedHexes SaveRunResult: type: object properties: runId: type: string saved: type: boolean idempotent: type: boolean newHexes: type: number multipleOf: 1 minimum: 0 stolenHexes: type: number multipleOf: 1 minimum: 0 claimedHexes: type: number multipleOf: 1 minimum: 0 budgetSkippedHexes: type: number multipleOf: 1 minimum: 0 dailyClaimedHexes: type: number multipleOf: 1 minimum: 0 dailyBudget: type: number multipleOf: 1 minimum: 1 currentStreak: type: number multipleOf: 1 minimum: 0 antiSpoof: $ref: "#/components/schemas/RunAntiSpoofResult" baseCredit: { type: number, multipleOf: 1, minimum: 0 } bonusCredit: { type: number, multipleOf: 1, minimum: 0 } totalCredit: { type: number, multipleOf: 1, minimum: 0 } coldZoneHexes: { type: number, multipleOf: 1, minimum: 0 } dailyBonusCredit: { type: number, multipleOf: 1, minimum: 0 } dailyBonusCap: { type: number, multipleOf: 1, minimum: 1 } loopDetected: { type: boolean } interiorHexes: { type: number, multipleOf: 1, minimum: 0 } required: [runId, saved, idempotent, newHexes, stolenHexes, claimedHexes, budgetSkippedHexes, dailyClaimedHexes, dailyBudget, currentStreak, antiSpoof, baseCredit, bonusCredit, totalCredit, coldZoneHexes, dailyBonusCredit, dailyBonusCap, loopDetected, interiorHexes] HexOwnershipLookupRequest: type: object properties: h3Indexes: type: array minItems: 1 maxItems: 1000 uniqueItems: true items: type: string minLength: 15 maxLength: 16 pattern: "^89[0-9a-f]{13}$" required: [h3Indexes] HexOwnership: type: object properties: h3Index: type: string ownerId: type: [string, "null"] claimedAt: type: [string, "null"] format: date-time freshnessScore: type: [number, "null"] minimum: 0 maximum: 100 ownerTerritoryColor: oneOf: - $ref: "#/components/schemas/TerritoryColor" - type: "null" required: [h3Index, ownerId, claimedAt, freshnessScore, ownerTerritoryColor] HexOwnershipLookupResult: type: object properties: ownership: type: array maxItems: 1000 items: $ref: "#/components/schemas/HexOwnership" required: [ownership] CreateSafetyReportRequest: type: object properties: clientReportId: type: string minLength: 8 maxLength: 120 pattern: "^[A-Za-z0-9_-]+$" clientRunId: type: string minLength: 8 maxLength: 120 pattern: "^[A-Za-z0-9_-]+$" areaH3Index: type: string minLength: 15 maxLength: 16 pattern: "^88[0-9a-f]{13}$" occurredAt: type: string format: date-time required: [clientReportId, clientRunId, areaH3Index, occurredAt] CreateSafetyReportResult: type: object properties: accepted: type: boolean duplicate: type: boolean areaH3Index: type: string advisory: type: string required: [accepted, duplicate, areaH3Index, advisory] SafetyAreaLookupRequest: type: object properties: areaH3Indexes: type: array minItems: 1 maxItems: 500 uniqueItems: true items: type: string minLength: 15 maxLength: 16 pattern: "^88[0-9a-f]{13}$" required: [areaH3Indexes] SafetyAreaSignal: type: object properties: areaH3Index: type: string confidence: type: string enum: [insufficient, emerging, established] concernScore: type: [number, "null"] minimum: 0 maximum: 100 sampleSize: type: [number, "null"] minimum: 3 required: [areaH3Index, confidence, concernScore, sampleSize] SafetyAreaLookupResult: type: object properties: areas: type: array maxItems: 500 items: $ref: "#/components/schemas/SafetyAreaSignal" advisory: type: string required: [areas, advisory] AirQualityLevel: type: string enum: [good, moderate, unhealthy_sensitive, unhealthy, very_unhealthy, hazardous] AirQualityResult: type: object properties: aqi: type: number multipleOf: 1 minimum: 0 maximum: 500 level: $ref: "#/components/schemas/AirQualityLevel" healthContext: type: string observationTime: type: string format: date-time fetchedAt: type: string format: date-time isStale: type: boolean sourceName: type: string sourceUrl: type: string suggestedWindow: oneOf: - $ref: "#/components/schemas/ExerciseWindow" - type: "null" disclaimer: type: string required: [aqi, level, healthContext, observationTime, fetchedAt, isStale, sourceName, sourceUrl, suggestedWindow, disclaimer] ExerciseWindow: type: object properties: startsAt: type: string format: date-time endsAt: type: string format: date-time expectedAqi: type: number multipleOf: 1 minimum: 0 maximum: 500 reason: type: string required: [startsAt, endsAt, expectedAqi, reason] CivicCategory: type: string enum: [pothole, garbage, broken_streetlight] CivicModerationState: type: string enum: [unreviewed, possible_duplicate, flagged, reviewed] CivicPhotoUploadRequest: type: object properties: contentType: type: string enum: [image/jpeg, image/png, image/webp] sizeBytes: type: number multipleOf: 1 minimum: 1 maximum: 10485760 required: [contentType, sizeBytes] CivicPhotoUploadResult: type: object properties: uploadUrl: type: string objectPath: type: string pattern: "^/civic-photos/[A-Za-z0-9_-]+$" expiresAt: type: string format: date-time required: [uploadUrl, objectPath, expiresAt] CreateCivicReportRequest: type: object properties: clientReportId: type: string minLength: 8 maxLength: 120 pattern: "^[A-Za-z0-9_-]+$" clientRunId: type: string minLength: 8 maxLength: 120 pattern: "^[A-Za-z0-9_-]+$" category: $ref: "#/components/schemas/CivicCategory" areaH3Index: type: string minLength: 15 maxLength: 16 pattern: "^88[0-9a-f]{13}$" occurredAt: type: string format: date-time note: type: string maxLength: 280 photoObjectPath: type: string pattern: "^/civic-photos/[A-Za-z0-9_-]+$" consentToPublishCoarseReport: type: boolean required: [clientReportId, clientRunId, category, areaH3Index, occurredAt, photoObjectPath, consentToPublishCoarseReport] CreateCivicReportResult: type: object properties: reportId: type: string accepted: type: boolean duplicate: type: boolean moderationState: $ref: "#/components/schemas/CivicModerationState" advisory: type: string required: [reportId, accepted, duplicate, moderationState, advisory] FlagCivicReportRequest: type: object properties: reason: type: string enum: [duplicate, inappropriate, confirmed_valid] required: [reason] FlagCivicReportResult: type: object properties: reportId: type: string recorded: type: boolean flagCount: type: number multipleOf: 1 minimum: 0 moderationState: $ref: "#/components/schemas/CivicModerationState" required: [reportId, recorded, flagCount, moderationState] CivicMapLookupRequest: type: object properties: areaH3Indexes: type: array minItems: 1 maxItems: 500 uniqueItems: true items: type: string pattern: "^88[0-9a-f]{13}$" h3Indexes: type: array maxItems: 1000 uniqueItems: true items: type: string pattern: "^89[0-9a-f]{13}$" required: [areaH3Indexes, h3Indexes] CivicAreaSignal: type: object properties: areaH3Index: type: string totalReports: type: number multipleOf: 1 minimum: 1 unreviewedReports: type: number multipleOf: 1 minimum: 0 categories: type: array uniqueItems: true items: $ref: "#/components/schemas/CivicCategory" latestReportAt: type: string format: date-time latestReportId: type: string required: [areaH3Index, totalReports, unreviewedReports, categories, latestReportAt, latestReportId] CivicCaretakerSignal: type: object properties: h3Index: type: string adoptedAt: type: string format: date-time label: type: string required: [h3Index, adoptedAt, label] CivicMapLookupResult: type: object properties: areas: type: array maxItems: 500 items: $ref: "#/components/schemas/CivicAreaSignal" caretakers: type: array maxItems: 1000 items: $ref: "#/components/schemas/CivicCaretakerSignal" advisory: type: string required: [areas, caretakers, advisory] AdoptCivicZoneRequest: type: object properties: h3Index: type: string pattern: "^89[0-9a-f]{13}$" required: [h3Index] AdoptCivicZoneResult: type: object properties: h3Index: type: string adoptedAt: type: string format: date-time informal: type: boolean advisory: type: string required: [h3Index, adoptedAt, informal, advisory] LeaderboardEntry: type: object properties: rank: type: number multipleOf: 1 minimum: 1 displayName: type: string totalHexesOwned: type: number multipleOf: 1 minimum: 0 totalRuns: type: number multipleOf: 1 minimum: 0 totalDistanceKm: type: number minimum: 0 isCurrentUser: type: boolean totalCredits: { type: number, multipleOf: 1, minimum: 0 } totalBonusCredits: { type: number, multipleOf: 1, minimum: 0 } required: [rank, displayName, totalHexesOwned, totalRuns, totalDistanceKm, isCurrentUser, totalCredits, totalBonusCredits] LeaderboardResult: type: object properties: scope: $ref: "#/components/schemas/LeaderboardScope" users: type: array maxItems: 20 items: $ref: "#/components/schemas/LeaderboardEntry" required: [scope, users] RecentRun: type: object properties: runId: type: string distanceKm: type: number averagePaceMinPerKm: type: [number, "null"] startedAt: type: string format: date-time endedAt: type: string format: date-time claimedHexes: type: number multipleOf: 1 minimum: 0 newHexes: type: number multipleOf: 1 minimum: 0 stolenHexes: type: number multipleOf: 1 minimum: 0 bonusCredit: { type: number, multipleOf: 1, minimum: 0 } totalCredit: { type: number, multipleOf: 1, minimum: 0 } required: [runId, distanceKm, averagePaceMinPerKm, startedAt, endedAt, claimedHexes, newHexes, stolenHexes, bonusCredit, totalCredit] UserStatsTotals: type: object properties: totalRuns: type: number multipleOf: 1 minimum: 0 totalDistanceKm: type: number minimum: 0 totalElapsedSeconds: type: number multipleOf: 1 minimum: 0 averagePaceMinPerKm: type: [number, "null"] totalHexesOwned: type: number multipleOf: 1 minimum: 0 totalClaimedHexes: type: number multipleOf: 1 minimum: 0 totalNewHexes: type: number multipleOf: 1 minimum: 0 totalStolenHexes: type: number multipleOf: 1 minimum: 0 currentStreak: type: number multipleOf: 1 minimum: 0 todayClaimedHexes: type: number multipleOf: 1 minimum: 0 dailyBudget: type: number multipleOf: 1 minimum: 1 totalCredits: { type: number, multipleOf: 1, minimum: 0 } totalBonusCredits: { type: number, multipleOf: 1, minimum: 0 } todayBonusCredits: { type: number, multipleOf: 1, minimum: 0 } dailyBonusCap: { type: number, multipleOf: 1, minimum: 1 } required: [totalRuns, totalDistanceKm, totalElapsedSeconds, averagePaceMinPerKm, totalHexesOwned, totalClaimedHexes, totalNewHexes, totalStolenHexes, currentStreak, todayClaimedHexes, dailyBudget, totalCredits, totalBonusCredits, todayBonusCredits, dailyBonusCap] EquityZoneStatus: type: object description: Privacy-safe city-level result; no H3 IDs, counts, or runner identifiers are returned. properties: availability: { type: string, enum: [available, insufficient_data, unavailable] } freshness: { type: string, enum: [current, stale, unavailable] } tier: { type: [string, "null"], enum: [cold, medium, hot, null] } multiplier: { type: number, enum: [1, 2] } eligible: { type: boolean } evaluatedAt: { type: [string, "null"], format: date-time } nextEvaluationAt: { type: string, format: date-time } message: { type: string } required: [availability, freshness, tier, multiplier, eligible, evaluatedAt, nextEvaluationAt, message] FitnessTier: type: string enum: [beginner, casual, regular, trained] TerritoryColor: type: string enum: [amber, cyan, emerald, fuchsia, violet] LeaderboardScope: type: string enum: [global, city, friends] UserBaselineUpdate: type: object properties: displayName: type: string minLength: 1 maxLength: 40 city: type: string minLength: 1 maxLength: 60 activityLevel: $ref: "#/components/schemas/FitnessTier" territoryColor: $ref: "#/components/schemas/TerritoryColor" required: [city, activityLevel] UserBaseline: type: object properties: displayName: type: string city: type: string activityLevel: $ref: "#/components/schemas/FitnessTier" completedAt: type: string format: date-time territoryColor: $ref: "#/components/schemas/TerritoryColor" required: [displayName, city, activityLevel, completedAt, territoryColor] TakeoverAlert: type: object properties: h3Index: type: string happenedAt: type: string format: date-time required: [h3Index, happenedAt] UserStatsResult: type: object properties: userId: type: string displayName: type: string baseline: oneOf: - $ref: "#/components/schemas/UserBaseline" - type: "null" totals: $ref: "#/components/schemas/UserStatsTotals" recentRuns: type: array maxItems: 5 items: $ref: "#/components/schemas/RecentRun" takeoverAlerts: type: array maxItems: 3 items: $ref: "#/components/schemas/TakeoverAlert" required: [userId, displayName, baseline, totals, recentRuns, takeoverAlerts] ApiError: type: object properties: error: type: string required: [error] PresenceHeartbeatInput: type: object required: [clientRunId, lat, lng, accuracyMeters, mocked] properties: clientRunId: { type: string, minLength: 1, maxLength: 128, pattern: "^[A-Za-z0-9_-]+$" } lat: { type: number, minimum: -90, maximum: 90 } lng: { type: number, minimum: -180, maximum: 180 } accuracyMeters: { type: number, minimum: 0, maximum: 100 } mocked: { type: boolean } PresenceEndInput: type: object required: [clientRunId] properties: clientRunId: { type: string, minLength: 1, maxLength: 128, pattern: "^[A-Za-z0-9_-]+$" } PresenceHeartbeatResult: type: object required: [expiresAt] properties: expiresAt: { type: string, format: date-time } DiscoveryAnchorInput: description: >- The first mobile location fix cannot be hardware-attested. Subsequent updates are server-time continuity constrained and this record is never discoverable as a runner. type: object required: [clientSessionId, lat, lng, accuracyMeters, mocked] properties: clientSessionId: { type: string, minLength: 1, maxLength: 128 } lat: { type: number, minimum: -90, maximum: 90 } lng: { type: number, minimum: -180, maximum: 180 } accuracyMeters: { type: number, minimum: 0, maximum: 100 } mocked: { type: boolean } DiscoveryAnchorEndInput: description: Identifies the foreground discovery session to terminate. type: object required: [clientSessionId] properties: clientSessionId: { type: string, minLength: 1, maxLength: 128 } DiscoveryAnchorResult: type: object required: [expiresAt] properties: expiresAt: { type: string, format: date-time } ExactPresence: type: object required: [visibility, userId, displayName, lat, lng, distanceMeters, interactionToken, waveAvailable] properties: visibility: { type: string, enum: [exact] } userId: { type: string } displayName: { type: string } lat: { type: number } lng: { type: number } distanceMeters: { type: number } interactionToken: { type: string, minLength: 22, maxLength: 128 } waveAvailable: { type: boolean } AnonymousPresence: type: object required: [visibility, lat, lng, distanceBandMeters, interactionToken, waveAvailable] properties: visibility: { type: string, enum: [anonymous] } lat: { type: number } lng: { type: number } distanceBandMeters: { type: number, minimum: 250, maximum: 5000, multipleOf: 250 } interactionToken: { type: string, minLength: 22, maxLength: 128 } waveAvailable: { type: boolean } NearbyPresenceResult: type: object required: [runners, ambientCount] properties: runners: type: array maxItems: 100 items: oneOf: - $ref: "#/components/schemas/ExactPresence" - $ref: "#/components/schemas/AnonymousPresence" ambientCount: { type: number, multipleOf: 1, minimum: 0 } Connection: type: object required: [userId, status, updatedAt] properties: userId: { type: string } status: { type: string, enum: [pending_outgoing, pending_incoming, accepted, blocked] } updatedAt: { type: string, format: date-time } SendWaveInput: type: object additionalProperties: false required: [interactionToken, idempotencyKey] properties: interactionToken: { type: string, minLength: 22, maxLength: 128, pattern: "^[A-Za-z0-9_-]+$" } idempotencyKey: { type: string, minLength: 1, maxLength: 128, pattern: "^[A-Za-z0-9_-]+$" } SendWaveResult: type: object required: [waveId, expiresAt] properties: waveId: { type: string, minLength: 16, maxLength: 128 } expiresAt: { type: string, format: date-time } LiveInteraction: type: object additionalProperties: false required: [id, kind, copy, createdAt, expiresAt] properties: id: { type: string, minLength: 16, maxLength: 128 } kind: { type: string, enum: [contest, wave] } copy: { type: string, maxLength: 120 } displayName: { type: string, minLength: 1, maxLength: 40 } h3Index: { type: string, pattern: "^89[0-9a-f]{13}$" } createdAt: { type: string, format: date-time } expiresAt: { type: string, format: date-time } LiveInteractionsResult: type: object required: [events] properties: events: type: array maxItems: 100 items: { $ref: "#/components/schemas/LiveInteraction" } AcknowledgeLiveInteractionsInput: type: object additionalProperties: false required: [contestEventIds, waveIds] properties: contestEventIds: type: array maxItems: 50 uniqueItems: true items: { type: string, minLength: 16, maxLength: 128 } waveIds: type: array maxItems: 50 uniqueItems: true items: { type: string, minLength: 16, maxLength: 128 }