Skip to content
Livedata may be out of dateOpen the map
How to connect

How to get air-raid alert data programmatically

Three production-ready recipes: your first request in 5 seconds, signed webhooks instead of polling, and regional history.

The shortest path — one request

01 cURL + Python · instant start

A single GET request is enough to test. Without a key the limit is 60 req/min (300 req/day per IP); with a registered Free developer key it is 120 req/min (1 000 req/day).

curl -s https://map.megainet.art/api/alerts.php

In the response: regions — state of all 25 oblasts, updated — snapshot timestamp, stale — source staleness flag. changed_ts holds the Unix timestamp of the last state transition.

import json, urllib.request

req = urllib.request.Request(
    "https://map.megainet.art/api/alerts.php",
    headers={"X-API-Key": "ak_ваш_ключ"}
)
with urllib.request.urlopen(req, timeout=10) as r:
    data = json.load(r)

for iso, region in data["regions"].items():
    if region["alert"]:
        print(iso, "— тривога з", region.get("changed_ts"))

How to stop polling: a webhook instead

02 Push events · HMAC-SHA256 (Pro tier)

Polling every 15 seconds burns 5,760 requests a day for a dozen events. A webhook subscription pushes a signed POST the second an alert starts or ends.

$ts   = $_SERVER['HTTP_X_MAP_TIMESTAMP'] ?? '';
$sig  = $_SERVER['HTTP_X_MAP_SIGNATURE'] ?? '';
$body = file_get_contents('php://input');

// Перевіряємо підпис ДО того, як щось зробимо з подією.
if (!hash_equals(hash_hmac('sha256', $ts . "\n" . $body, $SECRET), $sig)) {
    http_response_code(401);
    exit;
}

$event = json_decode($body, true);   // alert.start | alert.end

Every delivery carries X-Map-Timestamp, X-Map-Signature (HMAC-SHA256 over «timestamp \n body»), X-Map-Event and X-Map-Delivery. Always verify the signature before acting on the payload.

If your endpoint does not return 2xx within 8 seconds, we retry after 1, 5, 30 minutes, 2 and 6 hours.

Where to get per-oblast history & analytics

03 24h, 48h and 168h aggregations

How many alerts occurred in a day, how many hours each oblast spent under alert, and the hourly heat map:

curl -s "https://map.megainet.art/api/history.php?hours=24"
curl -s "https://map.megainet.art/api/analytics.php?hours=168"

Pass hours=24|48|168. Architectural boundary: airborne target tracks are kept for 24 hours, the monitor feed for 72 hours. The 168-hour window returns complete regional alert history.

What it costs

What it costs

Free developer access (0 грн, up to 1 000 req/day) is issued after developer account registration & email verification (1 key per account) with an active attribution link to map.megainet.art. Production 24/7 polling, webhooks and no-attribution use are available on the single Pro plan — 950 грн/mo (500 000 req/day).

Ready-made client & custom integration

Need a dependency-free Python/Node receiver with webhook verification or custom enterprise quotas? Test live endpoints in the API cabinet sandbox or contact [email protected].

The alert map — now in your pocket

The same protection, with push alerts even when your phone is locked, a “what’s flying near you” radar and Home Screen widgets.

Open the map

What searches this page answers