{
  "openapi": "3.1.0",
  "info": {
    "title": "KaleMap discovery and menu evidence API",
    "version": "1.1.0",
    "description": "Dietary options at ordinary restaurants: places in a map view, text search, and the dishes read from each menu, labelled for vegan, vegetarian, pescetarian, gluten-free, dairy-free, egg-free, peanut-free, tree-nut-free, shellfish-free, fish-free, soy-free and sesame-free. Free discovery; detailed /api/v1/menu requires a developer bearer key and consumes trial or paid requests. See /developers. Results can be incomplete or outdated.",
    "license": {
      "name": "ODbL (OpenStreetMap data) and CDLA-Permissive-2.0 (Overture Maps data)",
      "url": "https://kalemap.com/data"
    }
  },
  "servers": [
    {
      "url": "https://kalemap.com"
    }
  ],
  "paths": {
    "/api/v1/menu": {
      "get": {
        "operationId": "getMenuEvidence",
        "summary": "Paged saved dish evidence, dietary labels, sources and freshness",
        "description": "Each page consumes one detailed request. Follow next_cursor even for empty filtered pages. See /developers for limits and terms.",
        "security": [
          {
            "DeveloperKey": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 180
            }
          },
          {
            "name": "needs",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated dietary IDs, all must match one dish."
          },
          {
            "name": "include_changes",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "query",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 300
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Saved evidence, coverage, items, pagination, usage and attribution"
          },
          "400": {
            "description": "Invalid arguments"
          },
          "401": {
            "description": "Missing or invalid key"
          },
          "402": {
            "description": "Allowance exhausted"
          },
          "404": {
            "description": "Restaurant not found"
          },
          "429": {
            "description": "Rate or shared capacity limit; honor Retry-After"
          }
        }
      }
    },
    "/api/places": {
      "get": {
        "operationId": "placesInView",
        "summary": "Restaurants inside a bounding box, with their vegan status, score and best dishes",
        "parameters": [
          {
            "name": "bbox",
            "in": "query",
            "required": false,
            "description": "south,west,north,east in degrees",
            "schema": {
              "type": "string",
              "example": "25.70,-80.30,25.76,-80.24"
            }
          },
          {
            "name": "lat",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "centre latitude, with lng and km, instead of bbox"
          },
          {
            "name": "lng",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "km",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 0.2,
              "maximum": 50,
              "default": 3
            }
          },
          {
            "name": "filter",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "options",
                "vegan"
              ],
              "default": "all"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 300,
              "default": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Places",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlacesResponse"
                }
              }
            }
          },
          "400": {
            "description": "bbox or lat/lng missing"
          }
        }
      }
    },
    "/api/search": {
      "get": {
        "operationId": "searchPlaces",
        "summary": "Search restaurants by name",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 60
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matches",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SearchHit"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "DeveloperKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "KaleMap API key"
      }
    },
    "schemas": {
      "Place": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "description": "path of the place page"
          },
          "name": {
            "type": "string"
          },
          "lat": {
            "type": "number"
          },
          "lng": {
            "type": "number"
          },
          "status": {
            "type": "string",
            "enum": [
              "vegan",
              "vegetarian",
              "options",
              "unknown",
              "none"
            ]
          },
          "score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "vegan friendliness; 100 means fully vegan"
          },
          "category": {
            "type": "string"
          },
          "cuisines": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "dishes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "verdict": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "PlacesResponse": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer"
          },
          "truncated": {
            "type": "boolean"
          },
          "places": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Place"
            }
          }
        }
      },
      "SearchHit": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "lat": {
            "type": "number"
          },
          "lng": {
            "type": "number"
          },
          "status": {
            "type": "string"
          }
        }
      }
    }
  }
}