{
  "openapi": "3.1.0",
  "info": {
    "title": "シルギア 金融機関コード・支店コードAPI",
    "version": "1.0.0",
    "description": "登録不要・無料の金融機関コード（銀行コード）・支店コードのAPI。4桁の金融機関コードから金融機関の名前（略称）・振込用のカナ・支店の一覧を、3桁の支店コードを足すと1つの支店の名前とカナを返します。銀行・信用金庫・信用組合・労働金庫・農協・漁協・ゆうちょ銀行など。出典: zengin-code/source-data（https://github.com/zengin-code/source-data・MIT License。元は「銀行コード検索」http://ykaku.net/ginkokensaku/）を加工して作成。有志が更新しているデータで金融機関の公式の一覧ではなく、合併や店舗の統廃合で最新と違うことがあります。説明: https://api.shirugear.com/bank/ 。v1 の中では項目を足すことはあっても、名前や意味は変えません（知らない項目は無視してください）。",
    "termsOfService": "https://api.shirugear.com/terms/",
    "contact": {
      "name": "アナライズギア株式会社（シルギア）",
      "url": "https://shirugear.com/contact"
    }
  },
  "servers": [
    {
      "url": "https://api.shirugear.com"
    }
  ],
  "paths": {
    "/bank/v1/banks.json": {
      "get": {
        "summary": "金融機関の一覧",
        "operationId": "getBanks",
        "responses": {
          "200": {
            "description": "金融機関の一覧（金融機関コードの順）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BanksResponse"
                }
              }
            }
          }
        }
      }
    },
    "/bank/v1/{bank_code}.json": {
      "get": {
        "summary": "1つの金融機関と支店の一覧",
        "operationId": "getBank",
        "parameters": [
          {
            "name": "bank_code",
            "in": "path",
            "required": true,
            "description": "金融機関コード4桁（半角数字。頭の 0 も省かない）",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{4}$"
            },
            "examples": {
              "mizuho": {
                "summary": "みずほ",
                "value": "0001"
              },
              "yucho": {
                "summary": "ゆうちょ",
                "value": "9900"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "金融機関と支店の一覧（支店コードの順）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankResponse"
                }
              }
            }
          },
          "400": {
            "description": "コードの形が違う（invalid_code）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "データに無い金融機関コード（code_not_found）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/bank/v1/{bank_code}/{branch_code}.json": {
      "get": {
        "summary": "1つの支店",
        "operationId": "getBranch",
        "parameters": [
          {
            "name": "bank_code",
            "in": "path",
            "required": true,
            "description": "金融機関コード4桁（半角数字。頭の 0 も省かない）",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{4}$"
            },
            "examples": {
              "mizuho": {
                "summary": "みずほ",
                "value": "0001"
              },
              "yucho": {
                "summary": "ゆうちょ",
                "value": "9900"
              }
            }
          },
          {
            "name": "branch_code",
            "in": "path",
            "required": true,
            "description": "支店コード3桁（半角数字）",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{3}$"
            },
            "examples": {
              "tokyo": {
                "summary": "みずほ 東京営業部",
                "value": "001"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "支店（金融機関の名前とカナもいっしょに）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BranchResponse"
                }
              }
            }
          },
          "400": {
            "description": "コードの形が違う（invalid_code）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "データに無い金融機関コード・支店コード（code_not_found）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/bank/v1/meta.json": {
      "get": {
        "summary": "データの版・出典・件数",
        "operationId": "getBankMeta",
        "responses": {
          "200": {
            "description": "データの版",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MetaResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Bank": {
        "type": "object",
        "required": [
          "code",
          "name",
          "kana",
          "hira",
          "roma"
        ],
        "description": "金融機関",
        "properties": {
          "code": {
            "type": "string",
            "pattern": "^[0-9]{4}$",
            "description": "金融機関コード4桁",
            "example": "0001"
          },
          "name": {
            "type": "string",
            "description": "名前。金融機関は略称（「銀行」などは付かない）",
            "example": "みずほ"
          },
          "kana": {
            "type": "string",
            "description": "振込で使う形の全角カタカナ（小さい字は大きく書く）",
            "example": "ミズホ"
          },
          "hira": {
            "type": "string",
            "description": "kana をひらがなにしたもの（検索用）",
            "example": "みずほ"
          },
          "roma": {
            "type": "string",
            "description": "kana をローマ字にしたもの（検索用・小文字）",
            "example": "mizuho"
          }
        }
      },
      "BankWithCount": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Bank"
          },
          {
            "type": "object",
            "required": [
              "branch_count"
            ],
            "properties": {
              "branch_count": {
                "type": "integer",
                "description": "データにある支店の数",
                "example": 494
              }
            }
          }
        ]
      },
      "Branch": {
        "type": "object",
        "required": [
          "code",
          "name",
          "kana",
          "hira",
          "roma"
        ],
        "description": "支店",
        "properties": {
          "code": {
            "type": "string",
            "pattern": "^[0-9]{3}$",
            "description": "支店コード3桁",
            "example": "001"
          },
          "name": {
            "type": "string",
            "description": "支店の名前。ゆうちょ銀行（9900）は振込用の漢数字の店名（〇一八 など）",
            "example": "東京営業部"
          },
          "kana": {
            "type": "string",
            "description": "振込で使う形の全角カタカナ（小さい字は大きく書く）",
            "example": "トウキヨウ"
          },
          "hira": {
            "type": "string",
            "description": "kana をひらがなにしたもの",
            "example": "とうきよう"
          },
          "roma": {
            "type": "string",
            "description": "kana をローマ字にしたもの",
            "example": "toukiyou"
          }
        }
      },
      "BanksResponse": {
        "type": "object",
        "required": [
          "data_version",
          "count",
          "banks"
        ],
        "properties": {
          "data_version": {
            "type": "string",
            "format": "date",
            "description": "データの版（元のデータが更新された日）",
            "example": "2026-08-24"
          },
          "count": {
            "type": "integer",
            "description": "金融機関の数",
            "example": 1146
          },
          "banks": {
            "type": "array",
            "description": "金融機関コードの順",
            "items": {
              "$ref": "#/components/schemas/BankWithCount"
            }
          }
        }
      },
      "BankResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BankWithCount"
          },
          {
            "type": "object",
            "required": [
              "branches",
              "data_version"
            ],
            "properties": {
              "branches": {
                "type": "array",
                "description": "支店コードの順",
                "items": {
                  "$ref": "#/components/schemas/Branch"
                }
              },
              "data_version": {
                "type": "string",
                "format": "date",
                "example": "2026-08-24"
              }
            }
          }
        ]
      },
      "BranchResponse": {
        "type": "object",
        "required": [
          "bank",
          "branch",
          "data_version"
        ],
        "properties": {
          "bank": {
            "$ref": "#/components/schemas/Bank"
          },
          "branch": {
            "$ref": "#/components/schemas/Branch"
          },
          "data_version": {
            "type": "string",
            "format": "date",
            "example": "2026-08-24"
          }
        }
      },
      "MetaResponse": {
        "type": "object",
        "required": [
          "data_version",
          "built_at",
          "source",
          "sources",
          "counts"
        ],
        "properties": {
          "data_version": {
            "type": "string",
            "format": "date"
          },
          "built_at": {
            "type": "string",
            "format": "date-time",
            "description": "データを作った日時（UTC）"
          },
          "source": {
            "type": "string",
            "description": "出典の書き方"
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri",
                  "description": "元にしたリポジトリ"
                },
                "license": {
                  "type": "string",
                  "example": "MIT"
                },
                "commit": {
                  "type": "string",
                  "description": "使ったコミット"
                },
                "fetched_at": {
                  "type": "string",
                  "format": "date-time"
                }
              }
            }
          },
          "counts": {
            "type": "object",
            "properties": {
              "banks": {
                "type": "integer",
                "description": "金融機関の数"
              },
              "branches": {
                "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_code",
                  "code_not_found",
                  "region_not_allowed",
                  "method_not_allowed"
                ]
              },
              "message": {
                "type": "string",
                "description": "説明文（言い回しは変わることがあります）"
              }
            }
          }
        }
      }
    }
  }
}
