Skip to content

The feed object#

Attributes#

idfeed IDrequired
objectstringrequired
Always feed.
airportICAO coderequired
An ICAO airport code.
namestringrequired
kindenumrequired
One of flight_schedule, stand_allocation, surface_track, vehicle_position, workforce_position, weather, sensor, airfield_map.
transportenumrequired
One of push.
priorityintegerrequired
statusenumrequired
One of draft, active, paused.
mapping_versioninteger | nullrequired
The current mapping version
created_attimestamprequired
RFC 3339 in UTC, with up to millisecond precision.
ingest_urlstringrequired
Where the source pushes records.

Feed object

{
  "id": "feed_8b41e07c35",
  "object": "feed",
  "airport": "VTBS",
  "name": "AODB flight schedule",
  "kind": "flight_schedule",
  "transport": "push",
  "priority": 50,
  "status": "draft",
  "mapping_version": null,
  "created_at": "2026-11-23T02:10:04Z",
  "ingest_url": "https://api.surfacelens.app/v1/feeds/feed_8b41e07c35/records"
}

The mapping object#

Attributes#

record_idmapping valuerequired
A JSONPath into the record ($.Stand), a literal ({ "const": "TG" }), a conversion ({ "from": "$.STD", "as": "timestamp" }), or an entity reference ({ "ref": "aircraft", "by": "registration", "from": "$.Reg" }).
observed_atmapping valuerequired
A JSONPath into the record ($.Stand), a literal ({ "const": "TG" }), a conversion ({ "from": "$.STD", "as": "timestamp" }), or an entity reference ({ "ref": "aircraft", "by": "registration", "from": "$.Reg" }).
entityobjectrequired
Child attributes
typeenumrequired
One of aircraft, flight, vehicle, person, stand, runway, taxiway, area, airport.
keymapping valuerequired
A JSONPath into the record ($.Stand), a literal ({ "const": "TG" }), a conversion ({ "from": "$.STD", "as": "timestamp" }), or an entity reference ({ "ref": "aircraft", "by": "registration", "from": "$.Reg" }).
emitarray of objectsrequired
Child attributes
kindenumrequired
One of position, status, schedule, allocation, weather, detection.
dataobjectrequired
Shared-schema attribute names mapped to values.
objectstringrequired
Always mapping.
feedfeed IDrequired
versionintegerrequired
created_attimestamprequired
RFC 3339 in UTC, with up to millisecond precision.

Mapping object

{
  "object": "mapping",
  "feed": "feed_8b41e07c35",
  "version": 1,
  "created_at": "2026-11-23T02:14:30Z",
  "record_id": "$.MsgId",
  "observed_at": {
    "from": "$.LastUpdate",
    "as": "timestamp"
  },
  "entity": {
    "type": "flight",
    "key": "$.FlightId"
  },
  "emit": [
    {
      "kind": "schedule",
      "data": {
        "airline": "$.Airline",
        "number": "$.FltNo",
        "direction": {
          "from": "$.Dir",
          "as": {
            "map": {
              "A": "arrival",
              "D": "departure"
            }
          }
        },
        "origin": "$.Orig",
        "destination": "$.Dest",
        "scheduled_at": {
          "from": "$.STD",
          "as": "timestamp"
        },
        "estimated_at": {
          "from": "$.ETD",
          "as": "timestamp"
        }
      }
    },
    {
      "kind": "allocation",
      "data": {
        "aircraft": {
          "ref": "aircraft",
          "by": "registration",
          "from": "$.Reg"
        },
        "stand": {
          "ref": "stand",
          "from": "$.Stand"
        }
      }
    }
  ]
}

The feed health object#

Attributes#

