Skip to content

Quickstart#

Make your first call in about five minutes. You will read an airport, find the aircraft near a stand, and read the same place half an hour earlier.

You need a test key and one of: curl, Node.js 20 or later (or Bun, or Deno), or Python 3.9 or later with httpx.

Test keys read the sandbox: a simulated operating day at Suvarnabhumi (VTBS) on 23 November 2026, with schedules, stand allocations, surface tracks and weather. The sandbox never changes, so the responses on this page are the responses you get.

Set your key#

During the preview, the SurfaceLens team sends each partner a test key that starts with sl_test_. Export it so the examples can read it.

export SURFACELENS_KEY=sl_test_9xKq2VwM7pLr4TnB8cYz3HdF

Send it as a bearer token on every request. Keep it out of source control; a key can read everything its application is allowed to read.

Read the airport#

Request the airport by its ICAO code.

curl https://api.surfacelens.app/v1/airports/VTBS \
  -H "Authorization: Bearer $SURFACELENS_KEY"
const res = await fetch("https://api.surfacelens.app/v1/airports/VTBS", {
  headers: { Authorization: `Bearer ${process.env.SURFACELENS_KEY}` },
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
console.log(await res.json());
import os, httpx

res = httpx.get(
    "https://api.surfacelens.app/v1/airports/VTBS",
    headers={"Authorization": f"Bearer {os.environ['SURFACELENS_KEY']}"},
)
res.raise_for_status()
print(res.json())
{
  "id": "VTBS",
  "object": "airport",
  "iata": "BKK",
  "name": "Suvarnabhumi Airport",
  "timezone": "Asia/Bangkok",
  "reference_point": { "lat": 13.69, "lon": 100.7501 },
  "elevation_ft": 5,
  "home_region": "apac",
  "airfield_version": "2026-10-30.2",
  "onprem_node": "https://surfacelens.vtbs.internal/v1",
  "environment": "test"
}

environment is test, so you are reading the sandbox. A 401 means the key is missing or mistyped; see Errors.

Find the aircraft near a stand#

Stand C2 is at 13.69214° N, 100.75388° E. Ask for aircraft within 600 metres of it at 09:58:41 Bangkok time, which is 02:58:41 UTC. The API takes and returns UTC.

curl -G https://api.surfacelens.app/v1/airports/VTBS/entities \
  -H "Authorization: Bearer $SURFACELENS_KEY" \
  -d type=aircraft \
  -d near=13.69214,100.75388 \
  -d radius=600 \
  -d at=2026-11-23T02:58:41Z
const params = new URLSearchParams({
  type: "aircraft",
  near: "13.69214,100.75388",
  radius: "600",
  at: "2026-11-23T02:58:41Z",
});
const res = await fetch(
  `https://api.surfacelens.app/v1/airports/VTBS/entities?${params}`,
  { headers: { Authorization: `Bearer ${process.env.SURFACELENS_KEY}` } },
);
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const page = await res.json();
for (const aircraft of page.data) {
  console.log(aircraft.label, aircraft.distance_m, aircraft.attributes.movement);
}
import os, httpx

res = httpx.get(
    "https://api.surfacelens.app/v1/airports/VTBS/entities",
    params={
        "type": "aircraft",
        "near": "13.69214,100.75388",
        "radius": 600,
        "at": "2026-11-23T02:58:41Z",
    },
    headers={"Authorization": f"Bearer {os.environ['SURFACELENS_KEY']}"},
)
res.raise_for_status()
for aircraft in res.json()["data"]:
    print(aircraft["label"], aircraft["distance_m"], aircraft["attributes"]["movement"])
{
  "object": "list",
  "airport": "VTBS",
  "at": "2026-11-23T02:58:41Z",
  "revision": 48213377,
  "data": [
    {
      "id": "aircraft:8851a4",
      "object": "entity",
      "type": "aircraft",
      "label": "HS-THB",
      "position": { "lat": 13.69212, "lon": 100.75391 },
      "distance_m": 3.6,
      "attributes": {
        "registration": "HS-THB",
        "aircraft_type": "A359",
        "flight": "flight:TG403-20261123",
        "stand": "stand:C2",
        "movement": "parked"
      },
      "observed_at": "2026-11-23T02:58:39.800Z"
    },
    {
      "id": "aircraft:76cd51",
      "object": "entity",
      "type": "aircraft",
      "label": "9V-SMF",
      "position": { "lat": 13.69331, "lon": 100.75302 },
      "distance_m": 160.2,
      "attributes": {
        "registration": "9V-SMF",
        "aircraft_type": "A359",
        "flight": "flight:SQ709-20261123",
        "stand": "stand:C4",
        "movement": "taxi"
      },
      "observed_at": "2026-11-23T02:58:40.600Z"
    }
  ],
  "next_cursor": null
}

Thai Airways HS-THB is parked on C2 for TG403 to Singapore. Singapore Airlines 9V-SMF has landed as SQ709 and is taxiing to C4. Some attributes are omitted here; the entity reference lists them all.

The two aircraft came from different feeds: positions from ADS-B, stands from the stand allocation system, flights from the AODB. You did not need to know that. Each attribute's source is in provenance if you want it.

Look back in time#

Change at to 02:30 UTC and send the same request.

curl -G https://api.surfacelens.app/v1/airports/VTBS/entities \
  -H "Authorization: Bearer $SURFACELENS_KEY" \
  -d type=aircraft \
  -d near=13.69214,100.75388 \
  -d radius=600 \
  -d at=2026-11-23T02:30:00Z
{
  "object": "list",
  "airport": "VTBS",
  "at": "2026-11-23T02:30:00Z",
  "revision": 48064120,
  "data": [
    {
      "id": "aircraft:8851a4",
      "label": "HS-THB",
      "distance_m": 3.6,
      "attributes": { "stand": "stand:C2", "movement": "parked" }
    }
  ],
  "next_cursor": null
}

Half an hour earlier, 9V-SMF had not yet landed. Every read in the API takes at, so the same code serves a live board, an incident review and a test against a fixed instant.

Next#

Understand the model
The shared model explains entities, observations and provenance. Time and replay explains at, known_at and revisions.
Bring your own data
Connect a feed maps a flight schedule into the shared schema, step by step.
Build an application
Query the airfield, then subscribe to changes to keep a view current without polling.
Go to production
Applications and scopes covers live keys and permissions. Edge and on-premise covers where requests go and what happens when the network fails.