{
  "openapi": "3.1.0",
  "info": {
    "title": "Backmaps AI Map & Embed Protocol",
    "version": "2.2.0",
    "description": "Zero-key stateless URL protocol, saved short maps (?s=), 3D mountain terrain, and interactive map endpoints for generating 3D travel maps, multi-day routes, GPX/KML tracks, clustered markers, and rich photo balloons on backmaps.app. Runs on OpenStreetMap/Protomaps open data."
  },
  "servers": [
    {
      "url": "https://backmaps.app",
      "description": "Production Backmaps Web"
    }
  ],
  "paths": {
    "/map": {
      "get": {
        "operationId": "openInteractiveTravelMap",
        "summary": "Construct an interactive 3D Backmaps URL with pins, place names, or multi-stop routes",
        "description": "Returns the interactive 3D web map page. AI assistants can construct direct clickable links using `?p=` (coordinates), `?q=` (place names auto-geocoded on OSM), or `?from=&to=&via=&profile=`.",
        "parameters": [
          {
            "name": "p",
            "in": "query",
            "description": "Semicolon-separated coordinate pins: `lat,lng,Title,dayOrColor;...`",
            "schema": { "type": "string" }
          },
          {
            "name": "q",
            "in": "query",
            "description": "Semicolon-separated place names auto-geocoded via OpenStreetMap: `Place,City|day1;...`",
            "schema": { "type": "string" }
          },
          {
            "name": "from",
            "in": "query",
            "description": "Route start coordinate `lat,lng`",
            "schema": { "type": "string" }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Route destination coordinate `lat,lng`",
            "schema": { "type": "string" }
          },
          {
            "name": "via",
            "in": "query",
            "description": "Pipe-separated intermediate stops `lat1,lng1|lat2,lng2`",
            "schema": { "type": "string" }
          },
          {
            "name": "profile",
            "in": "query",
            "description": "Routing profile",
            "schema": { "type": "string", "enum": ["car", "scooter", "bike", "foot"] }
          },
          {
            "name": "preset",
            "in": "query",
            "description": "One of 12 artistic map styles",
            "schema": {
              "type": "string",
              "enum": [
                "classic", "medieval", "starship", "atlas70", "comic", "diorama",
                "blueprint", "pirate", "eco", "retro", "mono", "ribbon"
              ]
            }
          },
          {
            "name": "theme",
            "in": "query",
            "schema": { "type": "string", "enum": ["light", "dark"] }
          },
          {
            "name": "layer",
            "in": "query",
            "schema": { "type": "string", "enum": ["vector", "satellite", "terrain"] }
          },
          {
            "name": "view3d",
            "in": "query",
            "description": "Enable 3D buildings & camera pitch",
            "schema": { "type": "string", "enum": ["0", "1"] }
          },
          {
            "name": "relief3d",
            "in": "query",
            "description": "Enable 3D mountain terrain elevation & hillshade",
            "schema": { "type": "string", "enum": ["0", "1"] }
          },
          {
            "name": "draggable",
            "in": "query",
            "description": "Allow dragging markers on the map (emits backmap:markerDragEnd)",
            "schema": { "type": "string", "enum": ["0", "1"] }
          },
          {
            "name": "s",
            "in": "query",
            "description": "Short map ID created by Backmaps Builder / Cloudflare R2",
            "schema": { "type": "string", "pattern": "^[A-Za-z0-9_-]{4,24}$" }
          },
          {
            "name": "voice",
            "in": "query",
            "description": "Hands-free voice/AI map command (e.g. 'route to Wat Pho by scooter', '3D terrain', 'cafes nearby'). On Android/iOS also available via backmaps://voice?q=...",
            "schema": { "type": "string", "maxLength": 240 }
          },
          {
            "name": "tour",
            "in": "query",
            "description": "Set '1' to auto-play a cinematic 3D camera tour across all pins on load",
            "schema": { "type": "string", "enum": ["0", "1"] }
          },
          {
            "name": "orbit",
            "in": "query",
            "description": "Set '1' to smoothly orbit in 3D around the primary pin/center on load",
            "schema": { "type": "string", "enum": ["0", "1"] }
          },
          {
            "name": "hide",
            "in": "query",
            "description": "Comma-separated map layers or UI controls to hide (buildings,labels,roads,poi,parks,water,markers,shapes,controls,layers,search,weather). The bottom-right Backmaps brand logo always remains visible.",
            "schema": { "type": "string" }
          },
          {
            "name": "icon",
            "in": "query",
            "description": "Single-marker badge glyph (1..5, star, beach, coffee, food, hotel, mountain, camera, car, tent, heart)",
            "schema": { "type": "string" }
          },
          {
            "name": "cluster",
            "in": "query",
            "schema": { "type": "string", "enum": ["0", "1"] }
          },
          {
            "name": "embed",
            "in": "query",
            "schema": { "type": "string", "enum": ["0", "1"] }
          }
        ],
        "responses": {
          "200": {
            "description": "Interactive Backmaps 3D Map HTML"
          }
        }
      }
    },
    "/builder": {
      "get": {
        "operationId": "openMapBuilder",
        "summary": "Open the Visual Map Builder (drag pins, icon badges, rich balloons, clusters, road-connect lines, polygons, 12 themes, custom colors, ?s= reload)",
        "parameters": [
          {
            "name": "s",
            "in": "query",
            "description": "Optional saved short map ID to reload and edit in the Visual Builder",
            "schema": { "type": "string", "pattern": "^[A-Za-z0-9_-]{4,24}$" }
          }
        ],
        "responses": {
          "200": {
            "description": "Backmaps Visual Map Builder HTML"
          }
        }
      }
    }
  }
}
