---
title: "Weather API Reference | APIFor"
description: "Endpoint reference for the Weather service: parameters, request bodies, example responses, status codes and credits per call."
canonical: "https://apifor.dev/docs/reference/weather/"
---

**Weather All docs**

# 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](https://apifor.dev/services/weather/) page.

GET `/v1/weather` 1 credit

Forecast 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 |

GET /v1/weather

```bash
curl 'https://api.apifor.dev/v1/weather' \
  -H 'x-api-key: YOUR_API_KEY'
```

Example response · 200

```json
{
  "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
    }
  }
}
```

- `200` Forecast for the matched location. distance_km appears when you searched by point.
- `400` Invalid parameters
- `404` No location matched, including a region code that is not in the administrative regions list
- `502` Upstream unavailable or timed out (8 s) and nothing cached. No credits are used
- `503` Live lookup budget used up for this minute and nothing cached. Retry after 60 s. No credits are used

GET `/v1/weather/locations` 1 credit

Search 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 |

GET /v1/weather/locations

```bash
curl 'https://api.apifor.dev/v1/weather/locations' \
  -H 'x-api-key: YOUR_API_KEY'
```

Example response · 200

```json
{
  "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."
    }
  }
}
```

- `200` Matching places
- `400` Invalid parameters

GET `/v1/weather/coverage` Free

Countries this service covers, with sources, licences, row counts and country-only fields. Free (0 credits), still needs an API key. Price note: Free.

GET /v1/weather/coverage

```bash
curl 'https://api.apifor.dev/v1/weather/coverage' \
  -H 'x-api-key: YOUR_API_KEY'
```

Example response · 200

```json
{
  "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..."
      }
    ]
  }
}
```

- `200` Coverage

[Error handling](https://apifor.dev/docs/errors/) · [Rate limits](https://apifor.dev/docs/rate-limits/) · [Prices](https://apifor.dev/pricing/#services)