objectstringrequired
Always feed_health.
feedfeed IDrequired
stateenumrequired
One of healthy, degraded, silent.
windowobjectrequired
Child attributes
fromtimestamprequired
RFC 3339 in UTC, with up to millisecond precision.
totimestamprequired
RFC 3339 in UTC, with up to millisecond precision.
last_record_attimestamp | nullrequired
expected_interval_sintegerrequired
The longest gap between records before the feed counts as silent.
records_per_snumberrequired
rejected_rationumberrequired
latency_msobjectrequired
From observed_at to admission.
Child attributes
p50integer
p95integer
p99integer
recent_errorsarray of objectsrequired
Child attributes
attimestamprequired
RFC 3339 in UTC, with up to millisecond precision.
codestringrequired
messagestringrequired
countintegerrequired

Feed health object

{
  "object": "feed_health",
  "feed": "feed_2c9f7d1e4a",
  "state": "healthy",
  "window": {
    "from": "2026-11-23T02:43:41Z",
    "to": "2026-11-23T02:58:41Z"
  },
  "last_record_at": "2026-11-23T02:58:40.912Z",
  "expected_interval_s": 5,
  "records_per_s": 182.4,
  "rejected_ratio": 0.0004,
  "latency_ms": {
    "p50": 290,
    "p95": 610,
    "p99": 1140
  },
  "recent_errors": [
    {
      "at": "2026-11-23T02:51:18Z",
      "code": "unknown_reference",
      "message": "No aircraft with icao24 \"8a03ff\" is known at VTBS.",
      "count": 6
    }
  ]
}

List feeds#

GET/v1/feeds

Returns the feeds your key can see, newest first.

Requires feeds:read.Preview 1

Query parameters#

airportICAO code
Only feeds for this airport.
statusenum
Only feeds in this status. One of draft, active, paused.
limitinteger
Page size, from 1 to 500. Default 100.
cursorstring
The next_cursor from the previous page. Other parameters must not change between pages. Cursors expire after one hour.

Response#

200 A page of feeds. data holds feed objects.

objectstringrequired
Always list.
dataarray of objectsrequired
Child attributes
idfeed IDrequired
objectstringrequired
Always feed.
airportICAO coderequired
An ICAO airport code.
namestringrequired
kindenumrequired
One of flight_schedule, stand_allocation, surface_track, vehicle_position, workforce_position, weather, sensor, airfield_map.
transportenumrequired
One of push.
priorityintegerrequired
statusenumrequired
One of draft, active, paused.
mapping_versioninteger | nullrequired
The current mapping version
created_attimestamprequired
RFC 3339 in UTC, with up to millisecond precision.
ingest_urlstringrequired
Where the source pushes records.
next_cursorstring | nullrequired
Pass as cursor to fetch the next page. Null on the last page.
curl -G https://api.surfacelens.app/v1/feeds \
  -H "Authorization: Bearer $SURFACELENS_KEY" \
  -d airport=VTBS
