Namazu API
Crowdsourced seismic sensing, structural tensor modeling, and real-time earthquake alerts β open to any developer. Integrate shake detection into your app and join the world's most precise distributed seismograph network.
Overview
The Namazu API lets your application submit accelerometer data, receive earthquake alerts, and participate in the TGL (Tensor Generating Logic) competition β where algorithms that best model building structural tensors win Namazu tokens.
https://api.namazu.zweichain.net/v3All requests use HTTPS. All responses are JSON. Timestamps are ISO 8601 UTC.
Authentication
Every request requires a Namazu Token in the header. Get yours at the developer portal.
Authorization: Bearer nmz_live_xxxxxxxxxxxxxxxxxxxx
| Token Type | Access |
|---|---|
| nmz_live_... | Full access β submit data, receive alerts, enter TGL |
| nmz_test_... | Sandbox β no data enters live network |
Quickstart
Send your first shake event in under 5 minutes:
# 1. Submit a shake event
curl -X POST https://api.namazu.zweichain.net/v3/shake \
-H "Authorization: Bearer nmz_test_your_token" \
-H "Content-Type: application/json" \
-d '{
"device_id": "your-device-uuid",
"lat": 34.6937,
"lon": 135.5023,
"alt_m": 50,
"timestamp": "2026-05-14T13:00:00.000Z",
"samples": [
{ "t_ms": 0, "x": 0.012, "y": -0.003, "z": 9.814 },
{ "t_ms": 10, "x": 0.045, "y": 0.021, "z": 9.802 },
{ "t_ms": 20, "x": 0.231, "y": 0.198, "z": 9.756 }
],
"sample_rate_hz": 100
}'
POST /shake
Submit accelerometer samples from a device. Called when shake threshold is exceeded.
Request Body
| Field | Type | Description |
|---|---|---|
| device_id | string | required Unique device UUID (persist across sessions) |
| lat | float | required Latitude WGS84 |
| lon | float | required Longitude WGS84 |
| alt_m | float | optional Altitude in metres |
| floor | integer | optional Floor number (0 = ground). Improves tensor modeling. |
| building_id | string | optional If device is in a registered building |
| timestamp | string | required ISO 8601 UTC β event start time |
| samples | array | required Accelerometer readings (see below) |
| sample_rate_hz | integer | required Sampling rate β smartphone: 100Hz typical, IoT sensor: up to 1000Hz (1ms precision). Aerospace-grade MEMS sensors supported. |
Sample Object
| Field | Type | Description |
|---|---|---|
| t_ms | integer | Milliseconds offset from event timestamp |
| x | float | Acceleration m/sΒ² β device X axis |
| y | float | Acceleration m/sΒ² β device Y axis |
| z | float | Acceleration m/sΒ² β device Z axis (gravity ~9.81) |
Response
{
"event_id": "evt_01HXYZ...",
"status": "accepted",
"cluster_id": "clust_osaka_20260514", // null if no cluster yet
"intensity_estimate": 2.3, // JMA scale estimate
"tokens_earned": 0.5 // NMZ tokens for this submission
}
GET /shake/events
Query recent shake events by location and time.
Query Parameters
| Param | Type | Description |
|---|---|---|
| lat, lon | float | required Center point |
| radius_km | float | optional Search radius (default 50km) |
| since | string | optional ISO 8601 start time |
| min_intensity | float | optional Minimum JMA intensity |
| limit | integer | optional Max results (default 50, max 500) |
POST /building
Register a building to enable floor-by-floor tensor modeling and digital twin generation.
{
"name": "Osaka City Hall Annex",
"lat": 34.6937,
"lon": 135.5023,
"floors": 3,
"construction_year": 1978,
"structure_type": "wooden", // wooden | rc | steel | src
"sensors_per_floor": 3
}
GET /building/:id/tensor
Returns the current best structural tensor for a building β the inter-floor stiffness/damping coefficients computed by the leading TGL algorithm.
{
"building_id": "bld_01HXYZ...",
"computed_at": "2026-05-14T12:00:00Z",
"tgl_id": "tgl_lagrangian_v4", // which TGL produced this
"floors": 3,
"tensor": {
"K": [[2.41, -1.20, 0.0], // stiffness matrix
[-1.20, 2.41, -1.20],
[0.0, -1.20, 1.20]],
"C": [[0.05, -0.02, 0.0], // damping matrix
[-0.02, 0.05, -0.02],
[0.0, -0.02, 0.03]],
"confidence": 0.87
},
"risk_class": "moderate" // excellent|good|moderate|poor|critical
}
TGL Competition
TGL (Tensor Generating Logic) is Namazu's open competition for structural system identification algorithms. Submit your algorithm, have it tested against real multi-floor sensor data, and earn Namazu tokens if your TGL outperforms others at predicting inter-floor shake propagation.
POST /tgl/submit
{
"name": "My Lagrangian TGL v1",
"description": "Uses Lagrangian mechanics to identify modal frequencies...",
"language": "python",
"entrypoint": "tgl.predict",
"code_url": "https://github.com/you/your-tgl",
"docker_image": "ghcr.io/you/tgl:latest" // optional
}
samples[floor][sensor] β {t_ms, x, y, z}[] and must return predicted acceleration for the target floor over the next 500ms. Interface spec: see schema.GET /tgl/leaderboard
{
"updated_at": "2026-05-14T12:00:00Z",
"entries": [
{
"rank": 1,
"tgl_id": "tgl_lagrangian_v4",
"name": "Lagrangian Modal Decomposition v4",
"author": "namazu_core",
"rmse": 0.0023,
"events_tested": 1482,
"tokens_earned": 12400
}
]
}
Earthquake Alerts
Subscribe to real-time alerts via WebSocket. Alerts fire when the Namazu network detects a cluster of shake events consistent with an earthquake.
# Connect
wss://api.namazu.zweichain.net/v3/alerts?token=nmz_live_xxx&lat=34.69&lon=135.50&radius_km=100
# Alert message received:
{
"type": "earthquake_alert",
"alert_id": "alrt_01HXYZ",
"issued_at": "2026-05-14T13:00:00.000Z",
"epicenter": { "lat": 34.71, "lon": 135.49 },
"depth_km": 12,
"magnitude_estimate": 4.2,
"intensity_at_location": 2.8,
"seconds_to_arrival": 18,
"confidence": 0.91
}
Error Codes
| Code | Meaning |
|---|---|
| 401 | Invalid or missing token |
| 422 | Malformed request body β check field types |
| 429 | Rate limit exceeded (100 req/min on free tier) |
| 503 | Network partition β retry with exponential backoff |