teryt24.pl

teryt24.pl · API reference

Administrative boundaries (GeoJSON)

GET /v1/boundaries/counties and GET /v1/boundaries/regions return Poland's administrative boundaries from the committed PRG edition (GUGiK) as RFC 7946 FeatureCollections in WGS84: 380 counties (cities with county rights included) and 16 voivodeships, keyed by TERC code. Each feature carries a Polygon or MultiPolygon geometry in [lon, lat] pairs (rings closed, exteriors counterclockwise) and the properties terc, name (the verbatim TERC catalog name of this instance; null when the catalog does not carry it), kind, provinceCode, and labelLat/labelLon — the label point: the interior point furthest from the shape's own boundary, not the bounding box's centre, which lies in a neighbour for ten of the 380 counties.

A border two neighbours share is simplified ONCE — as an arc both counties walk — so neighbouring features carry the same line, with no cracks between counties and none painted over with a white stroke. The optional ?province=<WOJ> filter narrows the collection to one voivodeship (the whole country is ~0.7 MB raw, ~70 kB compressed); a well-formed code the geometry does not cover is a 404 — an empty collection would read as "a voivodeship went missing". The X-PRG-Boundaries-Version response header names the PRG edition the geometry came from, so a consumer can audit what it drew.

GET /v1/boundaries/counties

All 380 counties in one GeoJSON; ?province= narrows to one voivodeship. Content-Type: application/geo+json.

Try it live: /v1/boundaries/counties?province=14

Parameters
NameRequiredDescription
province—Optional 2-digit TERC voivodeship code filter (e.g. '14'), as served by /v1/regions — trims the collection to that voivodeship's geometry. A blank value is treated as absent.

Example

Mazowieckie's counties (?province=14)

curl "https://teryt24.pl/v1/boundaries/counties?province=14"

Response (truncated — first rows shown):

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Polygon",
        "coordinates": [[
          [21.20657, 51.58833], [21.21739, 51.59667], [21.20116, 51.605],
          [21.21739, 51.60667], [21.2282, 51.63167], [21.24172, 51.63667],
          … 67 more pairs — the ring closes on [21.20657, 51.58833]
        ]]
      },
      "properties": { "terc": "1401", "name": "białobrzeski", "kind": "powiat", "provinceCode": "14", "labelLat": 51.61462, "labelLon": 20.95693 }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "MultiPolygon",
        "coordinates": [
          [[ [20.85504, 51.34333], [20.86045, 51.36], [20.84152, 51.35667], … 79 more pairs — closes on [20.85504, 51.34333] ]],
          [[ [20.61978, 51.235], [20.62789, 51.24], [20.61708, 51.24333], [20.61978, 51.235] ]]
        ]
      },
      "properties": { "terc": "1423", "name": "przysuski", "kind": "powiat", "provinceCode": "14", "labelLat": 51.38507, "labelLon": 20.63991 }
    }
  ]
}
Responses
StatusDescription
200Successful response — an RFC 7946 FeatureCollection.
400Invalid query parameters.
404The province filter is a well-formed code the boundary geometry does not cover.
429Rate limit exceeded (60 requests/min/IP) or a plan's monthly quota exhausted. Includes `Retry-After` and `X-RateLimit-*` headers; the body's `code` distinguishes the two kinds.
503Service is warming up.
The shapes the endpoint returns — the same arcs, transformed to WGS84. Boundaries: PRG (GUGiK), edition 2026-10-14.

The whole example live — a choropleth of the 380 counties shaded by this instance's real figures — runs on the boundaries demo.

const res = await fetch("https://teryt24.pl/v1/boundaries/counties?province=14");
const geo = await res.json();  // RFC 7946 FeatureCollection — WGS84 [lon, lat]

map.on("load", function () {
  map.addSource("powiats", { type: "geojson", data: geo });
  map.addLayer({
    id: "powiats-fill",
    type: "fill",
    source: "powiats",
    paint: { "fill-color": "#9fc7ae", "fill-opacity": 0.55 },
  });
  map.addLayer({
    id: "powiats-outline",
    type: "line",
    source: "powiats",
    paint: { "line-color": "#2f6f4f", "line-width": 0.7 },
  });
});
// feature.properties.terc is the join key: the same 4-digit county codes
// GET /v1/regions/{code}/counties answers with, so shading the map by any
// per-county figure of your own is one match() expression on ["get", "terc"].

GET /v1/boundaries/regions

The 16 voivodeships — the same geometry as the counties, one level up: provinceCode equals terc here.

Try it live: /v1/boundaries/regions

Parameters
NameRequiredDescription
province—Optional 2-digit TERC voivodeship code filter (e.g. '14'), as served by /v1/regions — trims the collection to that voivodeship's geometry. A blank value is treated as absent.

Example

The voivodeship list

curl "https://teryt24.pl/v1/boundaries/regions"

Response (truncated — first rows shown):

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Polygon",
        "coordinates": [[
          [16.41491, 51.785], [16.26889, 51.66333], [16.21751, 51.715],
          … 137 more pairs — the ring closes on [16.41491, 51.785]
        ]]
      },
      "properties": { "terc": "02", "name": "DOLNOŚLĄSKIE", "kind": "region", "provinceCode": "02", "labelLat": 51.14961, "labelLon": 16.42419 }
    }
    … 15 more features — one per voivodeship, sorted by TERC code
  ]
}
Responses
StatusDescription
200Successful response — an RFC 7946 FeatureCollection.
400Invalid query parameters.
404The province filter is a well-formed code the boundary geometry does not cover.
429Rate limit exceeded (60 requests/min/IP) or a plan's monthly quota exhausted. Includes `Retry-After` and `X-RateLimit-*` headers; the body's `code` distinguishes the two kinds.
503Service is warming up.

Browse the data

The statistics pages draw the same boundaries — a map and a table in the browser:

All /v1 endpoints return JSON, speak CORS and are covered by the openapi.json document. Interactive version of this reference: /en/docs.

Limits: 60 requests/min per IP without a key; an API key (the X-API-Key header) gets its own bucket. Over the limit the endpoints answer HTTP 429 with a Retry-After header. Details: limits & keys · usage policy.

Attribution is a condition of use. When you present results in an application, website, map or report, display: Data: GUS TERYT, PRG address points (GUGiK), GeoNames postal codes — via teryt24.pl with a link to the usage policy. Server-side-only use is exempt.