const res = await fetch("https://api.surfacelens.app/v1/feeds?airport=VTBS", {
  headers: { Authorization: `Bearer ${process.env.SURFACELENS_KEY}` },
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const page = await res.json();
import httpx, os

res = httpx.get(
    "https://api.surfacelens.app/v1/feeds",
    params={
        "airport": "VTBS",
    },
    headers={"Authorization": f"Bearer {os.environ['SURFACELENS_KEY']}"},
)
res.raise_for_status()
page = res.json()

Response200

{
  "object": "list",
  "data": [
    {
      "id": "feed_8b41e07c35",
      "object": "feed",
      "airport": "VTBS",
      "name": "AODB flight schedule",
      "kind": "flight_schedule",
      "transport": "push",
      "priority": 50,
      "status": "active",
      "mapping_version": 1,
      "created_at": "2026-11-23T02:10:04Z",
      "ingest_url": "https://api.surfacelens.app/v1/feeds/feed_8b41e07c35/records"
    },
    {
      "id": "feed_2c9f7d1e4a",
      "object": "feed",
      "airport": "VTBS",
      "name": "ADS-B and multilateration",
      "kind": "surface_track",
      "transport": "push",
      "priority": 80,
      "status": "active",
      "mapping_version": 7,
      "created_at": "2026-09-02T06:44:51Z",
      "ingest_url": "https://api.surfacelens.app/v1/feeds/feed_2c9f7d1e4a/records"
    }
  ],
  "next_cursor": "c_51f0a3d9e2b6c8a4"
}

Register a feed#

POST/v1/feeds

Registers a data source for one airport. A new feed is draft: set and test its mapping, then activate it. Records pushed to a draft feed are refused with conflict.

Requires feeds:write.Preview 1

Headers#

Idempotency-Keystring
A unique value, such as a UUID, that makes the request safe to retry for 24 hours.

Request body#

airportICAO coderequired
An ICAO airport code.
namestringrequired
kindenumrequired
One of flight_schedule, stand_allocation, surface_track, vehicle_position, workforce_position, weather, sensor, airfield_map.
transportenumrequired
push: the source sends records to ingest_url. Pull transports are planned. One of push.
priorityinteger
When two feeds report the same attribute for the same instant, the higher priority wins. Default 50.

Response#

201 The feed was created. Returns feed object.

curl https://api.surfacelens.app/v1/feeds \
  -H "Authorization: Bearer $SURFACELENS_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "airport": "VTBS",
  "name": "AODB flight schedule",
  "kind": "flight_schedule",
  "transport": "push",
  "priority": 50
}'
const res = await fetch("https://api.surfacelens.app/v1/feeds", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SURFACELENS_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    airport: "VTBS",
    name: "AODB flight schedule",
    kind: "flight_schedule",
    transport: "push",
    priority: 50,
  }),
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const feed = await res.json();
import httpx, os, uuid

res = httpx.post(
    "https://api.surfacelens.app/v1/feeds",
    headers={
        "Authorization": f"Bearer {os.environ['SURFACELENS_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "airport": "VTBS",
        "name": "AODB flight schedule",
        "kind": "flight_schedule",
        "transport": "push",
        "priority": 50,
    },
)
res.raise_for_status()
feed = res.json()

Response201

{
  "id": "feed_8b41e07c35",
  "object": "feed",
  "airport": "VTBS",
  "name": "AODB flight schedule",
  "kind": "flight_schedule",
  "transport": "push",
  "priority": 50,
  "status": "draft",
  "mapping_version": null,
  "created_at": "2026-11-23T02:10:04Z",
  "ingest_url": "https://api.surfacelens.app/v1/feeds/feed_8b41e07c35/records"
}

Retrieve a feed#

GET/v1/feeds/{feed}

Returns one feed.

Requires feeds:read.Preview 1

Path parameters#

feedfeed IDrequired
The feed ID.

Response#

200 The feed. Returns feed object.

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

res = httpx.get(
    "https://api.surfacelens.app/v1/feeds/feed_8b41e07c35",
    headers={"Authorization": f"Bearer {os.environ['SURFACELENS_KEY']}"},
)
res.raise_for_status()
feed = res.json()

Response200

{
  "id": "feed_8b41e07c35",
  "object": "feed",
  "airport": "VTBS",
  "name": "AODB flight schedule",
  "kind": "flight_schedule",
  "transport": "push",
  "priority": 50,
  "status": "draft",
  "mapping_version": 1,
  "created_at": "2026-11-23T02:10:04Z",
  "ingest_url": "https://api.surfacelens.app/v1/feeds/feed_8b41e07c35/records"
}

Update a feed#

PATCH/v1/feeds/{feed}

Changes a feed's name, priority or status. Set status to active to let the feed change the shared model, or paused to stop it without losing its mapping. A feed can only be activated once it has a mapping.

Requires feeds:write.Preview 1

Path parameters#

feedfeed IDrequired
The feed ID.

Request body#

namestring
priorityinteger
statusenum
One of draft, active, paused.

Response#

200 The updated feed. Returns feed object.

