Skip to content
LAYER400DRONE INTELLIGENCE NETWORK
Menu
Documentation menu
On this pageYour integration

Layer400 developers · Cloud API v1

Build a reliable integration.

Practical patterns for your backend and map. Access, first requests and the full contract are together in the complete guide →

2. Keep the key on your backend.

Your mapBrowser or mobile UI
Your backendStores the API key · polls once
Layer400 APIHTTPS · received observations

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
# 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_KEY

PowerShell 7

PowerShell 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_KEY

Your 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.

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.

layer400-client.mjs
// 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};
}
Both live feeds · one refresh
// 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.
Recent RID history · split if needed
// 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.

  1. Your backend fetches each approved layer once per cycle and shares results with authenticated viewers.
  2. 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”.
  3. Expire stale tracks locally between polls. Keep drone and aircraft layers distinguishable, show observation age, and label any retained last-known positions.
  4. 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.

Live GeoJSON conversion
// 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.

Calls per day = areas × live layers × pages per layer × (3,600 ÷ interval in seconds) × active hours.
Add history requests, retries and headroom.
Two feeds · one area · one page eachRequests/minuteRequests over 24 hours
Every 5 seconds2434,560
Every 10 seconds1217,280
Every 30 seconds45,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.

HTTPAPI codeNext step
400invalid_queryCheck bounds, timestamps, cursor, duplicates and unknown parameters.
401invalid_keyCheck the Bearer header, key expiry and revocation in My Account.
403scope_denied / history_window_deniedCheck approved layer, active grant, grant expiry and permitted lookback. Repeating the same call will not approve access.
404not_foundCheck the exact resource path.
405method_not_allowedData endpoints accept GET only.
429quota_exceededRespect Retry-After; all keys share one account allowance. Edge limits may also apply.
503busy / unavailable / query_unavailable / invalid_projectionUse 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
API-handled error
{
  "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.