{
  "openapi": "3.1.0",
  "info": {
    "title": "シルギア 最低賃金API",
    "version": "1.0.0",
    "description": "登録不要・無料の最低賃金API。47都道府県の地域別最低賃金（時間額）・発効日・前の年度からの引上げ額を、平成14年度（2002年度）から最新の年度まで返します（特定（産業別）最低賃金は含みません）。年度の額はその都道府県の発効日（effective_date）から適用されるので、「今の額」は history（新しい順）で effective_date が今日（日本時間）以前の最初のものを使ってください。出典: 厚生労働省「地域別最低賃金の全国一覧」（地域別最低賃金改定状況）を加工して作成。説明: https://api.shirugear.com/minwage/ 。v1 の中では項目を足すことはあっても、名前や意味は変えません（知らない項目は無視してください）。",
    "termsOfService": "https://api.shirugear.com/terms/",
    "contact": {
      "name": "アナライズギア株式会社（シルギア）",
      "url": "https://shirugear.com/contact"
    }
  },
  "servers": [
    {
      "url": "https://api.shirugear.com"
    }
  ],
  "paths": {
    "/minwage/v1/{key}.json": {
      "get": {
        "summary": "都道府県の移り変わり（2桁）または年度の47都道府県（4桁）",
        "description": "key が都道府県コード2桁（01〜47）なら PrefectureResponse、年度4桁（2002〜最新の年度）なら FiscalYearResponse を返します。",
        "operationId": "getMinwage",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "description": "都道府県コード2桁（JIS。01〜47）または年度4桁（西暦。2002〜最新の年度）",
            "schema": {
              "type": "string",
              "pattern": "^([0-9]{2}|[0-9]{4})$"
            },
            "examples": {
              "prefecture": {
                "summary": "東京都",
                "value": "13"
              },
              "fiscalYear": {
                "summary": "令和8年度",
                "value": "2026"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "都道府県の移り変わり、または年度の47都道府県",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/PrefectureResponse"
                    },
                    {
                      "$ref": "#/components/schemas/FiscalYearResponse"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "URLの形が違う（invalid_request）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "無い都道府県コード・範囲外の年度（not_found）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/minwage/v1/all.json": {
      "get": {
        "summary": "全部（47都道府県 × 全年度）",
        "operationId": "getAllMinwage",
        "responses": {
          "200": {
            "description": "全部。history は古い年度から順",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AllResponse"
                }
              }
            }
          }
        }
      }
    },
    "/minwage/v1/meta.json": {
      "get": {
        "summary": "データの版・出典・件数",
        "operationId": "getMinwageMeta",
        "responses": {
          "200": {
            "description": "データの版",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MetaResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PrefCode": {
        "type": "string",
        "pattern": "^[0-9]{2}$",
        "description": "都道府県コード2桁（JIS。01 北海道 〜 47 沖縄県）",
        "example": "13"
      },
      "Amount": {
        "type": "object",
        "required": [
          "amount",
          "effective_date",
          "raise",
          "revised"
        ],
        "properties": {
          "amount": {
            "type": "integer",
            "description": "地域別最低賃金の時間額（円）",
            "example": 1280
          },
          "effective_date": {
            "type": "string",
            "format": "date",
            "description": "発効日。この日から適用",
            "example": "2026-10-01"
          },
          "raise": {
            "type": [
              "integer",
              "null"
            ],
            "description": "前の年度からの引上げ額（円）。改定なしは 0、最初の年度（2002）は null",
            "example": 54
          },
          "revised": {
            "type": "boolean",
            "description": "false=前の年度から改定されていない（額も発効日も前の年度と同じ）"
          }
        }
      },
      "HistoryEntry": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Amount"
          },
          {
            "type": "object",
            "required": [
              "fiscal_year",
              "fiscal_year_label"
            ],
            "properties": {
              "fiscal_year": {
                "type": "integer",
                "description": "年度（西暦）",
                "example": 2026
              },
              "fiscal_year_label": {
                "type": "string",
                "description": "和暦の年度",
                "example": "令和8年度"
              }
            }
          }
        ]
      },
      "PrefectureAmount": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Amount"
          },
          {
            "type": "object",
            "required": [
              "pref_code",
              "pref"
            ],
            "properties": {
              "pref_code": {
                "$ref": "#/components/schemas/PrefCode"
              },
              "pref": {
                "type": "string",
                "example": "東京都"
              }
            }
          }
        ]
      },
      "PrefectureResponse": {
        "type": "object",
        "required": [
          "pref_code",
          "pref",
          "unit",
          "history",
          "data_version"
        ],
        "properties": {
          "pref_code": {
            "$ref": "#/components/schemas/PrefCode"
          },
          "pref": {
            "type": "string",
            "example": "東京都"
          },
          "unit": {
            "type": "string",
            "const": "円/時間"
          },
          "history": {
            "type": "array",
            "description": "新しい年度から順",
            "items": {
              "$ref": "#/components/schemas/HistoryEntry"
            }
          },
          "data_version": {
            "type": "string",
            "format": "date",
            "description": "厚生労働省の一覧を取り込んだ日"
          }
        }
      },
      "FiscalYearResponse": {
        "type": "object",
        "required": [
          "fiscal_year",
          "fiscal_year_label",
          "unit",
          "national_weighted_average",
          "complete",
          "prefectures",
          "data_version"
        ],
        "properties": {
          "fiscal_year": {
            "type": "integer",
            "example": 2026
          },
          "fiscal_year_label": {
            "type": "string",
            "example": "令和8年度"
          },
          "unit": {
            "type": "string",
            "const": "円/時間"
          },
          "national_weighted_average": {
            "type": [
              "integer",
              "null"
            ],
            "description": "全国加重平均額（円・厚生労働省の公表値）",
            "example": 1177
          },
          "complete": {
            "type": "boolean",
            "description": "47都道府県の額がそろっていれば true。false のときは決まった都道府県だけが入る"
          },
          "prefectures": {
            "type": "array",
            "description": "都道府県コードの順",
            "items": {
              "$ref": "#/components/schemas/PrefectureAmount"
            }
          },
          "data_version": {
            "type": "string",
            "format": "date"
          }
        }
      },
      "AllResponse": {
        "type": "object",
        "required": [
          "from",
          "to",
          "unit",
          "national_weighted_average",
          "prefectures",
          "data_version"
        ],
        "properties": {
          "from": {
            "type": "integer",
            "example": 2002
          },
          "to": {
            "type": "integer",
            "example": 2026
          },
          "unit": {
            "type": "string",
            "const": "円/時間"
          },
          "national_weighted_average": {
            "type": "object",
            "description": "キーは年度（\"2026\" など）→ 全国加重平均額（円）",
            "additionalProperties": {
              "type": [
                "integer",
                "null"
              ]
            }
          },
          "prefectures": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "pref_code",
                "pref",
                "history"
              ],
              "properties": {
                "pref_code": {
                  "$ref": "#/components/schemas/PrefCode"
                },
                "pref": {
                  "type": "string"
                },
                "history": {
                  "type": "array",
                  "description": "古い年度から順（都道府県ごとの応答とは逆）",
                  "items": {
                    "type": "object",
                    "required": [
                      "fiscal_year",
                      "amount",
                      "effective_date"
                    ],
                    "properties": {
                      "fiscal_year": {
                        "type": "integer"
                      },
                      "amount": {
                        "type": "integer"
                      },
                      "effective_date": {
                        "type": "string",
                        "format": "date"
                      }
                    }
                  }
                }
              }
            }
          },
          "data_version": {
            "type": "string",
            "format": "date"
          }
        }
      },
      "MetaResponse": {
        "type": "object",
        "required": [
          "data_version",
          "built_at",
          "from",
          "to",
          "latest_complete",
          "source",
          "sources",
          "counts"
        ],
        "properties": {
          "data_version": {
            "type": "string",
            "format": "date"
          },
          "built_at": {
            "type": "string",
            "format": "date-time",
            "description": "データを作った日時（UTC）"
          },
          "from": {
            "type": "integer"
          },
          "to": {
            "type": "integer"
          },
          "latest_complete": {
            "type": "boolean",
            "description": "いちばん新しい年度の額が47都道府県そろっていれば true"
          },
          "source": {
            "type": "string",
            "description": "出典の書き方"
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri",
                  "description": "元にした Excel"
                },
                "page": {
                  "type": "string",
                  "format": "uri",
                  "description": "その Excel が載っているページ"
                },
                "fetched_at": {
                  "type": "string",
                  "format": "date-time"
                }
              }
            }
          },
          "counts": {
            "type": "object",
            "properties": {
              "prefectures": {
                "type": "integer",
                "description": "都道府県の数"
              },
              "fiscal_years": {
                "type": "integer",
                "description": "年度の数"
              },
              "records": {
                "type": "integer",
                "description": "都道府県 × 年度の数"
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "status",
              "code",
              "message"
            ],
            "properties": {
              "status": {
                "type": "integer",
                "enum": [
                  400,
                  403,
                  404,
                  405
                ]
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "not_found",
                  "region_not_allowed",
                  "method_not_allowed"
                ]
              },
              "message": {
                "type": "string",
                "description": "説明文（言い回しは変わることがあります）"
              }
            }
          }
        }
      }
    }
  }
}