curl -X PATCH https://api.surfacelens.app/v1/feeds/feed_8b41e07c35 \
  -H "Authorization: Bearer $SURFACELENS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "status": "active"
}'
const res = await fetch("https://api.surfacelens.app/v1/feeds/feed_8b41e07c35", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.SURFACELENS_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    status: "active",
  }),
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const feed = await res.json();
import httpx, os

res = httpx.patch(
    "https://api.surfacelens.app/v1/feeds/feed_8b41e07c35",
    headers={"Authorization": f"Bearer {os.environ['SURFACELENS_KEY']}"},
    json={
        "status": "active",
    },
)
res.raise_for_status()
feed = res.json()

Response200

{
  "id": "feed_8b41e07c35",
  "object": "feed",
  "airport": "VTBS",
  "name": "AODB flight schedule",
  "kind": "flight_schedule",
  "transport": "push",
  "priority": 50,
  "status": "active",
  "mapping_version": 1,
  "created_at": "2026-11-23T02:10:04Z",
  "ingest_url": "https://api.surfacelens.app/v1/feeds/feed_8b41e07c35/records"
}

Set the mapping#

PUT/v1/feeds/{feed}/mapping

Replaces the feed's mapping and returns the new version. A mapping turns one source record into one or more observations about one entity. Records already received keep the mapping version they were mapped with.

Requires feeds:write.Preview 1

Path parameters#

feedfeed IDrequired
The feed ID.

Request body#

record_idmapping valuerequired
A JSONPath into the record ($.Stand), a literal ({ "const": "TG" }), a conversion ({ "from": "$.STD", "as": "timestamp" }), or an entity reference ({ "ref": "aircraft", "by": "registration", "from": "$.Reg" }).
observed_atmapping valuerequired
A JSONPath into the record ($.Stand), a literal ({ "const": "TG" }), a conversion ({ "from": "$.STD", "as": "timestamp" }), or an entity reference ({ "ref": "aircraft", "by": "registration", "from": "$.Reg" }).
entityobjectrequired
Child attributes
typeenumrequired
One of aircraft, flight, vehicle, person, stand, runway, taxiway, area, airport.
keymapping valuerequired
A JSONPath into the record ($.Stand), a literal ({ "const": "TG" }), a conversion ({ "from": "$.STD", "as": "timestamp" }), or an entity reference ({ "ref": "aircraft", "by": "registration", "from": "$.Reg" }).
emitarray of objectsrequired
Child attributes
kindenumrequired
One of position, status, schedule, allocation, weather, detection.
dataobjectrequired
Shared-schema attribute names mapped to values.

Response#

200 The stored mapping. Returns mapping object.

curl -X PUT https://api.surfacelens.app/v1/feeds/feed_8b41e07c35/mapping \
  -H "Authorization: Bearer $SURFACELENS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "record_id": "$.MsgId",
  "observed_at": {
    "from": "$.LastUpdate",
    "as": "timestamp"
  },
  "entity": {
    "type": "flight",
    "key": "$.FlightId"
  },
  "emit": [
    {
      "kind": "schedule",
      "data": {
        "airline": "$.Airline",
        "number": "$.FltNo",
        "direction": {
          "from": "$.Dir",
          "as": {
            "map": {
              "A": "arrival",
              "D": "departure"
            }
          }
        },
        "origin": "$.Orig",
        "destination": "$.Dest",
        "scheduled_at": {
          "from": "$.STD",
          "as": "timestamp"
        },
        "estimated_at": {
          "from": "$.ETD",
          "as": "timestamp"
        }
      }
    },
    {
      "kind": "allocation",
      "data": {
        "aircraft": {
          "ref": "aircraft",
          "by": "registration",
          "from": "$.Reg"
        },
        "stand": {
          "ref": "stand",
          "from": "$.Stand"
        }
      }
    }
  ]
}'
const res = await fetch("https://api.surfacelens.app/v1/feeds/feed_8b41e07c35/mapping", {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.SURFACELENS_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    record_id: "$.MsgId",
    observed_at: {
      from: "$.LastUpdate",
      as: "timestamp",
    },
    entity: {
      type: "flight",
      key: "$.FlightId",
    },
    emit: [
      {
        kind: "schedule",
        data: {
          airline: "$.Airline",
          number: "$.FltNo",
          direction: {
            from: "$.Dir",
            as: {
              map: {
                A: "arrival",
                D: "departure",
              },
            },
          },
          origin: "$.Orig",
          destination: "$.Dest",
          scheduled_at: {
            from: "$.STD",
            as: "timestamp",
          },
          estimated_at: {
            from: "$.ETD",
            as: "timestamp",
          },
        },
      },
      {
        kind: "allocation",
        data: {
          aircraft: {
            ref: "aircraft",
            by: "registration",
            from: "$.Reg",
          },
          stand: {
            ref: "stand",
            from: "$.Stand",
          },
        },
      },
    ],
  }),
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const mapping = await res.json();
import httpx, os

