{
  "openapi": "3.1.0",
  "info": {
    "title": "みんなの中間駅 API",
    "version": "1.1.0",
    "description": "首都圏の対象563駅。線路形状距離で最大距離、距離差、合計距離、駅名の順に比較。時刻・運賃・所要時間は対象外。駅IDは駅一覧のidとの完全一致。無料・認証不要。POST本文は1024バイトまで、個人の住所や名前を送らないでください。30件/分/IP・300件/分はWorker実行単位のベストエフォート制限で、拠点横断の保証ではありません。429ではRetry-After秒待ってください。"
  },
  "servers": [
    {
      "url": "https://app.damonge.com/rail-meet/api/v1"
    }
  ],
  "paths": {
    "/stations": {
      "get": {
        "operationId": "searchStations",
        "summary": "対象駅一覧・部分一致検索",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 40
            },
            "description": "省略すると対象駅一覧。1件のみ。"
          }
        ],
        "responses": {
          "200": {
            "description": "Stations",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Stations"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "408": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "414": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/recommendations": {
      "post": {
        "operationId": "recommendMeetingStations",
        "summary": "2〜4人の集合駅上位3候補と各経路",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Request"
              },
              "example": {
                "origins": [
                  "千葉",
                  "横浜"
                ],
                "share": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recommendations",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Recommendations"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "408": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "414": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Station": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "coordinates": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "minItems": 2,
            "maxItems": 2,
            "description": "[longitude, latitude], WGS84"
          },
          "aliases": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Search aliases; use id unchanged for recommendations."
          }
        },
        "required": [
          "id",
          "name",
          "coordinates",
          "aliases"
        ],
        "additionalProperties": false
      },
      "Stations": {
        "type": "object",
        "properties": {
          "stations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Station"
            },
            "maxItems": 600
          },
          "count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 600
          }
        },
        "required": [
          "stations",
          "count"
        ],
        "additionalProperties": false
      },
      "Request": {
        "type": "object",
        "properties": {
          "origins": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40
            },
            "minItems": 2,
            "maxItems": 4
          },
          "share": {
            "type": "boolean",
            "default": false,
            "description": "Opt in to fragment-based map URLs. Anyone with the URL can read the departure stations."
          }
        },
        "required": [
          "origins"
        ],
        "additionalProperties": false
      },
      "Step": {
        "type": "object",
        "properties": {
          "edge": {
            "type": "integer",
            "minimum": 0
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "line": {
            "type": "string"
          },
          "coords": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "number"
              },
              "minItems": 2,
              "maxItems": 2,
              "description": "[longitude, latitude], WGS84"
            },
            "minItems": 2
          }
        },
        "required": [
          "edge",
          "from",
          "to",
          "line",
          "coords"
        ],
        "additionalProperties": false
      },
      "Route": {
        "type": "object",
        "properties": {
          "km": {
            "type": "number",
            "minimum": 0
          },
          "steps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Step"
            }
          },
          "stations": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 1
          }
        },
        "required": [
          "km",
          "steps",
          "stations"
        ],
        "additionalProperties": false
      },
      "Candidate": {
        "type": "object",
        "properties": {
          "station": {
            "type": "string"
          },
          "max": {
            "type": "number",
            "minimum": 0
          },
          "spread": {
            "type": "number",
            "minimum": 0
          },
          "total": {
            "type": "number",
            "minimum": 0
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Route"
            },
            "minItems": 2,
            "maxItems": 4
          },
          "shareUrl": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "station",
          "max",
          "spread",
          "total",
          "routes"
        ],
        "additionalProperties": false
      },
      "Recommendations": {
        "type": "object",
        "properties": {
          "origins": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 2,
            "maxItems": 4
          },
          "unit": {
            "const": "km"
          },
          "distanceBasis": {
            "const": "rail_geometry_not_fare_or_time"
          },
          "ranking": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "source": {
            "type": "object",
            "properties": {
              "dataset": {
                "type": "string"
              },
              "license": {
                "type": "string"
              },
              "attribution": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "excludedConnections": {
                "type": "array",
                "items": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "minItems": 2,
                  "maxItems": 2
                },
                "description": "Intentionally omitted boundary-crossing direct connections; in-bounds routes may detour."
              }
            },
            "required": [
              "dataset",
              "license",
              "attribution",
              "url",
              "excludedConnections"
            ],
            "additionalProperties": false
          },
          "candidates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Candidate"
            },
            "minItems": 1,
            "maxItems": 3
          }
        },
        "required": [
          "origins",
          "unit",
          "distanceBasis",
          "ranking",
          "source",
          "candidates"
        ],
        "additionalProperties": false
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      }
    }
  },
  "externalDocs": {
    "url": "https://app.damonge.com/rail-meet/developers"
  }
}
