Skip to content

Webhooks#

HTTPS callbacks for low-rate operational events.

The webhook object#

Attributes#

idstringrequired
objectstringrequired
Always webhook.
urlstringrequired
eventsarray of enumsrequired
airportsarray of ICAO codesrequired
statusenumrequired
disabled after 24 hours of failed deliveries. One of enabled, disabled.
secretstring
Signing secret. Returned only on creation.
created_attimestamprequired
RFC 3339 in UTC, with up to millisecond precision.

Webhook object

{
  "id": "wh_0a7d3e91c4",
  "object": "webhook",
  "url": "https://ops-board.example.net/hooks/surfacelens",
  "events": [
    "airfield.status_changed",
    "scenario.completed"
  ],
  "airports": [
    "VTBS"
  ],
  "status": "enabled",
  "secret": "whsec_Q3r8Zk1vN6pT2mYb5wLc9xHd",
  "created_at": "2026-11-23T03:02:17Z"
}

The delivery payload#

Attributes#

idstringrequired
Unique per event. Deduplicate on it.
typeenumrequired
One of airfield.status_changed, feed.health_changed, scenario.completed.
airportICAO coderequired
An ICAO airport code.
created_attimestamprequired
RFC 3339 in UTC, with up to millisecond precision.
dataobjectrequired

Delivery payload

{
  "id": "evt_3c81f0a9d2",
  "type": "airfield.status_changed",
  "airport": "VTBS",
  "created_at": "2026-11-23T03:00:02Z",
  "data": {
    "entity": "runway:02R-20L",
    "previous": {
      "status": "open"
    },
    "current": {
      "status": "closed",
      "reason": "inspection",
      "until": "2026-11-23T03:30:00Z"
    },
    "observation": "obs_9Ar2Te6mH0kc"
  }
}

List webhooks#

GET/v1/webhooks

Returns the application's webhooks. Secrets are not included.

Requires webhooks:write.Preview 2

Query parameters#

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 webhooks. data holds webhook objects.

objectstringrequired
Always list.
dataarray of objectsrequired
Child attributes
idstringrequired
objectstringrequired
Always webhook.
urlstringrequired
eventsarray of enumsrequired
airportsarray of ICAO codesrequired
statusenumrequired
disabled after 24 hours of failed deliveries. One of enabled, disabled.
secretstring
Signing secret. Returned only on creation.
created_attimestamprequired
RFC 3339 in UTC, with up to millisecond precision.
next_cursorstring | nullrequired
Pass as cursor to fetch the next page. Null on the last page.
curl https://api.surfacelens.app/v1/webhooks \
  -H "Authorization: Bearer $SURFACELENS_KEY"
const res = await fetch("https://api.surfacelens.app/v1/webhooks", {
  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/webhooks",
    headers={"Authorization": f"Bearer {os.environ['SURFACELENS_KEY']}"},
)
res.raise_for_status()
page = res.json()

Response200

{
  "object": "list",
  "data": [
    {
      "id": "wh_0a7d3e91c4",
      "object": "webhook",
      "url": "https://ops-board.example.net/hooks/surfacelens",
      "events": [
        "airfield.status_changed",
        "scenario.completed"
      ],
      "airports": [
        "VTBS"
      ],
      "status": "enabled",
      "created_at": "2026-11-23T03:02:17Z"
    }
  ],
  "next_cursor": null
}

Create a webhook#

POST/v1/webhooks

Registers an HTTPS endpoint to receive the listed event types. The response includes the signing secret, which is shown only once.

Requires webhooks:write.Preview 2

Headers#

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

Request body#

urlstringrequired
An HTTPS URL. Must answer within 10 seconds.
eventsarray of enumsrequired
airportsarray of ICAO codes
Only events for these airports. Omit for every airport the application can read.

Response#

201 The webhook was created. Returns webhook object.

curl https://api.surfacelens.app/v1/webhooks \
  -H "Authorization: Bearer $SURFACELENS_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://ops-board.example.net/hooks/surfacelens",
  "events": [
    "airfield.status_changed",
    "scenario.completed"
  ],
  "airports": [
    "VTBS"
  ]
}'
const res = await fetch("https://api.surfacelens.app/v1/webhooks", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SURFACELENS_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    url: "https://ops-board.example.net/hooks/surfacelens",
    events: ["airfield.status_changed", "scenario.completed"],
    airports: ["VTBS"],
  }),
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const webhook = await res.json();
import httpx, os, uuid

res = httpx.post(
    "https://api.surfacelens.app/v1/webhooks",
    headers={
        "Authorization": f"Bearer {os.environ['SURFACELENS_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "url": "https://ops-board.example.net/hooks/surfacelens",
        "events": ["airfield.status_changed", "scenario.completed"],
        "airports": ["VTBS"],
    },
)
res.raise_for_status()
webhook = res.json()

Response201

{
  "id": "wh_0a7d3e91c4",
  "object": "webhook",
  "url": "https://ops-board.example.net/hooks/surfacelens",
  "events": [
    "airfield.status_changed",
    "scenario.completed"
  ],
  "airports": [
    "VTBS"
  ],
  "status": "enabled",
  "secret": "whsec_Q3r8Zk1vN6pT2mYb5wLc9xHd",
  "created_at": "2026-11-23T03:02:17Z"
}

Delete a webhook#

DELETE/v1/webhooks/{webhook}

Stops deliveries immediately. Deliveries already in flight may still arrive.

Requires webhooks:write.Preview 2

Path parameters#

webhookstringrequired
The webhook ID.

Response#

204 The webhook was deleted.

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

res = httpx.delete(
    "https://api.surfacelens.app/v1/webhooks/wh_0a7d3e91c4",
    headers={"Authorization": f"Bearer {os.environ['SURFACELENS_KEY']}"},
)
res.raise_for_status()

Response204 No content

Event types#

Every delivery is a POST with a JSON body and a SurfaceLens-Signature header: t=<unix seconds>,v1=<hex>, where v1 is the HMAC-SHA256 of t, a full stop and the raw body, keyed with the webhook secret. Reject deliveries whose t is more than 300 seconds old. See Verify each delivery.

airfield.status_changed#

A runway, taxiway or stand opened, closed or changed restriction.

{
  "id": "evt_3c81f0a9d2",
  "type": "airfield.status_changed",
  "airport": "VTBS",
  "created_at": "2026-11-23T03:00:02Z",
  "data": {
    "entity": "runway:02R-20L",
    "previous": {
      "status": "open"
    },
    "current": {
      "status": "closed",
      "reason": "inspection",
      "until": "2026-11-23T03:30:00Z"
    },
    "observation": "obs_9Ar2Te6mH0kc"
  }
}

feed.health_changed#

A feed moved between healthy, degraded and silent.

{
  "id": "evt_7b20d4e6f1",
  "type": "feed.health_changed",
  "airport": "VTBS",
  "created_at": "2026-11-23T02:47:30Z",
  "data": {
    "feed": "feed_e07a3c58b9",
    "previous": "healthy",
    "current": "silent",
    "last_record_at": "2026-11-23T02:45:30Z"
  }
}

scenario.completed#

A scenario reached succeeded or failed.

{
  "id": "evt_1f5e9c3a07",
  "type": "scenario.completed",
  "airport": "VTBS",
  "created_at": "2026-11-23T02:59:06Z",
  "data": {
    "scenario": "scn_5e8c1b72d9",
    "status": "succeeded",
    "affected_flights": 71
  }
}