res = httpx.put(
    "https://api.surfacelens.app/v1/feeds/feed_8b41e07c35/mapping",
    headers={"Authorization": f"Bearer {os.environ['SURFACELENS_KEY']}"},
    json={
        "record_id": "$.MsgId",
        "observed_at": {
            "from": "$.LastUpdate",
            "as": "timestamp",
        },
        "entity": {
            "type": "flight",
            "key": "$.FlightId",
        },
        "emit": [
            {
                "kind": "schedule",
                "data": {
                    "airline": "$.Airline",
                    "number": "$.FltNo",
                    "direction": {
                        "from": "$.Dir",
                        "as": {
                            "map": {
                                "A": "arrival",
                                "D": "departure",
                            },
                        },
                    },
                    "origin": "$.Orig",
                    "destination": "$.Dest",
                    "scheduled_at": {
                        "from": "$.STD",
                        "as": "timestamp",
                    },
                    "estimated_at": {
                        "from": "$.ETD",
                        "as": "timestamp",
                    },
                },
            },
            {
                "kind": "allocation",
                "data": {
                    "aircraft": {
                        "ref": "aircraft",
                        "by": "registration",
                        "from": "$.Reg",
                    },
                    "stand": {
                        "ref": "stand",
                        "from": "$.Stand",
                    },
                },
            },
        ],
    },
)
res.raise_for_status()
mapping = res.json()

Response200

{
  "object": "mapping",
  "feed": "feed_8b41e07c35",
  "version": 1,
  "created_at": "2026-11-23T02:14:30Z",
  "record_id": "$.MsgId",
  "observed_at": {
    "from": "$.LastUpdate",
    "as": "timestamp"
  },
  "entity": {
    "type": "flight",
    "key": "$.FlightId"
  },
  "emit": [
    {
      "kind": "schedule",
      "data": {
        "airline": "$.Airline",
        "number": "$.FltNo",
        "direction": {
          "from": "$.Dir",
          "as": {
            "map": {
              "A": "arrival",
              "D": "departure"
            }
          }
        },
        "origin": "$.Orig",
        "destination": "$.Dest",
        "scheduled_at": {
          "from": "$.STD",
          "as": "timestamp"
        },
        "estimated_at": {
          "from": "$.ETD",
          "as": "timestamp"
        }
      }
    },
    {
      "kind": "allocation",
      "data": {
        "aircraft": {
          "ref": "aircraft",
          "by": "registration",
          "from": "$.Reg"
        },
        "stand": {
          "ref": "stand",
          "from": "$.Stand"
        }
      }
    }
  ]
}

Test a mapping#

POST/v1/feeds/{feed}/mapping/test

Runs sample records through a mapping without storing anything. Pass mapping to test a draft, or omit it to test the feed's current mapping. Each record returns either the observations it would produce or the errors that stop it.

Requires feeds:write.Preview 1

Path parameters#

feedfeed IDrequired
The feed ID.

Request body#

