Weather API Reference
3 routes. Base URL https://api.apifor.dev, authenticated with x-api-key. Failed calls are not charged. Overview, limits and sources are on the Weather forecast API page.
/v1/weather1 creditForecast for a place. Indonesia: 3-day BMKG forecast in 3-hour steps by region code or point. Anywhere else: MET Norway forecast for a lat/lng point (hourly, then 6-hourly, about 9 days). Malaysia: country=MY with location or location_id for the 7-day MET Malaysia daily forecast. BMKG issues forecasts twice a day; each location's copy is refreshed from BMKG once it is 6 hours old, and meta.freshness says when. 1 credit.
| Parameter | In | Type | Rules |
|---|---|---|---|
| region | query | string | Village (10 digits), district (6) or regency (4) code, dots optional, e.g. 34.02.16.2003 (Indonesia only) |
| lat | query | number | -90 to 90 · Latitude, use with lng. Any point on earth (MET Norway outside Indonesia) |
| lng | query | number | -180 to 180 · Longitude, use with lat |
| country | query | string | ISO 3166-1 alpha-2 · ISO 3166-1 alpha-2 code, optional. ID forces BMKG; MY enables location/location_id |
| location | query | string | max 100 chars · country=MY: MET Malaysia forecast location (partial name). country=SG: data.gov.sg 2-hour forecast area (e.g. Bedok, Changi). |
| location_id | query | string | Malaysia only (country=MY): MET Malaysia location id, e.g. Ds001 |
curl 'https://api.apifor.dev/v1/weather' \
-H 'x-api-key: YOUR_API_KEY'{
"success": true,
"data": {
"location": {
"country": "ID",
"region_code": "34.02.16.2003",
"province": "Daerah Istimewa Yogyakarta",
"regency": "Bantul",
"district": "Kasihan",
"village": "Tamantirto",
"lat": -7.8210832262,
"lng": 110.3255892396,
"timezone_offset": "+0700",
"distance_km": 1.1
},
"issued_at": "2026-11-30T12:00:00Z",
"fetched_at": "2026-11-30T13:02:11.512Z",
"stale": false,
"source": "BMKG",
"forecasts": [
{
"time": "2026-11-30T13:00:00Z",
"local_time": "2026-11-30 20:00:00",
"condition": "Mostly Cloudy",
"condition_local": "Berawan",
"condition_code": "3",
"temperature_c": 25,
"humidity_percent": 96,
"cloud_cover_percent": 98,
"precipitation_mm": 0.1,
"wind_speed_kmh": 1.2,
"wind_from": "NW",
"wind_to": "SE",
"wind_degrees": 357,
"visibility_m": null,
"visibility_text": null
},
{
"time": "2026-11-30T16:00:00Z",
"local_time": "2026-11-30 23:00:00",
"condition": "Mostly Cloudy",
"condition_local": "Berawan",
"condition_code": "3",
"temperature_c": 25,
"humidity_percent": 96,
"cloud_cover_percent": 98,
"precipitation_mm": 0,
"wind_speed_kmh": 2.3,
"wind_from": "W",
"wind_to": "E",
"wind_degrees": 310,
"visibility_m": null,
"visibility_text": null
}
]
},
"meta": {
"attribution": {
"source": "BMKG (Badan Meteorologi, Klimatologi, dan Geofisika)",
"licence": "BMKG open data, attribution required",
"license": "BMKG open data, attribution required",
"license_url": "https://data.bmkg.go.id",
"source_url": "https://data.bmkg.go.id",
"attribution_page": "https://apifor.dev/sources",
"notice": "Source: BMKG (Badan Meteorologi, Klimatologi, dan Geofisika). Show BMKG as the data source wherever you display this data. Fields normali..."
},
"freshness": {
"mode": "cached",
"source": "BMKG",
"source_published_at": "2026-11-30T12:00:00Z",
"fetched_at": "2026-11-30T13:02:11.512Z",
"refresh_interval_minutes": 360,
"max_lag_minutes": 360
}
}
}200Forecast for the matched location. distance_km appears when you searched by point.400Invalid parameters404No location matched, including a region code that is not in the administrative regions list502Upstream unavailable or timed out (8 s) and nothing cached. No credits are used503Live lookup budget used up for this minute and nothing cached. Retry after 60 s. No credits are used
/v1/weather/locations1 creditSearch villages, districts and regencies by name to get a region code. 1 credit.
| Parameter | In | Type | Rules |
|---|---|---|---|
| q | query | string | max 100 chars · Place name, 2 to 100 characters |
| country | query | string | ISO 3166-1 alpha-2 · ISO 3166-1 alpha-2 code. Covered today: ID |
| page | query | integer | 1 to 100 · default 1 · Page number |
| limit | query | integer | 1 to 100 · default 20 · Rows per page |
curl 'https://api.apifor.dev/v1/weather/locations' \
-H 'x-api-key: YOUR_API_KEY'{
"success": true,
"data": [
{
"country": "ID",
"region_code": "34.02.16.2003",
"village": "Tamantirto",
"district": "Kasihan",
"regency": "Kabupaten Bantul",
"province": "Daerah Istimewa Yogyakarta"
}
],
"meta": {
"total": 1,
"page": 1,
"per_page": 20,
"total_pages": 1,
"attribution": {
"source": "https://github.com/open-admin-data/indonesia-administrative-divisions",
"licence": "CC BY 4.0",
"license": "CC BY 4.0",
"license_url": "https://creativecommons.org/licenses/by/4.0/",
"source_url": "https://github.com/open-admin-data/indonesia-administrative-divisions",
"attribution_page": "https://apifor.dev/sources",
"notice": "Source: https://github.com/open-admin-data/indonesia-administrative-divisions. Licensed under CC BY 4.0. Fields normalized by APIFor."
}
}
}200Matching places400Invalid parameters
/v1/weather/coverageFreeCountries this service covers, with sources, licences, row counts and country-only fields. Free (0 credits), still needs an API key. Price note: Free.
curl 'https://api.apifor.dev/v1/weather/coverage' \
-H 'x-api-key: YOUR_API_KEY'{
"success": true,
"data": {
"service": "weather",
"global": true,
"country_param": "optional",
"param_name": "country",
"countries": [
{
"country": "ID",
"market": null,
"subdivision_levels": [
"province",
"regency"
],
"rows": null,
"updated_at": null,
"sources": [
{
"name": "BMKG",
"url": "https://data.bmkg.go.id",
"licence": "BMKG open data, attribution required",
"attribution": "Source: BMKG (Badan Meteorologi, Klimatologi, dan Geofisika)"
},
{
"name": "open-admin-data administrative divisions",
"url": "https://github.com/open-admin-data/indonesia-administrative-divisions",
"licence": "CC BY 4.0",
"attribution": null
}
],
"local_fields": [],
"notes": "3-day BMKG forecasts in 3-hour steps by region code or point. BMKG issues forecasts twice a day; each location is refreshed from BMKG onc..."
},
{
"country": "MY",
"market": null,
"subdivision_levels": [],
"rows": null,
"updated_at": null,
"sources": [
{
"name": "MET Malaysia via data.gov.my",
"url": "https://developer.data.gov.my/realtime-api/weather",
"licence": "CC BY 4.0",
"attribution": "Source: MET Malaysia via data.gov.my"
},
{
"name": "MET Norway Locationforecast 2.0",
"url": "https://api.met.no/weatherapi/locationforecast/2.0/",
"licence": "CC BY 4.0 / NLOD 2.0",
"attribution": "Data from MET Norway (The Norwegian Meteorological Institute)"
}
],
"local_fields": [
"local.met_location_id",
"local.other_matches"
],
"notes": "country=MY with location (name) or location_id (Ds001): 7-day daily MET Malaysia forecast, Malay text with English rendering. lat/lng: ho..."
}
]
}
}200Coverage