Boundaries All docs

Boundaries API Reference

4 routes. Base URL https://api.apifor.dev, authenticated with x-api-key. Failed calls are not charged. Overview, limits and sources are on the Administrative boundaries API page.

GET/v1/boundaries/lookup2 credits

Point in polygon: which province, regency, district and village hold a coordinate, with /v1/regions ids. `method` says how the match was made; nearest_centroid answers are flagged approximate. Coverage today: ID. Costs 2 credits. Outside Indonesia (and for points in the Indonesia box that are in a neighbour) the answer comes from geoBoundaries ADM0-ADM2: regions has ADM0, ADM1, ADM2 keys, each with its own licence and attribution. For US points the response also has `place` (city or census designated place) and `postal_area` (ZIP Code Tabulation Area), from U.S. Census Bureau cartographic boundary files.

ParameterInTypeRules
lat *querynumber-90 to 90 · Latitude in decimal degrees.
lng *querynumber-180 to 180 · Longitude in decimal degrees.
countryquerystringISO 3166-1 alpha-2 · ISO 3166-1 alpha-2; restrict the lookup to one country.
GET/v1/boundaries/lookup
curl 'https://api.apifor.dev/v1/boundaries/lookup?lat=&lng=' \
  -H 'x-api-key: YOUR_API_KEY'
Example response · 200
{
  "success": true,
  "data": {
    "lat": -6.8775,
    "lng": 107.5862,
    "country": "ID",
    "matched_level": "village",
    "method": "polygon",
    "approximate": false,
    "regions": {
      "province": {
        "id": "32",
        "name": "Jawa Barat",
        "region_url": "/v1/regions/32?level=provinces",
        "boundary_url": "/v1/boundaries/32"
      },
      "regency": {
        "id": "3273",
        "name": "Kota Bandung",
        "region_url": "/v1/regions/3273?level=regencies",
        "boundary_url": "/v1/boundaries/3273"
      },
      "district": {
        "id": "327301",
        "name": "Sukasari",
        "region_url": "/v1/regions/327301?level=districts",
        "boundary_url": "/v1/boundaries/327301"
      },
      "village": {
        "id": "3273011001",
        "name": "Sukarasa",
        "region_url": "/v1/regions/3273011001?level=villages",
        "boundary_url": "/v1/boundaries/3273011001"
      }
    }
  },
  "meta": {
    "attribution": {
      "source": "open-admin-data/indonesia-administrative-divisions by jakkrapongt",
      "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://github.com/open-admin-data/indonesia-administrative-divisions/blob/main/LICENSE",
      "notice": "Boundaries from open-admin-data/indonesia-administrative-divisions (release 2026.06) by jakkrapongt, licensed CC BY 4.0. Changed by APIFo..."
    }
  }
}
  • 200OK
  • 400Invalid parameters (not charged)
  • 404Not found (not charged)
GET/v1/boundaries/{region_id}2 credits

The boundary of one province, regency, district or village as a GeoJSON FeatureCollection. format=geojson returns the raw FeatureCollection (application/geo+json) with the credit in a top-level `attribution` member. Costs 2 credits. Also accepts a world boundary id such as USA-ADM2-<shapeID>; the response then carries that boundary's licence, share_alike flag and attribution. Ids include USA-ADM2-06037 (Census GEOID), USA-PLACE-0644000, USA-POSTAL-90210, JPN-ADM2-13101 (MLIT municipality code) and THA-ADM1-TH10 (COD P-code).

ParameterInTypeRules
region_id *pathstringA /v1/regions id (e.g. 3273011001) or a dotted code (32.73.01.1001).
formatquerystringone of json, geojson · default json · json (default, wrapped in the usual envelope) or geojson (raw FeatureCollection).
GET/v1/boundaries/{region_id}
curl 'https://api.apifor.dev/v1/boundaries/ID' \
  -H 'x-api-key: YOUR_API_KEY'
Example response · 200
{
  "success": true,
  "data": {
    "id": "3273011001",
    "boundary_code": "32.73.01.1001",
    "name": "Sukarasa",
    "level": "village",
    "country": "ID",
    "parent_id": "327301",
    "centroid": {
      "lat": -6.874227470295148,
      "lng": 107.58539617161965
    },
    "source_version": "2026.06",
    "region_url": "/v1/regions/3273011001?level=villages",
    "boundary_url": "/v1/boundaries/3273011001",
    "geometry": {
      "type": "FeatureCollection",
      "features": [
        {
          "type": "Feature",
          "properties": {
            "id": "3273011001",
            "boundary_code": "32.73.01.1001",
            "name": "Sukarasa",
            "level": "village",
            "country": "ID"
          },
          "geometry": {
            "type": "Polygon",
            "coordinates": [
              [
                [
                  107.59047000000004,
                  -6.878415999999959
                ],
                [
                  107.59007200000008,
                  -6.878271000999973
                ]
              ]
            ]
          }
        }
      ]
    }
  },
  "meta": {
    "attribution": {
      "source": "open-admin-data/indonesia-administrative-divisions by jakkrapongt",
      "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://github.com/open-admin-data/indonesia-administrative-divisions/blob/main/LICENSE",
      "notice": "Boundaries from open-admin-data/indonesia-administrative-divisions (release 2026.06) by jakkrapongt, licensed CC BY 4.0. Changed by APIFo..."
    }
  }
}
  • 200OK
  • 400Invalid parameters (not charged)
  • 404Not found (not charged)