mappingobject
A draft mapping. Omit to use the stored mapping.
Child attributes
record_idmapping valuerequired
A JSONPath into the record ($.Stand), a literal ({ "const": "TG" }), a conversion ({ "from": "$.STD", "as": "timestamp" }), or an entity reference ({ "ref": "aircraft", "by": "registration", "from": "$.Reg" }).
observed_atmapping valuerequired
A JSONPath into the record ($.Stand), a literal ({ "const": "TG" }), a conversion ({ "from": "$.STD", "as": "timestamp" }), or an entity reference ({ "ref": "aircraft", "by": "registration", "from": "$.Reg" }).
entityobjectrequired
Child attributes
typeenumrequired
One of aircraft, flight, vehicle, person, stand, runway, taxiway, area, airport.
keymapping valuerequired
A JSONPath into the record ($.Stand), a literal ({ "const": "TG" }), a conversion ({ "from": "$.STD", "as": "timestamp" }), or an entity reference ({ "ref": "aircraft", "by": "registration", "from": "$.Reg" }).
emitarray of objectsrequired
Child attributes
kindenumrequired
One of position, status, schedule, allocation, weather, detection.
dataobjectrequired
Shared-schema attribute names mapped to values.
recordsarray of objectsrequired
Source records, exactly as the feed sends them.

Response#

200 The result for each record, in request order.

objectstringrequired
Always mapping_test.
mapping_versioninteger | nullrequired
The stored version tested, or null for a draft.
resultsarray of objectsrequired
Child attributes
indexintegerrequired
okbooleanrequired
entityentity ID
type:key. The key is stable for the life of the entity.
observationsarray of objectsrequired
Child attributes
kindenumrequired
One of position, status, schedule, allocation, weather, detection.
observed_attimestamprequired
RFC 3339 in UTC, with up to millisecond precision.
dataobjectrequired
errorsarray of objectsrequired
Child attributes
codeenumrequired
conflict: a record with this record_id was already admitted with different content. One of missing_field, invalid_value, unknown_reference, conflict.
pathstringrequired
The JSONPath in the record or mapping that failed.
messagestringrequired
curl https://api.surfacelens.app/v1/feeds/feed_8b41e07c35/mapping/test \
  -H "Authorization: Bearer $SURFACELENS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "records": [
    {
      "MsgId": "AODB-7781243",
      "FlightId": "TG403-20261123",
      "Airline": "TG",
      "FltNo": "403",
      "Dir": "D",
      "Orig": "VTBS",
      "Dest": "WSSS",
      "STD": "2026-11-23T10:25:00+07:00",
      "ETD": "2026-11-23T10:35:00+07:00",
      "Reg": "HS-THB",
      "Stand": "C2",
      "LastUpdate": "2026-11-23T09:40:12+07:00"
    }
  ]
}'
const res = await fetch("https://api.surfacelens.app/v1/feeds/feed_8b41e07c35/mapping/test", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SURFACELENS_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    records: [
      {
        MsgId: "AODB-7781243",
        FlightId: "TG403-20261123",
        Airline: "TG",
        FltNo: "403",
        Dir: "D",
        Orig: "VTBS",
        Dest: "WSSS",
        STD: "2026-11-23T10:25:00+07:00",
        ETD: "2026-11-23T10:35:00+07:00",
        Reg: "HS-THB",
        Stand: "C2",
        LastUpdate: "2026-11-23T09:40:12+07:00",
      },
    ],
  }),
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const mappingTest = await res.json();
import httpx, os

res = httpx.post(
    "https://api.surfacelens.app/v1/feeds/feed_8b41e07c35/mapping/test",
    headers={"Authorization": f"Bearer {os.environ['SURFACELENS_KEY']}"},
    json={
        "records": [
            {
                "MsgId": "AODB-7781243",
                "FlightId": "TG403-20261123",
                "Airline": "TG",
                "FltNo": "403",
                "Dir": "D",
                "Orig": "VTBS",
                "Dest": "WSSS",
                "STD": "2026-11-23T10:25:00+07:00",
                "ETD": "2026-11-23T10:35:00+07:00",
                "Reg": "HS-THB",
                "Stand": "C2",
                "LastUpdate": "2026-11-23T09:40:12+07:00",
            },
        ],
    },
)
res.raise_for_status()
mapping_test = res.json()

