Skip to content

The application object#

Attributes#

idstringrequired
objectstringrequired
Always application.
namestringrequired
airportsarray of ICAO codesrequired
scopesarray of enumsrequired
entity_typesarray of enumsrequired
feedsarray of feed IDsrequired
created_attimestamprequired
RFC 3339 in UTC, with up to millisecond precision.

Application object

{
  "id": "app_4f1e9a7c20",
  "object": "application",
  "name": "Turnaround board",
  "airports": [
    "VTBS"
  ],
  "scopes": [
    "airports:read",
    "entities:read",
    "events:read"
  ],
  "entity_types": [
    "aircraft",
    "flight",
    "stand",
    "vehicle"
  ],
  "feeds": [],
  "created_at": "2026-11-23T01:12:45Z"
}

The API key object#

Attributes#

idstringrequired
objectstringrequired
Always api_key.
applicationstringrequired
environmentenumrequired
test reads the sandbox, a simulated VTBS day. live reads production data. One of test, live.
labelstring
prefixstringrequired
The first 12 characters of the secret
secretstring
The key itself. Returned only on creation.
created_attimestamprequired
RFC 3339 in UTC, with up to millisecond precision.
expires_attimestamp | nullrequired
last_used_attimestamp | nullrequired

Api key object

{
  "id": "key_6d2a91f0b3",
  "object": "api_key",
  "application": "app_4f1e9a7c20",
  "environment": "test",
  "label": "Local development",
  "prefix": "sl_test_9xKq",
  "secret": "sl_test_9xKq2VwM7pLr4TnB8cYz3HdF",
  "created_at": "2026-11-23T01:13:02Z",
  "expires_at": "2027-02-23T00:00:00Z",
  "last_used_at": null
}

Create an application#

POST/v1/applications

Creates an application: one consumer of the shared model with one set of permissions. Every key you issue for it carries exactly these permissions.

Requires applications: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#

namestringrequired
airportsarray of ICAO codesrequired
scopesarray of enumsrequired
entity_typesarray of enums
Entity types the application may read. Omit for all.
feedsarray of feed IDs
Feeds the application may push records to with records:write.

Response#

201 The application was created. Returns application object.

curl https://api.surfacelens.app/v1/applications \
  -H "Authorization: Bearer $SURFACELENS_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Turnaround board",
  "airports": [
    "VTBS"
  ],
  "scopes": [
    "airports:read",
    "entities:read",
    "events:read"
  ],
  "entity_types": [
    "aircraft",
    "flight",
    "stand",
    "vehicle"
  ]
}'
const res = await fetch("https://api.surfacelens.app/v1/applications", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SURFACELENS_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    name: "Turnaround board",
    airports: ["VTBS"],
    scopes: ["airports:read", "entities:read", "events:read"],
    entity_types: ["aircraft", "flight", "stand", "vehicle"],
  }),
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const application = await res.json();
import httpx, os, uuid

res = httpx.post(
    "https://api.surfacelens.app/v1/applications",
    headers={
        "Authorization": f"Bearer {os.environ['SURFACELENS_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "name": "Turnaround board",
        "airports": ["VTBS"],
        "scopes": ["airports:read", "entities:read", "events:read"],
        "entity_types": ["aircraft", "flight", "stand", "vehicle"],
    },
)
res.raise_for_status()
application = res.json()

Response201

{
  "id": "app_4f1e9a7c20",
  "object": "application",
  "name": "Turnaround board",
  "airports": [
    "VTBS"
  ],
  "scopes": [
    "airports:read",
    "entities:read",
    "events:read"
  ],
  "entity_types": [
    "aircraft",
    "flight",
    "stand",
    "vehicle"
  ],
  "feeds": [],
  "created_at": "2026-11-23T01:12:45Z"
}

Retrieve an application#

GET/v1/applications/{application}

Returns one application. Pass me to read the application that owns the calling key.

Any valid key.Preview 1

Path parameters#

applicationstringrequired
The application ID, or me.

Response#

200 The application. Returns application object.

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

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

Response200

{
  "id": "app_4f1e9a7c20",
  "object": "application",
  "name": "Turnaround board",
  "airports": [
    "VTBS"
  ],
  "scopes": [
    "airports:read",
    "entities:read",
    "events:read"
  ],
  "entity_types": [
    "aircraft",
    "flight",
    "stand",
    "vehicle"
  ],
  "feeds": [],
  "created_at": "2026-11-23T01:12:45Z"
}

Create a key#

POST/v1/applications/{application}/keys

Issues an API key for the application. The secret is returned once and cannot be retrieved again. Keys for the test environment read the sandbox; keys for live read production data.

Requires applications:write.Preview 1

Path parameters#

applicationstringrequired
The application ID.

Headers#

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

Request body#

environmentenumrequired
test reads the sandbox, a simulated VTBS day. live reads production data. One of test, live.
labelstring
A note to help you identify the key later.
expires_attimestamp
When the key stops working. Omit for a key that does not expire.

Response#

201 The key, including its secret. Returns API key object.

curl https://api.surfacelens.app/v1/applications/app_4f1e9a7c20/keys \
  -H "Authorization: Bearer $SURFACELENS_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "environment": "test",
  "label": "Local development",
  "expires_at": "2027-02-23T00:00:00Z"
}'
const res = await fetch("https://api.surfacelens.app/v1/applications/app_4f1e9a7c20/keys", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SURFACELENS_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    environment: "test",
    label: "Local development",
    expires_at: "2027-02-23T00:00:00Z",
  }),
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const apiKey = await res.json();
import httpx, os, uuid

res = httpx.post(
    "https://api.surfacelens.app/v1/applications/app_4f1e9a7c20/keys",
    headers={
        "Authorization": f"Bearer {os.environ['SURFACELENS_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "environment": "test",
        "label": "Local development",
        "expires_at": "2027-02-23T00:00:00Z",
    },
)
res.raise_for_status()
api_key = res.json()

Response201

{
  "id": "key_6d2a91f0b3",
  "object": "api_key",
  "application": "app_4f1e9a7c20",
  "environment": "test",
  "label": "Local development",
  "prefix": "sl_test_9xKq",
  "secret": "sl_test_9xKq2VwM7pLr4TnB8cYz3HdF",
  "created_at": "2026-11-23T01:13:02Z",
  "expires_at": "2027-02-23T00:00:00Z",
  "last_used_at": null
}

Revoke a key#

DELETE/v1/applications/{application}/keys/{key}

Revokes the key on the edge immediately and on on-premise nodes within 60 seconds. Open streams using the key are closed.

Requires applications:write.Preview 1

Path parameters#

applicationstringrequired
The application ID.
keystringrequired
The key ID. This is not the secret.

Response#

204 The key was revoked.

curl -X DELETE https://api.surfacelens.app/v1/applications/app_4f1e9a7c20/keys/key_6d2a91f0b3 \
  -H "Authorization: Bearer $SURFACELENS_KEY"
const res = await fetch("https://api.surfacelens.app/v1/applications/app_4f1e9a7c20/keys/key_6d2a91f0b3", {
  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/applications/app_4f1e9a7c20/keys/key_6d2a91f0b3",
    headers={"Authorization": f"Bearer {os.environ['SURFACELENS_KEY']}"},
)
res.raise_for_status()

Response204 No content