GET/v1/boundaries1 credit

Boundary metadata (no geometry): id, name, level, parent and centroid, with links to /v1/regions and the polygon. Coverage today: ID. Costs 1 credit. With country other than ID, lists world areas (official national sources for US, JP, TH, VN and PH, geoBoundaries elsewhere); level is ADM0, ADM1, ADM2, PLACE or POSTAL (US cities and ZCTA postal areas) and parent_id is a boundary id. Each area names its provider, licence and attribution.

ParameterInTypeRules
levelquerystringone of province, regency, district, village, ADM0, ADM1, ADM2, PLACE, POSTAL · Indonesia: province, regency, district or village. Other countries: ADM0, ADM1, ADM2, PLACE or POSTAL (PLACE and POSTAL: US only).
parent_idquerystringOnly areas inside this province, regency or district (a /v1/regions id).
countryquerystringISO 3166-1 alpha-2 · ISO 3166-1 alpha-2 filter. Countries outside coverage return an empty page.
pagequeryintegerdefault 1 · Page number.
limitqueryinteger1 to 100 · default 50 · Results per page.
GET/v1/boundaries
curl 'https://api.apifor.dev/v1/boundaries' \
  -H 'x-api-key: YOUR_API_KEY'
Example response · 200
{
  "success": true,
  "data": [
    {
      "id": "3273011001",
      "boundary_code": "32.73.01.1001",
      "name": "Sukarasa",
      "level": "village",
      "country": "ID",
      "parent_id": "327301",
      "centroid": {
        "lat": -6.874227470295148,
        "lng": 107.58539617161965
      },
      "source_version": "2026.06",
      "region_url": "/v1/regions/3273011001?level=villages",
      "boundary_url": "/v1/boundaries/3273011001"
    },
    {
      "id": "3273011002",
      "boundary_code": "32.73.01.1002",
      "name": "Gegerkalong",
      "level": "village",
      "country": "ID",
      "parent_id": "327301",
      "centroid": {
        "lat": -6.869350446627759,
        "lng": 107.58886500774767
      },
      "source_version": "2026.06",
      "region_url": "/v1/regions/3273011002?level=villages",
      "boundary_url": "/v1/boundaries/3273011002"
    }
  ],
  "meta": {
    "total": 4,
    "page": 1,
    "per_page": 2,
    "total_pages": 2,
    "attribution": {
      "source": "open-admin-data/indonesia-administrative-divisions by jakkrapongt",
      "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://github.com/open-admin-data/indonesia-administrative-divisions/blob/main/LICENSE",
      "notice": "Boundaries from open-admin-data/indonesia-administrative-divisions (release 2026.06) by jakkrapongt, licensed CC BY 4.0. Changed by APIFo..."
    }
  }
}
  • 200OK
  • 400Invalid parameters (not charged)
GET/v1/boundaries/coverageFree

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/boundaries/coverage
curl 'https://api.apifor.dev/v1/boundaries/coverage' \
  -H 'x-api-key: YOUR_API_KEY'
Example response · 200
{
  "success": true,
  "data": {
    "service": "boundaries",
    "global": false,
    "country_param": "optional",
    "param_name": "country",
    "countries": [
      {
        "country": "ID",
        "market": null,
        "subdivision_levels": [
          "province",
          "regency"
        ],
        "rows": null,
        "updated_at": null,
        "sources": [
          {
            "name": "open-admin-data/indonesia-administrative-divisions",
            "url": "https://github.com/open-admin-data/indonesia-administrative-divisions",
            "licence": "CC BY 4.0",
            "attribution": null
          }
        ],
        "local_fields": [],
        "notes": null
      },
      {
        "country": "MY",
        "market": null,
        "subdivision_levels": [
          "ADM0",
          "ADM1"
        ],
        "rows": 17,
        "updated_at": "2026-11-30",
        "sources": [
          {
            "name": "Open Street Map via geoBoundaries gbOpen (ADM0)",
            "url": "https://www.geoboundaries.org/api/current/gbOpen/MYS/ADM0/",
            "licence": "ODbL 1.0",
            "attribution": "Open Street Map, ODbL 1.0, via geoBoundaries (www.geoboundaries.org); ODbL share-alike"
          },
          {
            "name": "OpenStreetMap, Wambacher via geoBoundaries gbOpen (ADM1)",
            "url": "https://www.geoboundaries.org/api/current/gbOpen/MYS/ADM1/",
            "licence": "ODbL 1.0",
            "attribution": "OpenStreetMap, Wambacher, ODbL 1.0, via geoBoundaries (www.geoboundaries.org); ODbL share-alike"
          }
        ],
        "local_fields": [],
        "notes": "ADM2 file is CC BY 3.0 (citypopulation.de) and not loaded."
      }
    ]
  }
}
  • 200Coverage

Error handling · Rate limits · Prices