Response200

{
  "object": "mapping_test",
  "mapping_version": 1,
  "results": [
    {
      "index": 0,
      "ok": true,
      "entity": "flight:TG403-20261123",
      "observations": [
        {
          "kind": "schedule",
          "observed_at": "2026-11-23T02:40:12Z",
          "data": {
            "airline": "TG",
            "number": "403",
            "direction": "departure",
            "origin": "VTBS",
            "destination": "WSSS",
            "scheduled_at": "2026-11-23T03:25:00Z",
            "estimated_at": "2026-11-23T03:35:00Z"
          }
        },
        {
          "kind": "allocation",
          "observed_at": "2026-11-23T02:40:12Z",
          "data": {
            "aircraft": "aircraft:8851a4",
            "stand": "stand:C2"
          }
        }
      ],
      "errors": []
    }
  ]
}

Push records#

POST/v1/feeds/{feed}/records

Accepts up to 500 source records in the feed's own format. Each record is mapped and admitted independently; one bad record does not stop the others. A record whose record_id was already admitted with the same content returns duplicate, so retrying a whole batch is safe. Records may arrive in any order: observed_at, not arrival order, places them in time.

Requires records:write.Preview 1

Path parameters#

feedfeed IDrequired
The feed ID.

Request body#

recordsarray of objectsrequired
Source records, exactly as the feed produces them. The request body may not exceed 1 MiB.

Response#

200 One result per record, in request order.

objectstringrequired
Always ingest_result.
resultsarray of objectsrequired
Child attributes
indexintegerrequired
record_idstringrequired
statusenumrequired
duplicate means this record was already admitted with identical content. One of admitted, duplicate, rejected.
observationsarray of observation IDsrequired
errorsarray of objectsrequired
Child attributes
codeenumrequired
conflict: a record with this record_id was already admitted with different content. One of missing_field, invalid_value, unknown_reference, conflict.
pathstringrequired
The JSONPath in the record or mapping that failed.
messagestringrequired
curl https://api.surfacelens.app/v1/feeds/feed_8b41e07c35/records \
  -H "Authorization: Bearer $SURFACELENS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "records": [
    {
      "MsgId": "AODB-7781243",
      "FlightId": "TG403-20261123",
      "Airline": "TG",
      "FltNo": "403",
      "Dir": "D",
      "Orig": "VTBS",
      "Dest": "WSSS",
      "STD": "2026-11-23T10:25:00+07:00",
      "ETD": "2026-11-23T10:35:00+07:00",
      "Reg": "HS-THB",
      "Stand": "C2",
      "LastUpdate": "2026-11-23T09:40:12+07:00"
    },
    {
      "MsgId": "AODB-7781244",
      "FlightId": "EK385-20261123",
      "Airline": "EK",
      "FltNo": "385",
      "Dir": "A",
      "Orig": "OMDB",
      "Dest": "VTBS",
      "STD": "2026-11-23T12:05:00+07:00",
      "ETD": "2026-11-23T11:58:00+07:00",
      "Reg": "A6-EGO",
      "Stand": "C2",
      "LastUpdate": "2026-11-23T09:40:12+07:00"
    }
  ]
}'
const res = await fetch("https://api.surfacelens.app/v1/feeds/feed_8b41e07c35/records", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SURFACELENS_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    records: [
      {
        MsgId: "AODB-7781243",
        FlightId: "TG403-20261123",
        Airline: "TG",
        FltNo: "403",
        Dir: "D",
        Orig: "VTBS",
        Dest: "WSSS",
        STD: "2026-11-23T10:25:00+07:00",
        ETD: "2026-11-23T10:35:00+07:00",
        Reg: "HS-THB",
        Stand: "C2",
        LastUpdate: "2026-11-23T09:40:12+07:00",
      },
      {
        MsgId: "AODB-7781244",
        FlightId: "EK385-20261123",
        Airline: "EK",
        FltNo: "385",
        Dir: "A",
        Orig: "OMDB",
        Dest: "VTBS",
        STD: "2026-11-23T12:05:00+07:00",
        ETD: "2026-11-23T11:58:00+07:00",
        Reg: "A6-EGO",
        Stand: "C2",
        LastUpdate: "2026-11-23T09:40:12+07:00",
      },
    ],
  }),
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const ingestResult = await res.json();
import httpx, os

