{
  "openapi": "3.0.3",
  "info": {
    "title": "City Fragments API",
    "version": "1.1.0",
    "description": "54 fragments; original 51 snapshots preserved, three AMG additions on 2026-10-11 with official drainage and terrain. Drainage availability is not real-network completeness."
  },
  "servers": [
    {
      "url": "https://lab.polisplexity.tech/city-fragments/api/v1"
    }
  ],
  "paths": {
    "/fragments": {
      "get": {
        "summary": "List all fragments",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Catalog, metadata or FeatureCollection; source conditions included"
          },
          "304": {
            "description": "Unchanged ETag"
          },
          "400": {
            "description": "Invalid query parameters"
          },
          "404": {
            "description": "Not found or no drainage obtained"
          },
          "405": {
            "description": "Read-only API"
          }
        }
      }
    },
    "/fragments/{id}": {
      "get": {
        "summary": "Fragment metadata",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Catalog, metadata or FeatureCollection; source conditions included"
          },
          "304": {
            "description": "Unchanged ETag"
          },
          "400": {
            "description": "Invalid query parameters"
          },
          "404": {
            "description": "Not found or no drainage obtained"
          },
          "405": {
            "description": "Read-only API"
          }
        }
      }
    },
    "/fragments/{id}/features": {
      "get": {
        "summary": "Paginated GeoJSON",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "layer",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "buildings",
                "roads",
                "drainage",
                "drainage_context"
              ],
              "default": "all"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 500,
              "minimum": 1,
              "maximum": 5000
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0,
              "maximum": 1000000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Catalog, metadata or FeatureCollection; source conditions included"
          },
          "304": {
            "description": "Unchanged ETag"
          },
          "400": {
            "description": "Invalid query parameters"
          },
          "404": {
            "description": "Not found or no drainage obtained"
          },
          "405": {
            "description": "Read-only API"
          }
        }
      }
    },
    "/fragments/{id}/download": {
      "get": {
        "summary": "Full download",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "layer",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "buildings",
                "roads",
                "drainage",
                "drainage_context"
              ],
              "default": "all"
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "geojson",
                "json"
              ],
              "default": "geojson"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Catalog, metadata or FeatureCollection; source conditions included"
          },
          "304": {
            "description": "Unchanged ETag"
          },
          "400": {
            "description": "Invalid query parameters"
          },
          "404": {
            "description": "Not found or no drainage obtained"
          },
          "405": {
            "description": "Read-only API"
          }
        }
      }
    },
    "/fragments/{id}/terrain": {
      "get": {
        "summary": "Georeferenced terrain grid for fragments exposing terrain.available",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON with center, local axes, grid layout, heights and source links"
          },
          "404": {
            "description": "Unknown fragment or terrain package not exposed"
          }
        }
      }
    }
  }
}