Skip to content

Time and replay#

Every read in the API can be asked about a past instant. SurfaceLens keeps two times for every fact, so it can tell you what was true then and what was known then.

Two clocks#

Each observation has two timestamps.

observed_at
When the source says the fact was true. An ADS-B position at 02:58:00.4.
received_at
When SurfaceLens admitted it. The same position, 312 ms later.

Usually the gap is under a second. Sometimes it is not: a stand system that batches updates every five minutes, a feed that reconnects after an outage and sends its backlog, a correction entered by hand an hour later.

Reading an instant#

Two query parameters select what you read. Both take an RFC 3339 timestamp in UTC.

at
The instant to describe. Only observations with observed_at at or before at count. Omit it for now.
known_at
Only observations with received_at at or before known_at count. Omit it to use everything received so far, including late data and corrections.

The difference matters when you investigate.

# What was true at 10:12 local, as best we know today.
curl -G https://api.surfacelens.app/v1/airports/VTBS/entities/stand:C2 \
  -H "Authorization: Bearer $SURFACELENS_KEY" \
  -d at=2026-11-23T03:12:00Z

# What the stand board could have shown at 10:12, from what had arrived by then.
curl -G https://api.surfacelens.app/v1/airports/VTBS/entities/stand:C2 \
  -H "Authorization: Bearer $SURFACELENS_KEY" \
  -d at=2026-11-23T03:12:00Z \
  -d known_at=2026-11-23T03:12:00Z

If the two answers differ, some feed reported late or was corrected afterwards, and provenance tells you which.

Timestamps#

The API accepts and returns UTC only, with a Z suffix and up to millisecond precision: 2026-11-23T02:58:41.200Z. Offsets such as +07:00 are rejected with invalid_parameter. Each airport has a timezone, Asia/Bangkok for VTBS, for display. Source records may use any offset; the mapping converts them.

Consistent pages#

A query that returns several pages reads every page at the same instant and the same revision. The at and revision of the first page hold for the rest. New observations arriving between pages do not shift results from one page to the next.

Replay#

Replay is a stream that starts in the past. Open the events stream with from, and SurfaceLens sends the state at that instant followed by every change in order, at speed times real time. Without until, it continues into live changes once it catches up. The client code is the same for live and replay. See Replay an instant.

Retention#

Where What is kept
Edge Every observation, for the term of the airport's agreement. The default is 25 months.
On-premise node The last 72 hours. Older reads are forwarded to the edge when it is reachable.
Sandbox One simulated day, 23 November 2026, at VTBS.

A read before the retained range returns time_out_of_range.