Layer400 developers · Cloud API v1
Build your airspace integration.
From approval to a working map: live drone observations, live aircraft positions and available history, with every contract detail on this page.
Start with access → Already approved? Copy a request →
1. Activate access and create your key.
- Sign in → Account → Business API. Use the account that submitted your application. An administrator must approve each requested layer.
- Check that access is active, then choose Create API key and give it a name. Copy the secret when shown; it cannot be retrieved again.
- Record your approved scopes, requests/minute, requests/day, history lookback and expiry. Those account values are authoritative; examples on this page do not grant an allowance.
Already approved? Start at step 2. Approval does not email or automatically create a key. The administrator’s response appears in your account.
Key lifecycle, rotation and access changes
Use a separate named key for each integration where useful; every key inherits the same current account scopes and shares the account quota. Up to five unrevoked, unexpired keys can be active. Creation is limited to one key per ten seconds and twenty per day.
To rotate: create a replacement, update your server, verify it works, then delete the old key. Deleted keys cannot be restored. A key expires no later than its grant and at most 365 days after creation; extending a grant does not extend an existing key’s expiry.
Suspension blocks use; revocation disables existing keys permanently. Reapplying does not automatically expand or restore access. If an active grant has no key-creation control, refresh and contact support.
2. Keep the key on your backend.
Send Authorization: Bearer YOUR_API_KEY on every request. Website cookies, receiver credentials and ordinary account passwords are not API credentials. Use a descriptive User-Agent to identify your integration.
Use a secret manager in production. These local terminal prompts let you test without putting the key in command history. Never paste a key into this documentation page, browser JavaScript, a URL, logs or source control. This guide makes no data API requests.
Set the key for a local trial
Bash
# Bash: type/paste your key at the hidden prompt, then press Enter.
read -r -s -p 'Layer400 API key: ' LAYER400_API_KEY; printf '\n'
export LAYER400_API_KEY
# When finished: unset LAYER400_API_KEYPowerShell 7
# PowerShell 7: keep the key out of command history.
$secret = Read-Host 'Layer400 API key' -AsSecureString
try { $env:LAYER400_API_KEY = [System.Net.NetworkCredential]::new('', $secret).Password }
finally { $secret.Dispose() }
# Run the Node.js or Python example in this terminal.
# When finished: Remove-Item Env:LAYER400_API_KEYYour server fetches and shares results with authorised users. A browser-only application needs a backend: this API has no supported browser CORS integration or public-key mode. Adding users should not create an independent Layer400 polling loop for every viewer.
3. Choose the data you need.
Base URL: https://layer400.com/business/api/v1. All data endpoints accept GET and return JSON. They are polled; there is no streaming, WebSocket or webhook endpoint in Cloud API v1.
/live/rid
Current received drone Remote ID positions
Required scope: rid.live
/live/adsb
Current received aircraft ADS-B positions
Required scope: adsb.live
/history/rid
Retained drone position observations
Required scope: rid.history
/history/adsb
Retained aircraft position observations
Required scope: adsb.history
A live drones + live aircraft + drone history integration needs rid.live, adsb.live and rid.history. Aircraft history is separate: adsb.history. One key can use all layers approved for its account.
Bounds, dates and query limits.
bbox is west, south, east, north in WGS84 decimal degrees. Longitude comes first; west/south are the minimum coordinates. For example, -95.8,29.4,-95.4,29.8 is an illustrative box near Sugar Land and southwest Houston, not a claim of reception coverage.
| Parameter | Live requests | History requests |
|---|---|---|
bbox | Required. Each side ≤ 30°; longitude −180…180 and latitude −90…90. | Required. Each side ≤ 5°; the same coordinate ranges apply. |
limit | Optional integer 1–1000; default 250. Maximum rows per page. | Optional integer 1–1000; default 250. Maximum returned rows per window. |
cursor | Optional. Copy next_cursor exactly. Omit on a new refresh. | Not supported. Split incomplete time/area windows. |
start, end | Not supported. | Both required; RFC3339 with timezone, e.g. 2026-10-27T12:00:00Z. Use recent dates, not this literal example. |
| Time window | Current non-expired observations. | start < end ≤ now; at most one hour per request. start must be within the account’s approved lookback and the hard 30-day ceiling. |
Bounds must have positive width/height and cannot cross the antimeridian; split crossing areas into separate requests. Encode parameters with your language’s URL library, especially timezone offsets containing +. Keep server clocks synchronised. End is exclusive: a history window is [start,end).
Filtering and request validation
Only bbox, limit, cursor, start and end are accepted. Duplicate or unknown parameters are rejected; query strings are limited to 2,048 characters. There are no radius, aircraft-ID, registration, callsign, altitude, emergency or TEST-filter parameters. Query an area and filter the returned records in your application; this does not reduce metered calls.
Live cursors are public references, not timestamps or a permanent continuation bookmark. Changing the area or starting the next refresh requires a fresh first page.
4. Make your first requests.
Choose an endpoint you are approved for. These starters fetch one live page or a recent ten-minute history window. They print the response and flag further work; use the complete-refresh helper for a map. A successful response can contain data: [].
/live/rid · copy a request
curl
# Bash; requires curl 7.76+ for --fail-with-body.
curl --fail-with-body --max-time 15 --get 'https://layer400.com/business/api/v1/live/rid' \
--header "Authorization: Bearer $LAYER400_API_KEY" \
--user-agent 'YourOrganisation-AirspaceIntegration/1.0' \
--data-urlencode 'bbox=-95.8,29.4,-95.4,29.8' \
--data-urlencode 'limit=1000'Node.js
// Node.js 20+. Save as request.mjs; run: node request.mjs
// Run on your backend, with LAYER400_API_KEY set in its environment.
const key = process.env.LAYER400_API_KEY;
if (!key) throw new Error('Set LAYER400_API_KEY');
const url = new URL('https://layer400.com/business/api/v1/live/rid');
url.searchParams.set('bbox', '-95.8,29.4,-95.4,29.8'); // Replace with your area.
url.searchParams.set('limit', '1000');
const response = await fetch(url, {
headers: { Authorization: 'Bearer ' + key,
'User-Agent': 'YourOrganisation-AirspaceIntegration/1.0' },
signal: AbortSignal.timeout(15_000),
});
if (!response.ok) throw new Error('HTTP ' + response.status +
'; request=' + (response.headers.get('x-request-id') || 'unavailable') +
'; retry-after=' + (response.headers.get('retry-after') || 'not supplied'));
const result = await response.json();
if (result.next_cursor !== null) console.log('More pages: repeat with cursor=' + result.next_cursor);
console.log(JSON.stringify(result, null, 2));Python
# Python 3; standard library. Save as request.py; run: python request.py
import json, os, urllib.parse, urllib.request, urllib.error
params = {"bbox": "-95.8,29.4,-95.4,29.8", "limit": 1000} # Replace with your area.
url = "https://layer400.com/business/api/v1/live/rid?" + urllib.parse.urlencode(params)
request = urllib.request.Request(url, headers={
"Authorization": "Bearer " + os.environ["LAYER400_API_KEY"],
"User-Agent": "YourOrganisation-AirspaceIntegration/1.0",
})
try:
with urllib.request.urlopen(request, timeout=15) as response:
result = json.load(response)
except urllib.error.HTTPError as error:
raise RuntimeError("HTTP %s; request=%s; retry-after=%s" % (
error.code, error.headers.get("X-Request-ID", "unavailable"),
error.headers.get("Retry-After", "not supplied"))) from None
if result["next_cursor"] is not None:
print("More pages: repeat with cursor=" + result["next_cursor"])
print(json.dumps(result, indent=2))/live/adsb · copy a request
curl
# Bash; requires curl 7.76+ for --fail-with-body.
curl --fail-with-body --max-time 15 --get 'https://layer400.com/business/api/v1/live/adsb' \
--header "Authorization: Bearer $LAYER400_API_KEY" \
--user-agent 'YourOrganisation-AirspaceIntegration/1.0' \
--data-urlencode 'bbox=-95.8,29.4,-95.4,29.8' \
--data-urlencode 'limit=1000'Node.js
// Node.js 20+. Save as request.mjs; run: node request.mjs
// Run on your backend, with LAYER400_API_KEY set in its environment.
const key = process.env.LAYER400_API_KEY;
if (!key) throw new Error('Set LAYER400_API_KEY');
const url = new URL('https://layer400.com/business/api/v1/live/adsb');
url.searchParams.set('bbox', '-95.8,29.4,-95.4,29.8'); // Replace with your area.
url.searchParams.set('limit', '1000');
const response = await fetch(url, {
headers: { Authorization: 'Bearer ' + key,
'User-Agent': 'YourOrganisation-AirspaceIntegration/1.0' },
signal: AbortSignal.timeout(15_000),
});
if (!response.ok) throw new Error('HTTP ' + response.status +
'; request=' + (response.headers.get('x-request-id') || 'unavailable') +
'; retry-after=' + (response.headers.get('retry-after') || 'not supplied'));
const result = await response.json();
if (result.next_cursor !== null) console.log('More pages: repeat with cursor=' + result.next_cursor);
console.log(JSON.stringify(result, null, 2));Python
# Python 3; standard library. Save as request.py; run: python request.py
import json, os, urllib.parse, urllib.request, urllib.error
params = {"bbox": "-95.8,29.4,-95.4,29.8", "limit": 1000} # Replace with your area.
url = "https://layer400.com/business/api/v1/live/adsb?" + urllib.parse.urlencode(params)
request = urllib.request.Request(url, headers={
"Authorization": "Bearer " + os.environ["LAYER400_API_KEY"],
"User-Agent": "YourOrganisation-AirspaceIntegration/1.0",
})
try:
with urllib.request.urlopen(request, timeout=15) as response:
result = json.load(response)
except urllib.error.HTTPError as error:
raise RuntimeError("HTTP %s; request=%s; retry-after=%s" % (
error.code, error.headers.get("X-Request-ID", "unavailable"),
error.headers.get("Retry-After", "not supplied"))) from None
if result["next_cursor"] is not None:
print("More pages: repeat with cursor=" + result["next_cursor"])
print(json.dumps(result, indent=2))/history/rid · copy a request
Node.js
// Node.js 20+. Save as request.mjs; run: node request.mjs
// Run on your backend, with LAYER400_API_KEY set in its environment.
const key = process.env.LAYER400_API_KEY;
if (!key) throw new Error('Set LAYER400_API_KEY');
const url = new URL('https://layer400.com/business/api/v1/history/rid');
url.searchParams.set('bbox', '-95.8,29.4,-95.4,29.8'); // Replace with your area.
url.searchParams.set('limit', '1000');
const end = new Date(Date.now() - 60_000);
url.searchParams.set('start', new Date(end.getTime() - 600_000).toISOString());
url.searchParams.set('end', end.toISOString());
const response = await fetch(url, {
headers: { Authorization: 'Bearer ' + key,
'User-Agent': 'YourOrganisation-AirspaceIntegration/1.0' },
signal: AbortSignal.timeout(15_000),
});
if (!response.ok) throw new Error('HTTP ' + response.status +
'; request=' + (response.headers.get('x-request-id') || 'unavailable') +
'; retry-after=' + (response.headers.get('retry-after') || 'not supplied'));
const result = await response.json();
if (result.truncated !== false) throw new Error('Incomplete history: split the time/area window');
console.log(JSON.stringify(result, null, 2));Python
# Python 3; standard library. Save as request.py; run: python request.py
import json, os, urllib.parse, urllib.request, urllib.error
from datetime import datetime, timedelta, timezone
params = {"bbox": "-95.8,29.4,-95.4,29.8", "limit": 1000} # Replace with your area.
end = datetime.now(timezone.utc) - timedelta(minutes=1)
params.update(start=(end - timedelta(minutes=10)).isoformat(), end=end.isoformat())
url = "https://layer400.com/business/api/v1/history/rid?" + urllib.parse.urlencode(params)
request = urllib.request.Request(url, headers={
"Authorization": "Bearer " + os.environ["LAYER400_API_KEY"],
"User-Agent": "YourOrganisation-AirspaceIntegration/1.0",
})
try:
with urllib.request.urlopen(request, timeout=15) as response:
result = json.load(response)
except urllib.error.HTTPError as error:
raise RuntimeError("HTTP %s; request=%s; retry-after=%s" % (
error.code, error.headers.get("X-Request-ID", "unavailable"),
error.headers.get("Retry-After", "not supplied"))) from None
if result["truncated"]:
raise RuntimeError("Incomplete history: split the time/area window")
print(json.dumps(result, indent=2))/history/adsb · copy a request
Node.js
// Node.js 20+. Save as request.mjs; run: node request.mjs
// Run on your backend, with LAYER400_API_KEY set in its environment.
const key = process.env.LAYER400_API_KEY;
if (!key) throw new Error('Set LAYER400_API_KEY');
const url = new URL('https://layer400.com/business/api/v1/history/adsb');
url.searchParams.set('bbox', '-95.8,29.4,-95.4,29.8'); // Replace with your area.
url.searchParams.set('limit', '1000');
const end = new Date(Date.now() - 60_000);
url.searchParams.set('start', new Date(end.getTime() - 600_000).toISOString());
url.searchParams.set('end', end.toISOString());
const response = await fetch(url, {
headers: { Authorization: 'Bearer ' + key,
'User-Agent': 'YourOrganisation-AirspaceIntegration/1.0' },
signal: AbortSignal.timeout(15_000),
});
if (!response.ok) throw new Error('HTTP ' + response.status +
'; request=' + (response.headers.get('x-request-id') || 'unavailable') +
'; retry-after=' + (response.headers.get('retry-after') || 'not supplied'));
const result = await response.json();
if (result.truncated !== false) throw new Error('Incomplete history: split the time/area window');
console.log(JSON.stringify(result, null, 2));Python
# Python 3; standard library. Save as request.py; run: python request.py
import json, os, urllib.parse, urllib.request, urllib.error
from datetime import datetime, timedelta, timezone
params = {"bbox": "-95.8,29.4,-95.4,29.8", "limit": 1000} # Replace with your area.
end = datetime.now(timezone.utc) - timedelta(minutes=1)
params.update(start=(end - timedelta(minutes=10)).isoformat(), end=end.isoformat())
url = "https://layer400.com/business/api/v1/history/adsb?" + urllib.parse.urlencode(params)
request = urllib.request.Request(url, headers={
"Authorization": "Bearer " + os.environ["LAYER400_API_KEY"],
"User-Agent": "YourOrganisation-AirspaceIntegration/1.0",
})
try:
with urllib.request.urlopen(request, timeout=15) as response:
result = json.load(response)
except urllib.error.HTTPError as error:
raise RuntimeError("HTTP %s; request=%s; retry-after=%s" % (
error.code, error.headers.get("X-Request-ID", "unavailable"),
error.headers.get("Retry-After", "not supplied"))) from None
if result["truncated"]:
raise RuntimeError("Incomplete history: split the time/area window")
print(json.dumps(result, indent=2))Node.js 20+ uses built-in fetch; save each starter as request.mjs. Python uses its standard library. curl examples use Bash line continuations. Real keys make real, metered requests; there is no separate sandbox endpoint.
Read the response and its age.
| Field | Meaning |
|---|---|
version, layer, mode | API version "1", layer rid or adsb, and live or history. |
request_id | Support reference, also in the X-Request-ID HTTP header. |
generated_at | When the API built this response; not when the radio observation happened. |
data | Array of position records; may be empty. It is ordinary JSON, not GeoJSON. |
next_cursor | Live: next page reference or null. History: always null. |
truncated | Live: false, even when more pages exist. History: true means incomplete; check even if data is empty. |
continuation | History-only text guidance for splitting an overfull window. |
Show the age of observed_at alongside the last successful fetch time. A fresh HTTP response can contain older observations. Live records have stale_after; stop presenting them as current once that time passes. Missing tracks or reception gaps do not prove landing or an empty sky.
Four matching example responses · fictional, not local coverage evidence
{
"version": "1",
"request_id": "11111111-2222-4333-8444-555555555555",
"generated_at": "2026-10-27T12:00:02Z",
"layer": "rid",
"mode": "live",
"data": [
{
"public_track_id": "L4-D-0123456789ABCDEF",
"observed_at": "2026-10-27T12:00:00Z",
"longitude": -95.62,
"latitude": 29.6,
"altitude_m": 120,
"height_agl_m": null,
"speed_mps": 6.2,
"heading_deg": 90,
"confidence": "single",
"confidence_score": null,
"receiver_count": 1,
"track_kind": "drone",
"simulated": true,
"test_broadcast": true,
"emergency_state": "unknown",
"stale_after": "2026-10-27T12:00:30Z"
}
],
"next_cursor": null,
"truncated": false
}{
"version": "1",
"request_id": "11111111-2222-4333-8444-555555555555",
"generated_at": "2026-10-27T12:00:02Z",
"layer": "adsb",
"mode": "live",
"data": [
{
"public_track_id": "L4-A-0123456789ABCDEF",
"observed_at": "2026-10-27T12:00:00Z",
"longitude": -95.62,
"latitude": 29.6,
"altitude_m": 2400,
"height_agl_m": null,
"speed_mps": 105,
"heading_deg": 90,
"confidence": "single",
"confidence_score": null,
"receiver_count": 1,
"track_kind": "adsb_aircraft",
"simulated": true,
"test_broadcast": false,
"emergency_state": "unknown",
"stale_after": "2026-10-27T12:00:30Z"
}
],
"next_cursor": null,
"truncated": false
}{
"version": "1",
"request_id": "11111111-2222-4333-8444-555555555555",
"generated_at": "2026-10-27T12:00:02Z",
"layer": "rid",
"mode": "history",
"data": [
{
"public_track_id": "L4-D-0123456789ABCDEF",
"observed_at": "2026-10-27T12:00:00Z",
"longitude": -95.62,
"latitude": 29.6,
"altitude_m": 120,
"height_agl_m": null,
"speed_mps": 6.2,
"heading_deg": 90,
"confidence": "single",
"confidence_score": null,
"receiver_count": 1,
"track_kind": "drone",
"simulated": true,
"test_broadcast": true,
"emergency_state": "unknown"
}
],
"next_cursor": null,
"truncated": false,
"continuation": "Split an overfull time window into smaller half-open [start,end) windows; use smaller bounds if needed."
}{
"version": "1",
"request_id": "11111111-2222-4333-8444-555555555555",
"generated_at": "2026-10-27T12:00:02Z",
"layer": "adsb",
"mode": "history",
"data": [
{
"public_track_id": "L4-A-0123456789ABCDEF",
"observed_at": "2026-10-27T12:00:00Z",
"longitude": -95.62,
"latitude": 29.6,
"altitude_m": 2400,
"height_agl_m": null,
"speed_mps": 105,
"heading_deg": 90,
"confidence": "single",
"confidence_score": null,
"receiver_count": 1,
"track_kind": "adsb_aircraft",
"simulated": true,
"test_broadcast": false,
"emergency_state": "unknown"
}
],
"next_cursor": null,
"truncated": false,
"continuation": "Split an overfull time window into smaller half-open [start,end) windows; use smaller bounds if needed."
}Every position field.
The core record has 15 fields; live adds stale_after. Preserve unknown/null values, accept additional fields, and retain TEST and simulation flags.
Open the complete field dictionary
public_track_idstring- Rotating public reference: L4-D-… for drones, L4-A-… for aircraft. Useful within a refresh, not a permanent identity, registration or guaranteed flight identifier. Do not assume continuity across rotations or long history windows.
observed_attimestamp- Observation timestamp with a timezone, not the HTTP response time. Use it to show data age. Preserve precision; flag future timestamps and check clock synchronisation.
longitudenumber- WGS84 decimal degrees, east positive.
latitudenumber- WGS84 decimal degrees, north positive.
altitude_mnumber or null- Altitude in metres, nullable. Live uses the normalised altitude projection; history uses stored observations and can have different source references. V1 does not expose the altitude datum or vertical uncertainty. This is not height above takeoff and must not be assumed to be GPS, terrain clearance or certified separation.
height_agl_mnumber or null- Estimated height above ground in metres when available; not height above takeoff. Preserve null. It is not obstacle clearance or interchangeable with altitude_m.
speed_mpsnumber or null- Ground speed in metres per second, nullable. Known values × 3.6 give km/h; × 1.94384 give knots. It is not indicated or true airspeed.
heading_degnumber or null- Heading in degrees clockwise from north where available.
confidencestring or null- Projection quality label, for example single, multi_station, stale or inconsistent. Accept new labels; this is not a safety assurance.
confidence_scorenumber or null- Projection confidence score when available. Not a calibrated probability or detection guarantee.
receiver_countinteger or null- Contributing receiver count for this projected record, not the total network size.
track_kindstring- drone or adsb_aircraft.
simulatedboolean- Marks simulated data. Filter explicitly if you require non-simulated records.
test_broadcastboolean- Marks recognised TEST broadcasts. A false value is not proof that a record is operational traffic.
emergency_statestring or null- Reported/projected state where available; unknown is not a confirmed all-clear. Live ADS-B v1 currently returns unknown.
stale_aftertimestamp (live only)- Live projection expiry time. History records do not include this field.
Live ADS-B currently sets test_broadcast: false and emergency_state: "unknown" as projection defaults. These are not independent assurances about the aircraft. The Cloud API does not include callsigns, registrations, raw ICAO/Remote ID identifiers or operator/controller locations.
Fetch complete live pages and history windows.
Live refresh
Start without a cursor. Follow next_cursor with the same bounds until null. Deduplicate by public reference within that refresh and keep the newest observation. Start the next cycle without a cursor.
History review
Inspect truncated. Split [start,end) at a midpoint and repeat both halves. Discard the incomplete parent result. If a single instant is still too dense, reduce the area.
Live pages change while you read them: completion of pagination is not an atomic snapshot or a guarantee that every moving track was seen. History can be truncated before layer filtering, so even an empty RID result can require splitting. Do not label a partial result complete.
Copy a bounded Node.js client: pagination, history splitting and retries
Save this as layer400-client.mjs. It caps total HTTP attempts per client instance, rejects repeated cursors and stops on incomplete results. It retries 429/503 at most three attempts, honours short Retry-After delays and returns long waits to your scheduler. Network/timeouts propagate to the caller. Use it within your actual account allowance.
// Node.js 20+. Save as layer400-client.mjs on your backend.
export function createClient({key, maxRequests = 40, fetchFn = fetch,
sleep = ms => new Promise(resolve => setTimeout(resolve, ms))}) {
if (!key) throw new Error('Set a server-side API key');
let requests = 0;
async function get(path, params) {
const url = new URL('https://layer400.com/business/api/v1' + path);
for (const [name, value] of Object.entries(params)) url.searchParams.set(name, String(value));
for (let attempt = 0; attempt < 3; attempt++) {
if (++requests > maxRequests) throw new Error('Request budget reached; result incomplete');
const response = await fetchFn(url, {headers: {
Authorization: 'Bearer ' + key, 'User-Agent': 'YourOrganisation-AirspaceIntegration/1.0',
}, signal: AbortSignal.timeout(15_000)});
if (response.ok) {
const body = await response.json();
if (!Array.isArray(body.data) || !('next_cursor' in body) || typeof body.truncated !== 'boolean')
throw new Error('Unexpected API response');
return body;
}
const id = response.headers.get('x-request-id') || 'unavailable';
const raw = response.headers.get('retry-after');
const seconds = raw === null ? NaN : Number(raw);
const delayMs = raw === null ? NaN : Number.isFinite(seconds)
? seconds * 1000 : Date.parse(raw) - Date.now();
await response.body?.cancel();
if (![429, 503].includes(response.status) || attempt === 2 || delayMs > 60_000)
throw new Error('HTTP ' + response.status + '; request=' + id + '; retry-after=' + (raw || 'not supplied'));
// Long delays are returned to your scheduler; do not immediately rerun.
await sleep(Math.max(1000 * 2 ** attempt, Number.isFinite(delayMs) ? delayMs : 0) + Math.random() * 250);
}
}
async function live(kind, bbox, maxPages = 20) {
if (!['rid', 'adsb'].includes(kind)) throw new Error('Choose rid or adsb');
const params = {bbox, limit: 1000}, tracks = new Map(), seen = new Set();
for (let page = 0; page < maxPages; page++) {
const body = await get('/live/' + kind, params);
if (body.truncated) throw new Error('Unexpected truncated live result');
for (const row of body.data) {
const previous = tracks.get(row.public_track_id);
if (!previous || Date.parse(row.observed_at) >= Date.parse(previous.observed_at))
tracks.set(row.public_track_id, row);
}
if (body.next_cursor === null) return [...tracks.values()];
if (seen.has(body.next_cursor)) throw new Error('Repeated cursor; refresh incomplete');
seen.add(body.next_cursor); params.cursor = body.next_cursor;
}
throw new Error('Page budget reached; refresh incomplete');
}
async function history(kind, bbox, start, end) {
const from = Date.parse(start), to = Date.parse(end);
if (!['rid', 'adsb'].includes(kind) || !Number.isFinite(from) || !Number.isFinite(to) ||
to <= from || to - from > 3_600_000 || to > Date.now())
throw new Error('Use a past window of at most one hour');
async function split(a, b) {
const body = await get('/history/' + kind, {bbox, limit:1000,
start:new Date(a).toISOString(), end:new Date(b).toISOString()});
if (!body.truncated) return body.data;
if (b - a <= 1000) throw new Error('Dense history: reduce the area; result incomplete');
const mid = Math.floor((a + b) / 2);
// Discard the incomplete parent rows; adjacent windows do not overlap.
const left = await split(a, mid);
return left.concat(await split(mid, b));
}
return split(from, to);
}
return {live, history};
}// Save beside layer400-client.mjs as live-map.mjs; run: node live-map.mjs
import {createClient} from './layer400-client.mjs';
const client = createClient({key:process.env.LAYER400_API_KEY, maxRequests:40});
const bbox = '-95.8,29.4,-95.4,29.8';
// Both scopes must be approved. These are sequential to limit concurrency.
const drones = await client.live('rid', bbox);
const aircraft = await client.live('adsb', bbox);
console.log(JSON.stringify({fetched_at:new Date().toISOString(), drones, aircraft}));
// One refresh only. Schedule the next after completion; start fresh without a cursor.
// Share this result through your own authenticated backend route. Never send the API key.// Save beside layer400-client.mjs as history.mjs; run: node history.mjs
import {createClient} from './layer400-client.mjs';
const client = createClient({key:process.env.LAYER400_API_KEY, maxRequests:40});
const end = new Date(Date.now() - 60_000);
const start = new Date(end.getTime() - 600_000);
const rows = await client.history('rid', '-95.8,29.4,-95.4,29.8', start.toISOString(), end.toISOString());
// For ADS-B history, use 'adsb'; it requires its own adsb.history approval.
console.log(JSON.stringify(rows));For periods longer than one hour, request adjacent windows of at most one hour, staying within your permitted lookback. Spatial boundaries may duplicate observations; deduplicate exact duplicate records conservatively. History has no unique point identifier, packaged flight, takeoff/landing event or guaranteed long-term identity continuity. Never join trails across a reference rotation by guesswork.
Put observations on your map.
- Your backend fetches each approved layer once per cycle and shares results with authenticated viewers.
- After a successful complete refresh, replace that layer’s current dataset. Mark unsuccessful or incomplete updates clearly; do not silently show old data as fresh or replace it with an “empty sky”.
- Expire stale tracks locally between polls. Keep drone and aircraft layers distinguishable, show observation age, and label any retained last-known positions.
- Use a separate replay timeline for history. Preserve gaps; interpolation and lines between observations are your application’s presentation, not received reports.
Convert live JSON into 2D GeoJSON
This framework-neutral example excludes simulation, TEST, expired and future-dated records. Use the resulting FeatureCollection with your map library’s GeoJSON source. It deliberately leaves altitude in properties because the API does not expose a consistent vertical datum. It does not apply to history records.
// Conversion in your backend or UI after receiving your backend's results.
// API v1 returns ordinary JSON; this creates 2D GeoJSON for map libraries.
export function toGeoJSON(rows, now = Date.now()) {
return {type:'FeatureCollection', features:rows.filter(row =>
!row.simulated && !row.test_broadcast &&
Number.isFinite(row.longitude) && Number.isFinite(row.latitude) &&
row.longitude >= -180 && row.longitude <= 180 && row.latitude >= -90 && row.latitude <= 90 &&
Date.parse(row.stale_after) > now && Date.parse(row.observed_at) <= now
).map(row => ({type:'Feature', id:row.public_track_id,
geometry:{type:'Point', coordinates:[row.longitude,row.latitude]}, properties:{...row}}))};
}
// Only for live records: history has no stale_after. Use a separate replay timeline.
// Keep removed/stale tracks out of the live layer; retain them only in a labelled last-known view.
// null altitude stays unknown. Convert known metres to feet with * 3.28084;
// known m/s to knots with * 1.94384. Do not use unknown/null as zero.Raw Remote IDs, permanent airframe identity, aircraft enrichment, private receiver coordinates, prediction/encounter analysis, alerts and webhook delivery are not part of this API. The website’s map can have capabilities and fields that Cloud API v1 does not expose.
Choose a sustainable polling budget.
Your account shows the agreed requests/minute, requests per UTC day, lookback and expiry. All keys, layers, pages, areas, retries and history work share those limits. Faster polling does not create new observations or guarantee a particular update latency.
Add history requests, retries and headroom.
| Two feeds · one area · one page each | Requests/minute | Requests over 24 hours |
|---|---|---|
| Every 5 seconds | 24 | 34,560 |
| Every 10 seconds | 12 | 17,280 |
| Every 30 seconds | 4 | 5,760 |
A hypothetical 25,000/day allowance could cover the 10-second example with room for some additional work; 10,000/day would not cover that same 24-hour pattern. These are budgeting examples, not your granted allowance or a service-capacity promise.
Quota counters, headers and expiration
Minute counters reset at the next minute boundary; daily counters reset at midnight UTC. A successful authorisation consumes one request even for an empty result, a history-lookback rejection or a later query failure. Invalid keys and denied scopes do not consume the account allowance.
X-RateLimit-Remaining and X-DailyLimit-Remaining report allowance remaining after authorisation. Concurrent requests can make these values immediately stale. Not every error response contains these headers. A 429 includes Retry-After from the API; daily exhaustion may require waiting until the next UTC day.
Schedule a new refresh after the previous one finishes. Budget across all your backend workers, cap concurrency and avoid one loop per browser viewer. Contact us with your areas, refresh interval, user count and history needs before a larger deployment.
Troubleshooting and recovery.
| HTTP | API code | Next step |
|---|---|---|
| 400 | invalid_query | Check bounds, timestamps, cursor, duplicates and unknown parameters. |
| 401 | invalid_key | Check the Bearer header, key expiry and revocation in My Account. |
| 403 | scope_denied / history_window_denied | Check approved layer, active grant, grant expiry and permitted lookback. Repeating the same call will not approve access. |
| 404 | not_found | Check the exact resource path. |
| 405 | method_not_allowed | Data endpoints accept GET only. |
| 429 | quota_exceeded | Respect Retry-After; all keys share one account allowance. Edge limits may also apply. |
| 503 | busy / unavailable / query_unavailable / invalid_projection | Use bounded exponential backoff with jitter; reduce dense query windows and contact support if persistent. |
Inspect HTTP status before parsing JSON. Edge/proxy errors can return HTML without an API request ID; a non-JSON 403 is different from JSON scope_denied. Never retry 401/403 endlessly. Fix the key, approval or lookback first.
Error example and a useful support report
{
"error": {
"code": "scope_denied",
"message": "This account is not approved for this layer, or its grant is inactive."
},
"request_id": "11111111-2222-4333-8444-555555555555"
}For persistent failures, send the UTC time, endpoint, bounding box and time window, HTTP status, error code, request ID and relevant retry/allowance headers. Describe the expected and actual result. Never include your API key, Authorization header or an unredacted credential-bearing trace.
On 429/503, honour Retry-After when supplied and use bounded exponential backoff with jitter. Reschedule long waits; do not retry in parallel. After a timeout, your request may already have consumed quota. Show an outage/stale status until a successful refresh.
Coverage and receiver expectations.
Access is not coverage
The API returns available, privacy-projected observations. Reception depends on active receivers, compatible broadcasts, placement, terrain and connectivity. A successful empty result means no matching available records; it does not establish that the airspace is clear.
Local receivers are a separate decision
You can consume existing eligible network observations without hosting a receiver. If you need local reception, discuss deployment and data visibility with us. Installing a receiver does not automatically grant business API permissions.
Permitted history lookback is a query ceiling, not a guarantee that every area has that much retained data. Retention, coverage and privacy eligibility affect results. This feed supports situational awareness; it is not a certified collision-avoidance service or a guarantee of complete airspace detection.
Deployment, hosting and service arrangements
The receiver software runs on compatible ARM64 Linux with suitable radios; that requirement does not apply to your API-consuming backend. Receiver hardware, installation, connectivity and private/public visibility need their own assessment. The future receiver-local developer API is not part of this Cloud API contract.
API approval is not an agreement for unlimited use, redistribution, an uptime/latency SLA or priority incident support. Confirm commercial use, retention/redistribution rights, service levels and support arrangements with Layer400 before operational deployment. Additional fields may be added to v1; consumers should tolerate them. Request guidance before relying on behaviour outside this published contract.
Finish the evaluation with evidence.
- Verify a valid key can read each approved endpoint and that an unapproved scope is rejected.
- Run a planned local observation with an independently known broadcasting aircraft/drone where appropriate; measure coverage and observation age. A UI simulation or an empty response is not a reception test.
- Test empty results, stale observations, null fields, TEST/simulation filtering, multiple pages, truncated history, 429/503, expired/revoked keys and loss of connectivity.
- Check the UI clearly distinguishes live, stale, replay and unavailable data, and monitor usage before expanding the deployment.
Documentation reviewed 27 October 2026 against the deployed projection and access-control definitions and the API implementation. Examples are fictional and tested with isolated responses; no customer credential or local coverage claim is embedded here.