{
  "openapi": "3.1.0",
  "info": {
    "title": "Choose My Route public destination search",
    "version": "1.0.0",
    "description": "Read-only destination search. Months are 1–12; weather tags use OR semantics across selected months. Climate, visa and flight values are approximate unverified site data. Saved selections preserve destination codes, not live prices or eligibility."
  },
  "servers": [
    {
      "url": "https://www.choosemyroute.com"
    }
  ],
  "paths": {
    "/api/destinations": {
      "get": {
        "operationId": "findDestinations",
        "summary": "Find destinations or read a saved selection",
        "parameters": [
          {
            "name": "mode",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "world",
                "domestic",
                "lucky"
              ]
            }
          },
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "ru"
              ]
            }
          },
          {
            "name": "visa",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "any",
                "no_visa"
              ]
            }
          },
          {
            "name": "months",
            "in": "query",
            "description": "Comma-separated calendar months, 1–12. Required unless mode=lucky or start/end are set.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "weather",
            "in": "query",
            "description": "Comma-separated hot,warm,cool,beach,dry; matches any selected weather tag in any selected month.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "passport",
            "in": "query",
            "description": "ISO country code; required for visa=no_visa.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "country",
            "in": "query",
            "description": "Required for domestic mode.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "origin",
            "in": "query",
            "description": "ISO country code used for estimated flight duration and origin exclusion.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "selected",
            "in": "query",
            "description": "Up to 3 known codes, comma-separated. Reproduces these destinations in order without re-evaluating filters.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start",
            "in": "query",
            "description": "YYYY-MM-DD, requires end; cannot combine with months.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "end",
            "in": "query",
            "description": "YYYY-MM-DD; date range at most 366 days.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "flight",
            "in": "query",
            "description": "Maximum estimated hours; requires origin or passport.",
            "schema": {
              "type": "number",
              "exclusiveMinimum": 0,
              "maximum": 30
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 3
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deterministic dataset results or saved selection",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "schema_version",
                    "method",
                    "results",
                    "search_url",
                    "limitations"
                  ],
                  "properties": {
                    "schema_version": {
                      "const": "1.0"
                    },
                    "method": {
                      "enum": [
                        "dataset_filter",
                        "saved_selection"
                      ]
                    },
                    "fallback": {
                      "type": "boolean"
                    },
                    "total_matches": {
                      "type": "integer"
                    },
                    "filters": {
                      "type": "object"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "country_code": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "guide_url": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "climate": {
                            "type": [
                              "object",
                              "null"
                            ]
                          },
                          "visa_free_in_dataset": {
                            "type": [
                              "boolean",
                              "null"
                            ]
                          }
                        }
                      }
                    },
                    "search_url": {
                      "type": "string"
                    },
                    "limitations": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unsupported filters"
          },
          "405": {
            "description": "Only GET and HEAD are supported"
          }
        }
      }
    }
  }
}
