← Blog
Article

BMKG API Guide: Weather, Earthquakes and Warnings with One API Key

How BMKG's public weather, earthquake and warning feeds work, how they compare to one wrapped REST API, and code to fetch forecasts, quakes and alerts.

BMKG publishes Indonesia's weather forecasts, earthquake reports and extreme weather warnings for free, but each feed has its own URL, format and rate limit. API Indonesia wraps the three into one REST API with one API key and consistent JSON: 3-day forecasts down to village level, the latest and felt earthquakes, earthquake history by date range, and active weather warnings by province. This guide compares the raw BMKG feeds with the wrapped endpoints, checked on 29 October 2026.

In short: if you only need one feed for one place, call BMKG directly. If you need weather, earthquakes and warnings together, with the same Kemendagri region codes as your address data, use one API key.

BMKG feeds vs API Indonesia endpoints

Data BMKG official API Indonesia endpoint
Weather forecast api.bmkg.go.id/publik/prakiraan-cuaca?adm4=..., JSON, 3 days in 3-hour steps, updated twice a day GET /api/v1/cuaca?adm4=... or ?kabupaten_id=..., cached 6 hours
Find a village code Look up the Kemendagri code yourself GET /api/v1/cuaca/search?q=...
Latest earthquakes autogempa, gempaterkini (15 events M 5.0+) in XML and JSON GET /api/v1/gempa/terkini (15 most recent)
Felt earthquakes gempadirasakan (15 events) in XML and JSON GET /api/v1/gempa/dirasakan
Earthquake history Not offered as a date-range query GET /api/v1/gempa/history?start=...&end=...
Weather warnings BMKG RSS/CAP feed (the source our endpoint reads) GET /api/v1/peringatan-dini?provinsi=...
Access No key, 60 requests per minute per IP x-api-key header, Rp2 per successful request

The weather and earthquake facts in the BMKG column come from BMKG's own pages for weather forecasts and earthquake data. BMKG's forecast adm4 parameter uses the level-IV administrative code from Kepmendagri No. 100.1.1-6117 of 2022, for example 31.71.03.1001 for Kemayoran.

1. Weather forecast by village

Find the village code from a place name:

curl "https://use.apiindonesia.id/api/v1/cuaca/search?q=kemayoran" \
  -H "x-api-key: YOUR_API_KEY"

Then fetch its 3-day forecast:

curl "https://use.apiindonesia.id/api/v1/cuaca?adm4=31.71.03.1001" \
  -H "x-api-key: YOUR_API_KEY"

Each forecast item includes local_datetime, weather_desc, temperature_c, humidity_percent, wind_speed and source: "BMKG". Forecasts are fetched from BMKG on demand and cached for 6 hours, so polling more often does not return newer data.

2. Earthquakes

curl "https://use.apiindonesia.id/api/v1/gempa/terkini" \
  -H "x-api-key: YOUR_API_KEY"

Use /gempa/dirasakan for felt earthquakes with MMI intensity, and /gempa/history?start=2026-10-01&end=2026-10-28 for a date range. A simple Node.js watcher that alerts on new M5+ events:

let lastId = null;

async function checkQuakes() {
  const r = await fetch('https://use.apiindonesia.id/api/v1/gempa/terkini', {
    headers: { 'x-api-key': process.env.API_INDONESIA_KEY },
  });
  const { data } = await r.json();
  const newest = data[0];
  if (newest && newest.id !== lastId) {
    lastId = newest.id;
    if (newest.magnitude >= 5) console.log('New quake:', newest.region, newest.magnitude);
  }
}

setInterval(checkQuakes, 5 * 60 * 1000); // every 5 minutes

3. Extreme weather warnings

curl "https://use.apiindonesia.id/api/v1/peringatan-dini?provinsi=Jawa+Barat" \
  -H "x-api-key: YOUR_API_KEY"

Warnings come from BMKG's RSS/CAP feed and are refreshed hourly. Each entry carries the event, severity, headline, description and expiry, which is enough for an alert pipeline: run hourly, filter by province, notify on new warnings. A full no-code version is in our n8n and Telegram tutorial (Indonesian).

When to call BMKG directly

  • You need one feed for one location and can handle XML or BMKG's field names.
  • You want zero cost and can stay under 60 requests per minute per IP.
  • You need BMKG products we don't wrap, such as shakemap images.

When one API key helps

  • You combine weather, earthquakes and warnings in one app or dashboard.
  • Your addresses already use Kemendagri region codes from the Indonesia Regions API, so adm4 and kabupaten_id line up without mapping.
  • You want earthquake history by date range, which the BMKG files don't offer.

Whichever you choose, show "Source: BMKG" next to the data in your UI.

FAQ

Does BMKG have an official API key? BMKG's public forecast and earthquake feeds need no key; they are limited to 60 requests per minute per IP, according to BMKG's data pages.

Is the BMKG API free? The BMKG feeds are free. API Indonesia gives a one-time bonus of 3,000 credits on sign-up, then charges 2 credits (Rp2) per successful request; failed requests are free.

Is API Indonesia an official BMKG API? No. It is a third-party API that normalises BMKG's public data into consistent JSON. Always credit BMKG as the source.

What region code does the weather endpoint use? The Kemendagri village code (adm4, e.g. 32.73.01.1001), or a regency/city code via kabupaten_id (e.g. 3273).

Get started

Endpoint details are on the Weather, Earthquake and Weather Warnings product pages and in the docs. Sign up at dashboard.apiindonesia.id/register for an API key and 3,000 bonus credits, no credit card needed.

Get Started

Start Integrating
Today

Sign up for free and get a 3,000 credit bonus (Rp3,000) once your email is verified, grab an API key, and call your first endpoint right away. No credit card, no tedious approval process.

Dot wave visualization