{
  "openapi": "3.1.0",
  "info": {
    "title": "Discover Tonight venue search",
    "version": "1.0.0",
    "description": "Find bars, clubs and lounges in a city by music, vibe, crowd age and deals. Details are reported by people who went; each result has a confidence score. Link people to the venue url exactly as returned; never build venue links from names or nicknames (search with q instead)."
  },
  "servers": [
    {
      "url": "https://discovertonight.city"
    }
  ],
  "paths": {
    "/api/search": {
      "get": {
        "operationId": "searchVenues",
        "summary": "Search venues in a city",
        "parameters": [
          {
            "name": "city",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "examples": [
                "ottawa",
                "toronto"
              ]
            },
            "description": "City slug or name."
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "bars",
                "nightclubs",
                "lounges",
                "restaurants",
                "rooftops",
                "live-music"
              ]
            }
          },
          {
            "name": "music",
            "in": "query",
            "schema": {
              "type": "string",
              "examples": [
                "house",
                "hip-hop",
                "top-40"
              ]
            },
            "description": "One or more music slugs, comma separated."
          },
          {
            "name": "vibe",
            "in": "query",
            "schema": {
              "type": "string",
              "examples": [
                "chill",
                "upscale",
                "romantic"
              ]
            }
          },
          {
            "name": "crowd",
            "in": "query",
            "schema": {
              "type": "string",
              "examples": [
                "20s",
                "30s",
                "40s"
              ]
            },
            "description": "Typical age of the crowd."
          },
          {
            "name": "deals",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "Only venues with reported food or drink deals."
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Text in the name or address."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching venues, plus close matches when nothing matches every filter.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "city": {
                      "type": "object"
                    },
                    "total": {
                      "type": "integer"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Venue"
                      }
                    },
                    "close_matches": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Venue"
                      }
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "data_as_of": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Unknown or missing city; the body lists available cities."
          }
        }
      }
    },
    "/api/venue": {
      "get": {
        "operationId": "getVenue",
        "summary": "Details for one venue",
        "parameters": [
          {
            "name": "slug",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Slug from a search result url (/venue/{slug})."
          },
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Venue details with crowd-reported music, vibe, deals, hours and confidence."
          },
          "404": {
            "description": "No public venue with that slug."
          }
        }
      }
    },
    "/api/meta": {
      "get": {
        "operationId": "getFilters",
        "summary": "Cities and valid filter values",
        "responses": {
          "200": {
            "description": "Lists cities, music, vibe, crowd and type values accepted by /api/search."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Venue": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "description": "Link to give the person."
          },
          "distance_km": {
            "type": [
              "number",
              "null"
            ]
          },
          "summary": {
            "type": [
              "string",
              "null"
            ]
          },
          "music": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "vibe": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "crowd_age": {
            "type": [
              "string",
              "null"
            ]
          },
          "deals": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "confidence": {
            "type": "integer",
            "description": "0-100 confidence in the crowd-reported details."
          },
          "reports": {
            "type": "integer"
          },
          "last_reported": {
            "type": [
              "string",
              "null"
            ]
          },
          "matched": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "missed": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "image": {
            "type": [
              "string",
              "null"
            ],
            "description": "Photo URL for the venue, when we have one."
          }
        }
      }
    }
  }
}