{
  "openapi": "3.1.0",
  "info": {
    "title": "Consulta o PDM API",
    "version": "1.1.0",
    "summary": "PDM (municipal master plan) zoning and rules for any point in mainland Portugal.",
    "description": "The PDM zone at a point (CRUS, Direção-Geral do Território), the free preview, national constraints, the full reading of the zone's regulation, and each municipality's PDM status and publications. Limits: 60 calls/minute per key; per account and calendar month, 10000 included lookups (zone, preview, constraints, municipalities; 100000 with API Pro) and 10 free full readings. Pricing: included lookups are free with a key. Full readings beyond the free ones: €1.49 each, pay as you go (card on file), or API Pro at €149/month with 500 readings included, then €0.29 each. Set up at https://www.consultaopdm.pt/conta#api. Every response has an X-Request-Id header; errors share one shape (Error). Docs and terms: https://www.consultaopdm.pt/api",
    "termsOfService": "https://www.consultaopdm.pt/api#termos",
    "contact": {
      "name": "Consulta o PDM",
      "url": "https://www.consultaopdm.pt/api"
    }
  },
  "servers": [
    {
      "url": "https://www.consultaopdm.pt/api/v1"
    }
  ],
  "security": [
    {
      "bearer": []
    },
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Points",
      "description": "What applies at a point."
    },
    {
      "name": "Municipalities",
      "description": "The PDM of each of the 278 municipalities (concelhos)."
    },
    {
      "name": "Demo",
      "description": "Keyless, rate-limited; for trying the API."
    }
  ],
  "paths": {
    "/zone": {
      "get": {
        "tags": [
          "Points"
        ],
        "operationId": "getZone",
        "summary": "The PDM zone at a point",
        "description": "Class, category, designation, municipality and plan date of the CRUS zone containing the point. Included.",
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number",
              "minimum": -90,
              "maximum": 90
            },
            "example": 41.551273,
            "description": "Latitude, WGS84 decimal degrees."
          },
          {
            "name": "lon",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number",
              "minimum": -180,
              "maximum": 180
            },
            "example": -8.353765,
            "description": "Longitude, WGS84 decimal degrees."
          }
        ],
        "responses": {
          "200": {
            "description": "The zone.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "zone",
                    "attribution"
                  ],
                  "properties": {
                    "zone": {
                      "$ref": "#/components/schemas/Zone"
                    },
                    "attribution": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "zone": {
                    "dtcc": "0303",
                    "municipio": "Braga",
                    "classe": "Solo Urbano",
                    "categoria": "Espaço Urbano de Baixa Densidade",
                    "designacao": "Solo Urbano - Espaço Urbano de Baixa Densidade",
                    "pdmDate": "2026-04-15",
                    "zoneAreaHa": 17.32
                  },
                  "attribution": "…"
                }
              }
            }
          },
          "400": {
            "description": "Bad parameters (bad_request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked key (unauthorized).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No zoning at this point (no_zone).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls in a minute (rate_limited, see Retry-After) or monthly allowance used (monthly_limit).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Our side failed (server_error); quote request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/preview": {
      "get": {
        "tags": [
          "Points"
        ],
        "operationId": "getPreview",
        "summary": "The zone and the free preview",
        "description": "Whether building is allowed, one real figure from the regulation, and how many parameters, uses, conditions and articles the full reading has. Included.",
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number",
              "minimum": -90,
              "maximum": 90
            },
            "example": 41.551273,
            "description": "Latitude, WGS84 decimal degrees."
          },
          {
            "name": "lon",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number",
              "minimum": -180,
              "maximum": 180
            },
            "example": -8.353765,
            "description": "Longitude, WGS84 decimal degrees."
          },
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pt",
                "en"
              ],
              "default": "pt"
            },
            "description": "Language of the text fields."
          }
        ],
        "responses": {
          "200": {
            "description": "Zone and preview.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "zone": {
                      "$ref": "#/components/schemas/Zone"
                    },
                    "preview": {
                      "$ref": "#/components/schemas/Preview"
                    },
                    "attribution": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad parameters (bad_request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked key (unauthorized).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No zoning at this point (no_zone).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls in a minute (rate_limited, see Retry-After) or monthly allowance used (monthly_limit).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Our side failed (server_error); quote request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/constraints": {
      "get": {
        "tags": [
          "Points"
        ],
        "operationId": "getConstraints",
        "summary": "National restrictions and servitudes at a point",
        "description": "RAN, REN, Natura 2000, protected areas, reservoirs, and road, rail, power line, airport and defence servitudes, live from DGT (SRUP). hit is null for a layer DGT didn't answer. Included.",
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number",
              "minimum": -90,
              "maximum": 90
            },
            "example": 41.551273,
            "description": "Latitude, WGS84 decimal degrees."
          },
          {
            "name": "lon",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number",
              "minimum": -180,
              "maximum": 180
            },
            "example": -8.353765,
            "description": "Longitude, WGS84 decimal degrees."
          }
        ],
        "responses": {
          "200": {
            "description": "One entry per layer.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "point": {
                      "type": "object",
                      "properties": {
                        "lat": {
                          "type": "number"
                        },
                        "lon": {
                          "type": "number"
                        }
                      }
                    },
                    "constraints": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "layer": {
                            "type": "string"
                          },
                          "hit": {
                            "type": [
                              "boolean",
                              "null"
                            ]
                          },
                          "items": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "designacao": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "tipologia": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "lei": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "data": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "link": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "source": {
                      "type": "string"
                    },
                    "attribution": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad parameters (bad_request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked key (unauthorized).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls in a minute (rate_limited, see Retry-After) or monthly allowance used (monthly_limit).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Our side failed (server_error); quote request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "DGT didn't answer for any layer (unavailable). Not counted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/reading": {
      "get": {
        "tags": [
          "Points"
        ],
        "operationId": "getReading",
        "summary": "The full reading of the zone's regulation",
        "description": "Parameters, allowed and forbidden uses, conditions, articles, recommendation and confidence. Metered: 1 reading per successful call. 10 free a month per account; then €1.49 each (pay as you go), or API Pro (500 included, then €0.29). Failed readings are not charged. A zone read for the first time can take 10–30 s.",
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number",
              "minimum": -90,
              "maximum": 90
            },
            "example": 41.551273,
            "description": "Latitude, WGS84 decimal degrees."
          },
          {
            "name": "lon",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number",
              "minimum": -180,
              "maximum": 180
            },
            "example": -8.353765,
            "description": "Longitude, WGS84 decimal degrees."
          },
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pt",
                "en"
              ],
              "default": "pt"
            },
            "description": "Language of the text fields."
          }
        ],
        "responses": {
          "200": {
            "description": "Zone and reading.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "zone": {
                      "$ref": "#/components/schemas/Zone"
                    },
                    "reading": {
                      "$ref": "#/components/schemas/Reading"
                    },
                    "attribution": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad parameters (bad_request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked key (unauthorized).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Free readings for the month used and no payment method: turn on pay as you go or API Pro at /conta#api (billing_required).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No zoning at this point (no_zone).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls in a minute (rate_limited, see Retry-After) or monthly allowance used (monthly_limit).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Our side failed (server_error); quote request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "The regulation couldn't be read now (reading_unavailable). Not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/zones/batch": {
      "post": {
        "tags": [
          "Points"
        ],
        "operationId": "postZonesBatch",
        "summary": "The zone at up to 50 points",
        "description": "Results come back in the order sent, with your id. One call for the per-minute limit; each point counts towards the monthly allowance.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "points"
                ],
                "properties": {
                  "points": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 50,
                    "items": {
                      "type": "object",
                      "required": [
                        "lat",
                        "lon"
                      ],
                      "properties": {
                        "lat": {
                          "type": "number"
                        },
                        "lon": {
                          "type": "number"
                        },
                        "id": {
                          "type": "string",
                          "description": "Yours; echoed back."
                        }
                      }
                    }
                  }
                }
              },
              "example": {
                "points": [
                  {
                    "id": "listing-17",
                    "lat": 41.551273,
                    "lon": -8.353765
                  },
                  {
                    "id": "listing-18",
                    "lat": 38.7223,
                    "lon": -9.1393
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One result per point.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer"
                          },
                          "id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "lat": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "lon": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "zone": {
                            "oneOf": [
                              {
                                "$ref": "#/components/schemas/Zone"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "error": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "no_zone",
                              "bad_point",
                              null
                            ]
                          }
                        }
                      }
                    },
                    "count": {
                      "type": "integer"
                    },
                    "found": {
                      "type": "integer"
                    },
                    "attribution": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad parameters (bad_request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked key (unauthorized).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "More than 50 points (payload_too_large).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls in a minute (rate_limited, see Retry-After) or monthly allowance used (monthly_limit).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Our side failed (server_error); quote request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/concelhos": {
      "get": {
        "tags": [
          "Municipalities"
        ],
        "operationId": "listConcelhos",
        "summary": "List municipalities, paginated; or only those changed since a date",
        "description": "A–Z. With changed_since, only municipalities with a publication (new plan, amendment, suspension) dated on or after that day, and the list of those publications: poll it daily to learn about PDM revisions. Dates are Diário da República publication dates; a publication appears here once we sync it from SNIT (latestPublication tells you how far our data goes).",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "distrito",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "example": "porto",
            "description": "Name or slug of a distrito."
          },
          {
            "name": "changed_since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "example": "2026-01-01"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of municipalities.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ConcelhoSummary"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "latestPublication": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date"
                    },
                    "attribution": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad parameters (bad_request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked key (unauthorized).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls in a minute (rate_limited, see Retry-After) or monthly allowance used (monthly_limit).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Our side failed (server_error); quote request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/concelho/{id}": {
      "get": {
        "tags": [
          "Municipalities"
        ],
        "operationId": "getConcelho",
        "summary": "One municipality's PDM",
        "description": "Plan in force, amendments, suspensions, zoning date, statistics and top land-use categories. Included.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "0303",
            "description": "4-digit DTMN code or slug (e.g. braga)."
          }
        ],
        "responses": {
          "200": {
            "description": "The municipality.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "concelho": {
                      "$ref": "#/components/schemas/Concelho"
                    },
                    "attribution": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad parameters (bad_request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked key (unauthorized).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown municipality (not_found).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls in a minute (rate_limited, see Retry-After) or monthly allowance used (monthly_limit).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Our side failed (server_error); quote request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/demo/preview": {
      "get": {
        "tags": [
          "Demo"
        ],
        "operationId": "demoPreview",
        "summary": "The preview without a key (demo)",
        "description": "Same as /preview, without a key, 10 calls a minute per IP. For trying the API; use a key in your software.",
        "security": [],
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number",
              "minimum": -90,
              "maximum": 90
            },
            "example": 41.551273,
            "description": "Latitude, WGS84 decimal degrees."
          },
          {
            "name": "lon",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number",
              "minimum": -180,
              "maximum": 180
            },
            "example": -8.353765,
            "description": "Longitude, WGS84 decimal degrees."
          },
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pt",
                "en"
              ],
              "default": "pt"
            },
            "description": "Language of the text fields."
          }
        ],
        "responses": {
          "200": {
            "description": "Zone and preview.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "zone": {
                      "$ref": "#/components/schemas/Zone"
                    },
                    "preview": {
                      "$ref": "#/components/schemas/Preview"
                    },
                    "demo": {
                      "const": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad parameters (bad_request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No zoning at this point (no_zone).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls in a minute (rate_limited, see Retry-After) or monthly allowance used (monthly_limit).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Authorization: Bearer pdm_live_… (create a key at /conta#api)."
      },
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "headers": {
      "RequestId": {
        "description": "Id of this request; quote it to support.",
        "schema": {
          "type": "string"
        }
      },
      "RateLimitRemaining": {
        "description": "Calls left in the current minute.",
        "schema": {
          "type": "integer"
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error",
          "request_id"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "status"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "bad_request",
                  "unauthorized",
                  "billing_required",
                  "not_found",
                  "no_zone",
                  "method_not_allowed",
                  "payload_too_large",
                  "rate_limited",
                  "monthly_limit",
                  "server_error",
                  "reading_unavailable",
                  "unavailable"
                ]
              },
              "message": {
                "type": "string"
              },
              "status": {
                "type": "integer"
              },
              "docs": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "request_id": {
            "type": "string"
          }
        },
        "example": {
          "error": {
            "code": "bad_request",
            "message": "Pass ?lat=…&lon=… (WGS84 decimal degrees).",
            "status": 400,
            "docs": "https://www.consultaopdm.pt/api#error-bad_request"
          },
          "request_id": "req_3f2a9c1e0b7d4a8e9f10"
        }
      },
      "Zone": {
        "type": "object",
        "properties": {
          "dtcc": {
            "type": "string",
            "description": "4-digit municipality code (DTMN)."
          },
          "municipio": {
            "type": "string"
          },
          "classe": {
            "type": "string",
            "description": "Solo Urbano or Solo Rústico."
          },
          "categoria": {
            "type": "string",
            "description": "Harmonised land-use category."
          },
          "designacao": {
            "type": "string",
            "description": "The name the PDM itself gives the zone."
          },
          "pdmDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Publication date of the plan the zoning comes from."
          },
          "zoneAreaHa": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "example": {
          "dtcc": "0303",
          "municipio": "Braga",
          "classe": "Solo Urbano",
          "categoria": "Espaço Urbano de Baixa Densidade",
          "designacao": "Solo Urbano - Espaço Urbano de Baixa Densidade",
          "pdmDate": "2026-04-15",
          "zoneAreaHa": 17.32
        }
      },
      "Preview": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "verdict": {
            "type": "string",
            "enum": [
              "yes",
              "conditional",
              "no",
              "unclear"
            ]
          },
          "params": {
            "type": "integer"
          },
          "uses": {
            "type": "integer"
          },
          "conditions": {
            "type": "integer"
          },
          "articles": {
            "type": "integer"
          },
          "free": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "key": {
                "type": "string"
              },
              "value": {}
            }
          }
        }
      },
      "Reading": {
        "type": "object",
        "properties": {
          "verdict": {
            "type": [
              "string",
              "null"
            ]
          },
          "headline": {
            "type": [
              "string",
              "null"
            ]
          },
          "recommendation": {
            "type": [
              "string",
              "null"
            ]
          },
          "params": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "minParcelM2": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "utilizationIndex": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "maxAbcM2": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "maxFloors": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "maxHeightM": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "maxFootprintPct": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "maxImpermeablePct": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          },
          "buildTypes": {
            "type": [
              "array",
              "null"
            ],
            "description": "Can each building type be built here: moradia (house), apartamentos (multi-family), comercio, servicos, turismo, industria, agricola. answer: yes | conditional | no | unclear; note: the condition; ref: the article.",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "moradia",
                    "apartamentos",
                    "comercio",
                    "servicos",
                    "turismo",
                    "industria",
                    "agricola"
                  ]
                },
                "answer": {
                  "type": "string",
                  "enum": [
                    "yes",
                    "conditional",
                    "no",
                    "unclear"
                  ]
                },
                "note": {
                  "type": "string"
                },
                "ref": {
                  "type": "string"
                }
              }
            }
          },
          "paramStatus": {
            "type": [
              "object",
              "null"
            ],
            "description": "Per parameter (minParcelM2, utilizationIndex, maxAbcM2, maxFloors, maxHeightM, maxFootprintPct, maxImpermeablePct, minFrontageM, setbacks, maxDwellings): set | not_set (the plan sets no such limit for this zone) | other (limited in another form or by a general article; see conditions) | not_found (not found in the regulation).",
            "additionalProperties": {
              "type": "string",
              "enum": [
                "set",
                "not_set",
                "other",
                "not_found"
              ]
            }
          },
          "indexRule": {
            "type": [
              "object",
              "null"
            ],
            "description": "How the floor-area index applies: single, road_band (indexInBand within bandDepthM metres of an existing road, indexBeyond elsewhere), other, none.",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "single",
                  "road_band",
                  "other",
                  "none"
                ]
              },
              "bandDepthM": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "indexInBand": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "indexBeyond": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "note": {
                "type": "string"
              },
              "ref": {
                "type": "string"
              }
            }
          },
          "allowedUses": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "forbiddenUses": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "conditions": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "articles": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "properties": {
                "ref": {
                  "type": "string"
                },
                "topic": {
                  "type": "string"
                }
              }
            }
          },
          "requiresPlan": {},
          "confidence": {
            "type": [
              "string",
              "null"
            ]
          },
          "confidenceNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "document": {
            "description": "The regulation version read."
          }
        }
      },
      "Publication": {
        "type": "object",
        "properties": {
          "type": {
            "type": [
              "string",
              "null"
            ],
            "example": "3ª REVISÃO"
          },
          "act": {
            "type": [
              "string",
              "null"
            ],
            "example": "AVISO 8551/2026/2"
          },
          "date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "document": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          }
        }
      },
      "ConcelhoSummary": {
        "type": "object",
        "properties": {
          "dtcc": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "distrito": {
            "type": "string"
          },
          "pdmInForce": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Publication"
              },
              {
                "type": "null"
              }
            ]
          },
          "lastChange": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "zoningDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "changes": {
            "type": "integer"
          },
          "suspensions": {
            "type": "integer"
          },
          "changedSince": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Publication"
            },
            "description": "Only with changed_since: the publications on or after that date, newest first."
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "page": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Concelho": {
        "type": "object",
        "properties": {
          "dtcc": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "distrito": {
            "type": "string"
          },
          "areaHa": {
            "type": "number"
          },
          "urbanPct": {
            "type": [
              "number",
              "null"
            ]
          },
          "zones": {
            "type": "integer"
          },
          "pdmInForce": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Publication"
              },
              {
                "type": "null"
              }
            ]
          },
          "zoningDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "lastChange": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Publication"
            }
          },
          "suspensions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Publication"
            }
          },
          "topCategories": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "classe": {
                  "type": "string"
                },
                "categoria": {
                  "type": "string"
                },
                "ha": {
                  "type": "number"
                },
                "zones": {
                  "type": "integer"
                }
              }
            }
          },
          "page": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Pagination": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "nextOffset": {
            "type": [
              "integer",
              "null"
            ]
          },
          "next": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "URL of the next page; null on the last page."
          }
        }
      }
    }
  }
}