Airfree
Back to Developers

APIs

Digital Twin API

1 min read

Ingest IoT sensor feeds, control 3D scene state, and query the live digital twin model of a city or asset over WebSocket and REST.

The Digital Twin API connects live data to a three-dimensional model of a city or asset. It combines a REST surface for scene and model state with a WebSocket channel for real-time sensor telemetry, feeding the CesiumJS twin in Airfree Maps.

Stream sensor telemetry

Open a WebSocket to subscribe to a stream of sensor updates for a given twin. Each message carries a sensor identifier, a timestamp, and a value, which the client binds to a feature in the 3D scene.

const ws = new WebSocket('wss://airfree.au/api/v1/realtime/twin/adelaide-cbd');

ws.onmessage = (event) => {
  const { sensorId, value, ts } = JSON.parse(event.data);
  twin.updateSensor(sensorId, value, ts);
};

Query and control scene state

The REST surface exposes the twin’s model: 3D Tiles tilesets, feature attributes, and time state. Use it to load a tileset, query an asset’s properties, or drive time-series playback for shadow and flood scenarios.

  • GET /api/v1/realtime/twin/{id}/tileset — the 3D Tiles entry point.
  • GET /api/v1/realtime/twin/{id}/features/{fid} — attributes for one asset.
  • POST /api/v1/realtime/twin/{id}/time — set the scene’s simulation clock.

Rendering

The twin renders through the Maps Embed SDK’s Cesium globe. Sensor overlays and time animation are wired to the streams above, so a browser client shows a live, queryable model without any external mapping service.