Skip to content

API reference#

The SurfaceLens API is JSON over HTTPS, with server-sent events for streams. This page covers what every endpoint shares. The pages that follow cover each resource and are generated from openapi.yaml, the OpenAPI 3.1 description that is the source of truth.

Preview design

No endpoint is served yet. Each operation is marked with the preview release that will first serve it. See Status and changelog.

Resources#

Resource Covers
Airports Airports your key can read, and each one's airfield model
Entities State of aircraft, flights, vehicles and stands at any instant; spatial search
Observations The facts reported by feeds, with their raw records
Events Live and replayed streams of changes
Feeds Sources, their mappings, pushed records and health
Scenarios What-if simulations of an airport day
Webhooks Callbacks for operational events
Applications Applications, their limits, and keys
Gateway The status of the node you are talking to
Partner observations Inspection reports and aircraft positions under the draft observation gateway contract, and aircraft near a point
Errors Error codes and when to retry

Base URLs#

Base URL Use
https://api.surfacelens.app/v1 The edge. Every client, from anywhere.
https://surfacelens.vtbs.internal/v1 An airport's on-premise node, from inside its network. The host name is set per airport and published as onprem_node on the airport object.

Both serve the same API with the same keys. See Edge and on-premise.

Authentication#

Send an API key as a bearer token on every request.

curl https://api.surfacelens.app/v1/airports \
  -H "Authorization: Bearer $SURFACELENS_KEY"

Keys starting sl_test_ read the sandbox and write to a private copy of it. Keys starting sl_live_ read and write real airport data. A key acts for one application, which limits it to certain airports, scopes, entity types and feeds. Each operation lists the scope it needs.

Versioning#

The version is in the path. Within /v1, changes are additive: new endpoints, new optional parameters, new response fields, new enum values and new error codes. Write clients that ignore fields they do not know and handle unknown enum values.

Removing or renaming anything, or changing a type, happens only in a new major version. When /v2 ships, /v1 stays supported for at least 12 months.

The preview is exempt: until v1 is generally available, any part of it may change. Every change is listed in the changelog.

Requests and responses#

  • Request and response bodies are JSON, UTF-8, with Content-Type: application/json. Errors use application/problem+json.
  • Field names are snake_case. Absent values are null, not omitted, unless a field is documented as optional.
  • Every response carries SurfaceLens-Request-Id, and SurfaceLens-Node naming the node that answered.
  • The partner observation operations follow the draft observation gateway contract instead of these conventions: field names are camelCase, and an error is a JSON object whose error member holds a code and a message.

IDs#

Kind Form Example
Airport ICAO code VTBS
Entity type:key, stable across feeds aircraft:8851a4, stand:C2, flight:TG403-20261123
Everything else prefix, underscore, random feed_8b41e07c35, obs_5Hv1Xb7sM3jk, scn_5e8c1b72d9

Entity keys are case-sensitive. Treat all IDs as opaque strings of up to 128 characters.

Timestamps#

Timestamps are RFC 3339 strings in UTC with a Z suffix, with up to millisecond precision: 2026-11-23T02:58:41Z, 2026-11-23T02:58:44.900Z. Requests with another offset are rejected with invalid_parameter. Convert local airport times before you send them; each airport's timezone is on the airport object. Read endpoints take at and known_at; see Time and history.

Pagination#

List endpoints return up to limit items (default 100, maximum 500) and a next_cursor. Pass the cursor back as cursor, with the other parameters unchanged, to get the next page. next_cursor is null on the last page.

{
  "object": "list",
  "data": [],
  "next_cursor": "c_7a20e4f1b95d3c68"
}

Lists of entities and observations are read at one instant and revision: every page of a list sees the same data, however long you take to fetch them. Cursors expire after one hour; an expired cursor returns 400 invalid_parameter.

Idempotency#

Send an Idempotency-Key header, such as a UUID, with any POST that creates something. If the request is repeated with the same key within 24 hours, SurfaceLens returns the first response instead of acting again, including when the first attempt failed with a timeout on your side. Reusing a key with a different request returns 409 idempotency_key_reused.

GET, PUT and DELETE are idempotent by definition. Pushing records does not need the header: each record's record_id makes it safe to repeat.

Rate limits#

Limit Per Value
Requests Key 100 per second, bursts up to 200
Open event streams Key 20
Request body Request 1 MiB
Records in one push Request 500
Mapping test records Request 50
Scenarios running Application 5

Responses carry RateLimit and RateLimit-Policy headers:

RateLimit: limit=100, remaining=37, reset=1
RateLimit-Policy: 100;w=1;burst=200

Over a limit, you get 429 rate_limited with Retry-After. Limits on the on-premise node are the same and counted separately.

Testing#

Test keys work against a sandbox of VTBS that replays a recorded airport day, with the clock set so that the sandbox's "now" is 2026-11-23T02:58:41Z. Writes go to a private copy that is discarded after 24 hours.

With a test key, the SurfaceLens-Simulate: edge_unavailable header makes the edge answer as it would in an outage, and https://sandbox-node.surfacelens.app/v1 acts as an on-premise node. See Fail over to on-premise.