{"openapi":"3.0.3","info":{"title":"nMyCity API","version":"1.0.0","description":"Multi-domain civic intelligence API. All responses include source lineage and tier metadata. Authenticate with a Supabase JWT (Bearer token).","contact":{"email":"info@nmycity.com"}},"servers":[{"url":"https://nmycity-api.onrender.com/api/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Supabase session access_token from sign-in"}},"schemas":{"NationalTrendScope":{"type":"object","properties":{"placeId":{"type":"integer"},"tractGeoid":{"type":"string","nullable":true},"placeGeoid":{"type":"string","nullable":true},"countyGeoid":{"type":"string","nullable":true},"cbsaGeoid":{"type":"string"},"metroLabel":{"type":"string"}}},"NationalTrendsAccess":{"type":"object","properties":{"tier":{"type":"string"},"nationalTrendsPreviewOnly":{"type":"boolean"},"nationalTrendsFullAvailable":{"type":"boolean"},"nationalReconciliationAvailable":{"type":"boolean"},"nationalPeerMetrosAvailable":{"type":"boolean"},"upgradeUrl":{"type":"string"}}},"NationalTrendsBundle":{"type":"object","description":"U.S. benchmarks and metro macro for a place — CPI, HPI, ACS demographics, FEMA disasters, optional FBI vs local benchmark (Analyst+).","properties":{"placeId":{"type":"integer"},"scope":{"$ref":"#/components/schemas/NationalTrendScope"},"priceIndexes":{"type":"object","nullable":true},"demographics":{"type":"object","nullable":true},"disasters":{"type":"array","items":{"type":"object"}},"safetyBenchmark":{"type":"object","nullable":true},"reconciliation":{"type":"array","items":{"type":"object"}},"access":{"$ref":"#/components/schemas/NationalTrendsAccess"},"attribution":{"type":"object","properties":{"sources":{"type":"array","items":{"type":"string"}},"generatedAt":{"type":"string","format":"date-time"}}}}},"UpgradeRequired":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string","enum":["upgrade_required"]},"capability":{"type":"string"},"tier":{"type":"string"},"requiredTier":{"type":"string"},"upgradeUrl":{"type":"string"}}}}},"paths":{"/places/search":{"get":{"summary":"Search places by text","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","default":10}}],"responses":{"200":{"description":"Place search results"}}}},"/places/{placeId}/metrics":{"get":{"summary":"Multi-domain place metrics bundle","parameters":[{"name":"placeId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Safety, economy, forecast, anomalies with attribution"}}}},"/places/{placeId}/national-trends":{"get":{"summary":"National Trends — U.S. benchmarks and metro macro","description":"Returns CPI, housing indexes, ACS demographics, FEMA disasters, and (Analyst Solo+) FBI vs local safety benchmarks with reconciliation flags. Tier gates: preview `free`, full charts `resident`, reconciliation `pro`, API entitlement `pro` (explicit `developer` grant). Every series includes source tables in `attribution.sources`.","tags":["National Trends"],"parameters":[{"name":"placeId","in":"path","required":true,"schema":{"type":"integer"},"description":"Block place_id from search or near endpoints"}],"responses":{"200":{"description":"National Trends bundle with tier-scoped fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NationalTrendsBundle"}}}},"404":{"description":"Place not found or no national series loaded for metro"}}}},"/data/query":{"get":{"summary":"Query incident records by scope, domain, and date range","description":"Requires Platform Developer or Analyst+ plan. Monthly limits: developer 50000, pro 10000, business 200000.","parameters":[{"name":"scope","in":"query","required":true,"schema":{"type":"string","enum":["block","tract","city","county","state","metro","nation"]}},{"name":"scopeId","in":"query","required":true,"schema":{"type":"string"}},{"name":"domain","in":"query","required":true,"schema":{"type":"string","enum":["crime","fio","fire","311","permits","assessments","payroll"]}},{"name":"start","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"end","in":"query","required":true,"schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"Records with attribution block"}}}},"/data/count":{"get":{"summary":"Count-only variant of /data/query","responses":{"200":{"description":"Total count with attribution"}}}},"/data/products/neighborhood-safety":{"get":{"summary":"Neighborhood Safety Bundle","description":"Multi-domain civic counts (crime, fire, FIO, 311, permits, property assessments) for a geographic scope and date/fiscal range, with full source lineage.","responses":{"200":{"description":"Multi-domain bundle with per-domain attribution"}}}},"/trust/sources":{"get":{"summary":"Warehouse freshness and source catalog","security":[],"responses":{"200":{"description":"Source SLA status"}}}}},"x-products":[{"id":"neighborhood-safety","version":"1.1","name":"Neighborhood Safety Bundle","description":"Multi-domain civic counts (crime, fire, FIO, 311, permits, property assessments) for a geographic scope and date/fiscal range, with full source lineage.","domains":["crime","fire","fio","311","permits","assessments"]}],"x-rate-limits":{"free":0,"resident":0,"developer":50000,"pro":10000,"business":200000,"enterprise":null},"x-national-trends":{"capability":"national_trends_api","minTier":"pro","tables":["fact_economic_series","fact_demographics","fact_federal_disasters","fact_crime_benchmarks","reconciliation_flags"]}}