{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/geoapify/json-schema/geoapify-postcode-feature-collection-schema.json",
  "title": "PostcodeFeatureCollection",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/geoapify-post-code-api-openapi.yml#/components/schemas/PostcodeFeatureCollection",
  "type": "object",
  "required": [
    "type",
    "features"
  ],
  "properties": {
    "type": {
      "const": "FeatureCollection"
    },
    "features": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PostcodeFeature"
      }
    },
    "bbox": {
      "type": "array",
      "minItems": 4,
      "maxItems": 6,
      "items": {
        "type": "number"
      }
    }
  },
  "$defs": {
    "GeoJsonGeometry": {
      "type": "object",
      "required": [
        "type",
        "coordinates"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "Polygon",
            "MultiPolygon"
          ],
          "description": "Postcode area geometry type."
        },
        "coordinates": {
          "description": "GeoJSON coordinates.",
          "type": "array"
        }
      }
    },
    "PointGeometry": {
      "type": "object",
      "required": [
        "type",
        "coordinates"
      ],
      "properties": {
        "type": {
          "const": "Point"
        },
        "coordinates": {
          "type": "array",
          "minItems": 2,
          "maxItems": 2,
          "prefixItems": [
            {
              "type": "number",
              "minimum": -180,
              "maximum": 180,
              "description": "Longitude."
            },
            {
              "type": "number",
              "minimum": -90,
              "maximum": 90,
              "description": "Latitude."
            }
          ]
        }
      }
    },
    "PostcodeFeature": {
      "type": "object",
      "required": [
        "type",
        "properties",
        "geometry"
      ],
      "properties": {
        "type": {
          "const": "Feature"
        },
        "properties": {
          "$ref": "#/$defs/PostcodeProperties"
        },
        "geometry": {
          "oneOf": [
            {
              "$ref": "#/$defs/PointGeometry"
            },
            {
              "$ref": "#/$defs/GeoJsonGeometry"
            },
            {
              "$ref": "#/$defs/PostcodePointGeometryFeature"
            }
          ]
        },
        "bbox": {
          "type": "array",
          "minItems": 4,
          "maxItems": 6,
          "items": {
            "type": "number"
          }
        }
      }
    },
    "PostcodePointGeometryFeature": {
      "type": "object",
      "required": [
        "type",
        "properties",
        "geometry"
      ],
      "properties": {
        "type": {
          "const": "Feature"
        },
        "properties": {
          "type": "object",
          "additionalProperties": true
        },
        "geometry": {
          "$ref": "#/$defs/PointGeometry"
        }
      }
    },
    "PostcodeProperties": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "continent": {
          "type": "string"
        },
        "country": {
          "type": "string"
        },
        "country_code": {
          "type": "string"
        },
        "region": {
          "type": "string"
        },
        "state": {
          "type": "string"
        },
        "state_code": {
          "type": "string"
        },
        "state_COG": {
          "type": "string"
        },
        "department_COG": {
          "type": "string"
        },
        "state_district": {
          "type": "string"
        },
        "province": {
          "type": "string"
        },
        "department": {
          "type": "string"
        },
        "arrondissement": {
          "type": "string"
        },
        "county": {
          "type": "string"
        },
        "county_code": {
          "type": "string"
        },
        "county_district": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "city_district": {
          "type": "string"
        },
        "postcode": {
          "type": "string"
        },
        "postal_code": {
          "type": "string"
        },
        "openGeoDB:postal_codes": {
          "type": "string"
        },
        "district": {
          "type": "string"
        },
        "suburb": {
          "type": "string"
        },
        "municipality": {
          "type": "string"
        },
        "commune": {
          "type": "string"
        },
        "subdistrict": {
          "type": "string"
        },
        "city_block": {
          "type": "string"
        },
        "neighbourhood": {
          "type": "string"
        },
        "quarter": {
          "type": "string"
        },
        "section": {
          "type": "string"
        },
        "sector": {
          "type": "string"
        },
        "subdivision": {
          "type": "string"
        },
        "croft": {
          "type": "string"
        },
        "allotments": {
          "type": "string"
        },
        "residental": {
          "type": "string"
        },
        "farm": {
          "type": "string"
        },
        "farmyard": {
          "type": "string"
        },
        "industrial": {
          "type": "string"
        },
        "commercial": {
          "type": "string"
        },
        "retail": {
          "type": "string"
        },
        "borough": {
          "type": "string"
        },
        "town": {
          "type": "string"
        },
        "township": {
          "type": "string"
        },
        "village": {
          "type": "string"
        },
        "hamlet": {
          "type": "string"
        },
        "locality": {
          "type": "string"
        },
        "isolated_dwelling": {
          "type": "string"
        },
        "street": {
          "type": "string"
        },
        "road": {
          "type": "string"
        },
        "footway": {
          "type": "string"
        },
        "pedestrian": {
          "type": "string"
        },
        "path": {
          "type": "string"
        },
        "housenumber": {
          "type": "string"
        },
        "house_number": {
          "type": "string"
        },
        "house_name": {
          "type": "string"
        },
        "old_name": {
          "type": "string"
        },
        "other": {
          "type": "string"
        },
        "formatted": {
          "type": "string"
        },
        "address_line1": {
          "type": "string"
        },
        "address_line2": {
          "type": "string"
        },
        "unlocode": {
          "type": "string"
        },
        "iso3166_2": {
          "type": "string"
        },
        "iso3166_2_sublevel": {
          "type": "string"
        },
        "iso3166_sublevel": {
          "type": "string"
        },
        "plus_code": {
          "type": "string"
        },
        "plus_code_short": {
          "type": "string"
        },
        "postcodes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "other_names": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "population": {
          "type": "number"
        },
        "lon": {
          "type": "number",
          "minimum": -180,
          "maximum": 180
        },
        "lat": {
          "type": "number",
          "minimum": -90,
          "maximum": 90
        },
        "parent_as_place_id": {
          "type": "boolean"
        },
        "timezone": {
          "$ref": "#/$defs/TimezoneOutput"
        },
        "ref": {
          "type": "string"
        },
        "distance": {
          "type": "number",
          "minimum": 0
        },
        "result_type": {
          "type": "string",
          "enum": [
            "unknown",
            "amenity_name",
            "amenity",
            "building",
            "street",
            "postcode",
            "suburb",
            "district",
            "city",
            "county",
            "state",
            "country"
          ]
        },
        "datasource": {
          "$ref": "#/$defs/PublicDatasource"
        },
        "place_id": {
          "type": "string",
          "minLength": 3,
          "maxLength": 2048
        }
      }
    },
    "PublicDatasource": {
      "type": "object",
      "properties": {
        "sourcename": {
          "type": "string"
        },
        "attribution": {
          "type": "string"
        },
        "license": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "TimezoneOutput": {
      "type": "object",
      "required": [
        "name",
        "offset_STD",
        "offset_DST",
        "offset_STD_seconds",
        "offset_DST_seconds"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "name_alt": {
          "type": "string"
        },
        "country_codes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "offset_STD": {
          "type": "string"
        },
        "offset_DST": {
          "type": "string"
        },
        "offset_STD_seconds": {
          "type": "number"
        },
        "offset_DST_seconds": {
          "type": "number"
        },
        "abbreviation_STD": {
          "type": "string"
        },
        "abbreviation_DST": {
          "type": "string"
        }
      }
    }
  }
}