{
  "openapi": "3.1.0",
  "info": {
    "title": "MapSnap map tools",
    "version": "1.0.0",
    "description": "Read-only HTTP operations for Swiss location lookup and SVG map generation. All bounds from searchLocations are WGS84 degrees; exportSvgMap takes Web Mercator metres. Please be kind to the server/API: run map exports sequentially and wait for each response, cache and reuse results, request only the necessary area, and avoid bulk scraping or redundant requests. If HTTP 429 or 503 is returned, respect Retry-After and use bounded retries with increasing delays."
  },
  "servers": [
    {
      "url": "https://mapsnap.ch/api",
      "description": "MapSnap production API"
    }
  ],
  "security": [],
  "externalDocs": {
    "description": "Human-readable API guide",
    "url": "https://mapsnap.ch/developers/"
  },
  "paths": {
    "/location": {
      "get": {
        "operationId": "searchLocations",
        "summary": "Find Swiss places or postal codes",
        "description": "Returns matching places with centre and bounding box in EPSG:4326 degrees. Confirm the intended match, then convert bounds to EPSG:3857 before calling exportSvgMap. An empty array means no matches.",
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "example": "Bern"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Location"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid search query"
          }
        }
      }
    },
    "/map/themes": {
      "get": {
        "operationId": "listMapThemes",
        "summary": "List available map theme names",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "example": [
                    "default",
                    "dark-pastel",
                    "pirate",
                    "fluffy-unicorn",
                    "vintage",
                    "pastel",
                    "vaporwave",
                    "sunset",
                    "rose",
                    "candy",
                    "midnight"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/map/fonts": {
      "get": {
        "operationId": "listMapFonts",
        "summary": "List bundled SVG fonts",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "id",
                      "family"
                    ],
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "family": {
                        "type": "string"
                      }
                    }
                  },
                  "example": [
                    {
                      "id": "noto-sans",
                      "family": "Noto Sans"
                    },
                    {
                      "id": "noto-serif",
                      "family": "Noto Serif"
                    },
                    {
                      "id": "lato",
                      "family": "Lato"
                    },
                    {
                      "id": "montserrat",
                      "family": "Montserrat"
                    },
                    {
                      "id": "raleway",
                      "family": "Raleway"
                    },
                    {
                      "id": "merriweather",
                      "family": "Merriweather"
                    },
                    {
                      "id": "roboto-mono",
                      "family": "Roboto Mono"
                    },
                    {
                      "id": "open-sans",
                      "family": "Open Sans"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/map/west/{west}/south/{south}/east/{east}/north/{north}": {
      "get": {
        "operationId": "exportSvgMap",
        "summary": "Export a Swiss map excerpt as SVG",
        "description": "Use EPSG:3857 metre bounds, with west < east and south < north. For a place name, call searchLocations and convert its degree bounds first. Selected fonts and their licenses are embedded in the SVG. Coverage is Switzerland; empty or incomplete map content is possible outside the source dataset. Please protect server capacity: export one map at a time, reuse cached responses, keep bounds as small as needed, and avoid bulk or repeated exports. Respect Retry-After if HTTP 429 or 503 is returned; retry only a limited number of times with increasing delays.",
        "parameters": [
          {
            "name": "west",
            "in": "path",
            "required": true,
            "description": "West boundary in EPSG:3857 metres; not WGS84 degrees.",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "south",
            "in": "path",
            "required": true,
            "description": "South boundary in EPSG:3857 metres; not WGS84 degrees.",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "east",
            "in": "path",
            "required": true,
            "description": "East boundary in EPSG:3857 metres; not WGS84 degrees.",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "north",
            "in": "path",
            "required": true,
            "description": "North boundary in EPSG:3857 metres; not WGS84 degrees.",
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "theme",
            "in": "query",
            "description": "Colour theme from listMapThemes. Unknown names fall back to default.",
            "schema": {
              "type": "string",
              "default": "default"
            },
            "example": "dark-pastel"
          },
          {
            "name": "font",
            "in": "query",
            "description": "SVG font ID from listMapFonts, or its family name (case-insensitive). Defaults to im-fell-english for theme=pirate, otherwise noto-sans. An explicit font overrides the theme default. Omit in raw mode. Unsupported fonts return 400.",
            "schema": {
              "type": "string",
              "default": "noto-sans"
            },
            "example": "montserrat"
          },
          {
            "name": "contourLines",
            "in": "query",
            "description": "Include altitude contours in the detailed dataset. The API default is true; the web editor explicitly starts with false.",
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "raw",
            "in": "query",
            "description": "Leave false for SVG. True returns a MapLibre style as application/octet-stream and cannot be combined with a font parameter.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "fontScale",
            "in": "query",
            "description": "Global font size multiplier for places, lakes and streets. Zero omits all labels and embedded SVG fonts.",
            "schema": {
              "type": "number",
              "format": "double",
              "minimum": 0,
              "maximum": 3,
              "default": 1
            },
            "example": 1.5
          },
          {
            "name": "streetNames",
            "in": "query",
            "description": "Show street names where provided by the dataset. Ignored when fontScale is zero.",
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "placeNames",
            "in": "query",
            "description": "Show village/city names. Does not hide lake labels; fontScale zero hides all labels.",
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "color-background",
            "in": "query",
            "description": "Background override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#F8FEF4"
          },
          {
            "name": "color-water-lake",
            "in": "query",
            "description": "Lakes override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#C3E4F9"
          },
          {
            "name": "color-water-river",
            "in": "query",
            "description": "Rivers override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#A8D8F6"
          },
          {
            "name": "color-forest",
            "in": "query",
            "description": "Forest override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#D7EFD5"
          },
          {
            "name": "color-agriculture",
            "in": "query",
            "description": "Agricultural land override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#B5D7AD"
          },
          {
            "name": "color-leisure",
            "in": "query",
            "description": "Leisure areas override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#B5D7AD"
          },
          {
            "name": "color-settlement",
            "in": "query",
            "description": "Settlements override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#EEEEEE"
          },
          {
            "name": "color-trafficarea",
            "in": "query",
            "description": "Traffic areas override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#D8D6D6"
          },
          {
            "name": "color-tarmac",
            "in": "query",
            "description": "Paved areas override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#D8D6D6"
          },
          {
            "name": "color-building",
            "in": "query",
            "description": "Buildings override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#6D6D6D"
          },
          {
            "name": "color-rock",
            "in": "query",
            "description": "Rock override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#E6E6E6"
          },
          {
            "name": "color-height",
            "in": "query",
            "description": "Altitude contours override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#AD7435"
          },
          {
            "name": "color-road",
            "in": "query",
            "description": "Roads override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#D8D6D6"
          },
          {
            "name": "color-highway",
            "in": "query",
            "description": "Highways override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#FFE547"
          },
          {
            "name": "color-railway",
            "in": "query",
            "description": "Railways override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#000000"
          },
          {
            "name": "color-footpath",
            "in": "query",
            "description": "Footpaths override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#000000"
          },
          {
            "name": "color-border",
            "in": "query",
            "description": "Administrative borders override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#737373"
          },
          {
            "name": "color-grid",
            "in": "query",
            "description": "Grid override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#999999"
          },
          {
            "name": "color-label",
            "in": "query",
            "description": "Labels override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#333333"
          }
        ],
        "responses": {
          "200": {
            "description": "SVG document, or MapLibre style JSON if raw=true.",
            "content": {
              "image/svg+xml": {
                "schema": {
                  "type": "string"
                }
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Invalid bounds, font, fontScale (must be finite and 0–3), color, boolean query value, repeated color parameter, or incompatible raw/font options."
          }
        }
      }
    },
    "/map/colors": {
      "get": {
        "operationId": "getMapColors",
        "summary": "Discover editable layer colors for a theme",
        "description": "Returns editable fill and line colors. Filled shape outlines are automatically 15% darker than their fill and cannot be overridden separately. Text labels use white halos in light themes and dark halos in dark themes. Omit theme to use default; color-{layer} query parameters override individual layers.",
        "parameters": [
          {
            "name": "theme",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "default"
            }
          },
          {
            "name": "color-background",
            "in": "query",
            "description": "Background override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#F8FEF4"
          },
          {
            "name": "color-water-lake",
            "in": "query",
            "description": "Lakes override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#C3E4F9"
          },
          {
            "name": "color-water-river",
            "in": "query",
            "description": "Rivers override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#A8D8F6"
          },
          {
            "name": "color-forest",
            "in": "query",
            "description": "Forest override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#D7EFD5"
          },
          {
            "name": "color-agriculture",
            "in": "query",
            "description": "Agricultural land override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#B5D7AD"
          },
          {
            "name": "color-leisure",
            "in": "query",
            "description": "Leisure areas override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#B5D7AD"
          },
          {
            "name": "color-settlement",
            "in": "query",
            "description": "Settlements override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#EEEEEE"
          },
          {
            "name": "color-trafficarea",
            "in": "query",
            "description": "Traffic areas override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#D8D6D6"
          },
          {
            "name": "color-tarmac",
            "in": "query",
            "description": "Paved areas override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#D8D6D6"
          },
          {
            "name": "color-building",
            "in": "query",
            "description": "Buildings override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#6D6D6D"
          },
          {
            "name": "color-rock",
            "in": "query",
            "description": "Rock override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#E6E6E6"
          },
          {
            "name": "color-height",
            "in": "query",
            "description": "Altitude contours override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#AD7435"
          },
          {
            "name": "color-road",
            "in": "query",
            "description": "Roads override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#D8D6D6"
          },
          {
            "name": "color-highway",
            "in": "query",
            "description": "Highways override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#FFE547"
          },
          {
            "name": "color-railway",
            "in": "query",
            "description": "Railways override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#000000"
          },
          {
            "name": "color-footpath",
            "in": "query",
            "description": "Footpaths override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#000000"
          },
          {
            "name": "color-border",
            "in": "query",
            "description": "Administrative borders override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#737373"
          },
          {
            "name": "color-grid",
            "in": "query",
            "description": "Grid override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#999999"
          },
          {
            "name": "color-label",
            "in": "query",
            "description": "Labels override. Takes priority over theme; encode # as %23.",
            "schema": {
              "type": "string",
              "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
            },
            "example": "#333333"
          }
        ],
        "responses": {
          "200": {
            "description": "Effective palette",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "theme",
                    "colors"
                  ],
                  "properties": {
                    "theme": {
                      "type": "string"
                    },
                    "colors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "layer",
                          "label",
                          "color"
                        ],
                        "properties": {
                          "layer": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "color": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "theme": "default",
                  "colors": [
                    {
                      "layer": "background",
                      "label": "Background",
                      "color": "#F8FEF4"
                    },
                    {
                      "layer": "water-lake",
                      "label": "Lakes",
                      "color": "#C3E4F9"
                    },
                    {
                      "layer": "water-river",
                      "label": "Rivers",
                      "color": "#A8D8F6"
                    },
                    {
                      "layer": "forest",
                      "label": "Forest",
                      "color": "#D7EFD5"
                    },
                    {
                      "layer": "agriculture",
                      "label": "Agricultural land",
                      "color": "#B5D7AD"
                    },
                    {
                      "layer": "leisure",
                      "label": "Leisure areas",
                      "color": "#B5D7AD"
                    },
                    {
                      "layer": "settlement",
                      "label": "Settlements",
                      "color": "#EEEEEE"
                    },
                    {
                      "layer": "trafficarea",
                      "label": "Traffic areas",
                      "color": "#D8D6D6"
                    },
                    {
                      "layer": "tarmac",
                      "label": "Paved areas",
                      "color": "#D8D6D6"
                    },
                    {
                      "layer": "building",
                      "label": "Buildings",
                      "color": "#6D6D6D"
                    },
                    {
                      "layer": "rock",
                      "label": "Rock",
                      "color": "#E6E6E6"
                    },
                    {
                      "layer": "height",
                      "label": "Altitude contours",
                      "color": "#AD7435"
                    },
                    {
                      "layer": "road",
                      "label": "Roads",
                      "color": "#D8D6D6"
                    },
                    {
                      "layer": "highway",
                      "label": "Highways",
                      "color": "#FFE547"
                    },
                    {
                      "layer": "railway",
                      "label": "Railways",
                      "color": "#000000"
                    },
                    {
                      "layer": "footpath",
                      "label": "Footpaths",
                      "color": "#000000"
                    },
                    {
                      "layer": "border",
                      "label": "Administrative borders",
                      "color": "#737373"
                    },
                    {
                      "layer": "grid",
                      "label": "Grid",
                      "color": "#999999"
                    },
                    {
                      "layer": "label",
                      "label": "Labels",
                      "color": "#333333"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid, duplicate or unknown color parameter."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Location": {
        "type": "object",
        "required": [
          "name",
          "latitude",
          "longitude",
          "west",
          "south",
          "east",
          "north"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "latitude": {
            "type": "number",
            "format": "double",
            "description": "WGS84 / EPSG:4326 degrees"
          },
          "longitude": {
            "type": "number",
            "format": "double",
            "description": "WGS84 / EPSG:4326 degrees"
          },
          "west": {
            "type": "number",
            "format": "double",
            "description": "WGS84 / EPSG:4326 degrees"
          },
          "south": {
            "type": "number",
            "format": "double",
            "description": "WGS84 / EPSG:4326 degrees"
          },
          "east": {
            "type": "number",
            "format": "double",
            "description": "WGS84 / EPSG:4326 degrees"
          },
          "north": {
            "type": "number",
            "format": "double",
            "description": "WGS84 / EPSG:4326 degrees"
          }
        }
      }
    }
  }
}
