Applications#
Applications, their permissions, and their API keys.
The application object#
Attributes#
idstringrequiredobjectstringrequired- Always
application. namestringrequiredairportsarray of ICAO codesrequiredscopesarray of enumsrequiredentity_typesarray of enumsrequiredfeedsarray of feed IDsrequiredcreated_attimestamprequired- RFC 3339 in UTC, with up to millisecond precision.
The API key object#
Attributes#
idstringrequiredobjectstringrequired- Always
api_key. applicationstringrequiredenvironmentenumrequiredtestreads the sandbox, a simulated VTBS day.livereads production data. One oftest,live.labelstringprefixstringrequired- 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 | nullrequiredlast_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.
Headers#
Idempotency-Keystring- A unique value, such as a UUID, that makes the request safe to retry for 24 hours.
Request body#
namestringrequiredairportsarray of ICAO codesrequiredscopesarray of enumsrequiredentity_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
Retrieve an application#
GET/v1/applications/{application}
Returns one application. Pass me to read the application that owns the calling key.
Path parameters#
applicationstringrequired- The application ID, or
me.
Response#
200 The application. Returns application object.
Response200
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.
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#
environmentenumrequiredtestreads the sandbox, a simulated VTBS day.livereads production data. One oftest,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.
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.
Path parameters#
applicationstringrequired- The application ID.
keystringrequired- The key ID. This is not the secret.
Response#
204 The key was revoked.
Response204 No content