$ xity init --city tokyo
{
"city": "tokyo",
"endpoints": [
"transit",
"weather",
"demographics",
"infrastructure"
],
"version": "3.2.0",
"latency": 18,
"status": "connected"
}
$ _
/v1/{city}/transit/routes
Response
{ "routes": [ { "id": "yamanote", "type": "rail", "stops": 30, "frequency_min": 3 } ], "total": 847 }
/v1/{city}/transit/realtime
Response
{ "vehicles": 1204, "delays": 12, "timestamp": "2026-04-04T09:14:00Z" }
/v1/{city}/transit/alerts/subscribe
Request body
{ "routes": ["yamanote", "chuo"], "webhook": "https://example.com/hook" }
/v1/{city}/demographics/population
Response
{ "city": "tokyo", "population": 13960000, "year": 2026, "growth_rate": -0.02 }
/v1/{city}/demographics/density
Response
{ "density_km2": 6363, "area_km2": 2194, "districts": 23 }
/v1/{city}/infrastructure/status
Response
{ "power_grid": "operational", "water": "operational", "telecom": "degraded", "incidents": 3 }
/v1/{city}/infrastructure/reports
Request body
{ "type": "pothole", "lat": 35.6762, "lng": 139.6503, "severity": 2 }
/v1/{city}/infrastructure/alerts/{id}
Response
{ "deleted": "true", "alert_id": "inf-7291" }
/v1/{city}/events
Response
{ "events": [ { "name": "Cherry Blossom Festival", "date": "2026-04-10", "impact_radius_km": 2.5 } ], "total": 34 }
/v1/{city}/events/subscribe
Request body
{ "categories": ["festival", "construction"], "radius_km": 5 }
# Install the SDK
$ npm install @xity/sdk
const xity = require('@xity/sdk');
const client = xity.init('tokyo');
const routes = await client.transit.routes();
const pop = await client.demographics.population();
$ Select a city and endpoint, then click Run query
Subscribe to real-time city event streams. Get notified of transit delays, infrastructure incidents, and community events as they happen.
$ xity webhook create --city tokyo
{
"webhook_id": "wh-8f2a",
"city": "tokyo",
"events": ["transit.delay", "infra.incident", "event.new"],
"url": "https://your-app.com/webhooks/xity",
"status": "active"
}
$ xity webhook test --id wh-8f2a
OK — 200 in 42ms