res = httpx.post(
    "https://api.surfacelens.app/v1/feeds/feed_8b41e07c35/records",
    headers={"Authorization": f"Bearer {os.environ['SURFACELENS_KEY']}"},
    json={
        "records": [
            {
                "MsgId": "AODB-7781243",
                "FlightId": "TG403-20261123",
                "Airline": "TG",
                "FltNo": "403",
                "Dir": "D",
                "Orig": "VTBS",
                "Dest": "WSSS",
                "STD": "2026-11-23T10:25:00+07:00",
                "ETD": "2026-11-23T10:35:00+07:00",
                "Reg": "HS-THB",
                "Stand": "C2",
                "LastUpdate": "2026-11-23T09:40:12+07:00",
            },
            {
                "MsgId": "AODB-7781244",
                "FlightId": "EK385-20261123",
                "Airline": "EK",
                "FltNo": "385",
                "Dir": "A",
                "Orig": "OMDB",
                "Dest": "VTBS",
                "STD": "2026-11-23T12:05:00+07:00",
                "ETD": "2026-11-23T11:58:00+07:00",
                "Reg": "A6-EGO",
                "Stand": "C2",
                "LastUpdate": "2026-11-23T09:40:12+07:00",
            },
        ],
    },
)
res.raise_for_status()
ingest_result = res.json()

Response200

{
  "object": "ingest_result",
  "results": [
    {
      "index": 0,
      "record_id": "AODB-7781243",
      "status": "admitted",
      "observations": [
        "obs_5Hv1Xb7sM3jk",
        "obs_8Tq4Bn2xC6wd"
      ],
      "errors": []
    },
    {
      "index": 1,
      "record_id": "AODB-7781244",
      "status": "admitted",
      "observations": [
        "obs_0Yb5Qz7gL3ne",
        "obs_7Jd3Fs9vK1pa"
      ],
      "errors": []
    }
  ]
}

Retrieve feed health#

GET/v1/feeds/{feed}/health

Returns throughput, latency and errors for the last 15 minutes. state is healthy, degraded when latency or the rejection rate exceeds the feed's thresholds, or silent when no record has arrived within expected_interval_s.

Requires feeds:read.Preview 1

Path parameters#

feedfeed IDrequired
The feed ID.

Response#

200 The feed's health. Returns feed health object.

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

res = httpx.get(
    "https://api.surfacelens.app/v1/feeds/feed_2c9f7d1e4a/health",
    headers={"Authorization": f"Bearer {os.environ['SURFACELENS_KEY']}"},
)
res.raise_for_status()
feed_health = res.json()

Response200

{
  "object": "feed_health",
  "feed": "feed_2c9f7d1e4a",
  "state": "healthy",
  "window": {
    "from": "2026-11-23T02:43:41Z",
    "to": "2026-11-23T02:58:41Z"
  },
  "last_record_at": "2026-11-23T02:58:40.912Z",
  "expected_interval_s": 5,
  "records_per_s": 182.4,
  "rejected_ratio": 0.0004,
  "latency_ms": {
    "p50": 290,
    "p95": 610,
    "p99": 1140
  },
  "recent_errors": [
    {
      "at": "2026-11-23T02:51:18Z",
      "code": "unknown_reference",
      "message": "No aircraft with icao24 \"8a03ff\" is known at VTBS.",
      "count": 6
    }
  ]
}