Query the airfield#
Most questions an airside application asks are spatial: what is near this stand, what is on this runway, which vehicles are on apron C. This guide covers the three ways to ask them and how to combine them with time.
The examples read the sandbox at 02:58:41 UTC (09:58:41 in Bangkok), two minutes before runway 02R-20L closes for an inspection.
Near a point#
GET /entities with near and radius returns entities within a distance of a point, nearest first. Each result carries distance_m.
curl -G https://api.surfacelens.app/v1/airports/VTBS/entities \
-H "Authorization: Bearer $SURFACELENS_KEY" \
-d type=aircraft,vehicle \
-d near=13.69214,100.75388 \
-d radius=150 \
-d at=2026-11-23T02:58:41Z
{
"object": "list",
"airport": "VTBS",
"at": "2026-11-23T02:58:41Z",
"revision": 48213377,
"data": [
{
"id": "aircraft:8851a4",
"label": "HS-THB",
"distance_m": 3.6,
"attributes": { "stand": "stand:C2", "movement": "parked" }
},
{
"id": "vehicle:TUG-114",
"label": "Pushback tug 114",
"distance_m": 18.2,
"attributes": { "vehicle_type": "pushback_tug", "assigned_flight": "flight:TG403-20261123" }
}
],
"next_cursor": null
}
The radius is a great-circle distance in metres, up to 20 km. Distance is measured to the entity's reported position, which for an aircraft is its ADS-B reference point, not the nearest part of the airframe.
Inside an airfield feature#
Runways, taxiways, aprons and stands are features of the airfield model. Search inside one by ID, optionally grown by a buffer. This finds every vehicle and person within the runway strip of 02R-20L: the runway plus 75 metres either side.
const res = await fetch(
"https://api.surfacelens.app/v1/airports/VTBS/entities/search",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SURFACELENS_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
within: { feature: "runway:02R-20L", buffer_m: 75 },
types: ["vehicle", "person"],
at: "2026-11-23T02:58:41Z",
}),
},
);
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const { data } = await res.json();
import os, httpx
res = httpx.post(
"https://api.surfacelens.app/v1/airports/VTBS/entities/search",
headers={"Authorization": f"Bearer {os.environ['SURFACELENS_KEY']}"},
json={
"within": {"feature": "runway:02R-20L", "buffer_m": 75},
"types": ["vehicle", "person"],
"at": "2026-11-23T02:58:41Z",
},
)
res.raise_for_status()
data = res.json()["data"]
{
"object": "list",
"airport": "VTBS",
"at": "2026-11-23T02:58:41Z",
"revision": 48213377,
"data": [
{
"id": "vehicle:FM-07",
"label": "Follow-me 07",
"position": { "lat": 13.68342, "lon": 100.74251 },
"attributes": {
"vehicle_type": "follow_me",
"movement": "moving",
"runway_clearance": "runway:02R-20L"
}
}
],
"next_cursor": null
}
Follow-me 07 is on the runway with a clearance for it: the inspection vehicle, ahead of the closure.
Inside a polygon#
For an area the airfield model does not name, pass a GeoJSON polygon. Coordinates are longitude first, as GeoJSON requires, and the ring is closed.
{
"within": {
"polygon": {
"type": "Polygon",
"coordinates": [[
[100.7510, 13.6885], [100.7562, 13.6885],
[100.7562, 13.6948], [100.7510, 13.6948],
[100.7510, 13.6885]
]]
}
},
"types": ["vehicle"]
}
Polygons may have up to 500 vertices and must not cross themselves. Searches are POST because polygons are too long for a query string, but they read data and are always safe to retry.
At another instant#
Every spatial query takes at. Without it, you get now. With it, you get the airfield as it was, built from the observations up to that instant. The response's at and revision tell you exactly what you read.
To compare one area over time, repeat the query with different values of at. To watch it continuously, use a stream with a bounding box instead of polling.
Many results#
Lists return 100 entities by default and up to 500 with limit. When there are more, next_cursor is set; pass it back as cursor with the same parameters.
let cursor: string | null = null;
do {
const params = new URLSearchParams({ type: "vehicle", at: "2026-11-23T02:58:41Z", limit: "500" });
if (cursor) params.set("cursor", cursor);
const res = await fetch(
`https://api.surfacelens.app/v1/airports/VTBS/entities?${params}`,
{ headers: { Authorization: `Bearer ${process.env.SURFACELENS_KEY}` } },
);
const page = await res.json();
for (const vehicle of page.data) console.log(vehicle.id);
cursor = page.next_cursor;
} while (cursor);
Every page is read at the instant and revision of the first, so a vehicle never appears twice or goes missing between pages.
Permissions#
Results contain only the entity types your application may read. A key without person in its entity_types gets no people from the runway search above, and no error: to that application, they are not there. See Applications and scopes.