{
  "openapi": "3.1.0",
  "info": {
    "title": "シルギア 源泉徴収税額表API",
    "version": "1.0.0",
    "description": "登録不要・無料の源泉徴収税額表API。給与所得の源泉徴収税額表の月額表（甲欄 扶養0〜7人・乙欄）・日額表（甲欄・乙欄・丙欄）と、賞与に対する源泉徴収税額の算出率の表を、令和8年分（2026年に支払う給与）と令和9年分（2027年に支払う給与）の年分ごとに返します。表の最後の行を超える金額の式・扶養親族等が7人を超えるときの控除は、表の注記どおりに係数として入れています。年分は給与・賞与を支払う日の年で選んでください（meta.json の years）。表そのものを返し、電子計算機等の特例（月額表の甲欄を式で出す方法）の値ではありません。出典: 国税庁ホームページ「源泉徴収税額表」（https://www.nta.go.jp/publication/pamph/gensen/zeigakuhyo2027/01.htm ほか）の Excel を加工して作成（アナライズギア株式会社）。国税庁が作成・保証するものではありません。説明: https://api.shirugear.com/gensen/ 。v1 の中では項目を足すことはあっても、名前や意味は変えません（知らない項目は無視してください）。",
    "termsOfService": "https://api.shirugear.com/terms/",
    "contact": {
      "name": "アナライズギア株式会社（シルギア）",
      "url": "https://shirugear.com/contact"
    }
  },
  "servers": [
    {
      "url": "https://api.shirugear.com"
    }
  ],
  "paths": {
    "/gensen/v1/meta.json": {
      "get": {
        "summary": "年分の一覧・出典・件数",
        "operationId": "getGensenMeta",
        "responses": {
          "200": {
            "description": "年分の一覧",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MetaResponse"
                }
              }
            }
          }
        }
      }
    },
    "/gensen/v1/{year}/monthly.json": {
      "get": {
        "summary": "月額表（甲欄・乙欄）",
        "description": "その月の社会保険料等控除後の給与等の金額で引く表です。",
        "operationId": "getGensenMonthly",
        "parameters": [
          {
            "name": "year",
            "in": "path",
            "required": true,
            "description": "年分（西暦4桁）。給与・賞与を支払う日の年。今は 2026（令和8年分）と 2027（令和9年分）",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{4}$"
            },
            "examples": {
              "r8": {
                "summary": "令和8年分",
                "value": "2026"
              },
              "r9": {
                "summary": "令和9年分",
                "value": "2027"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "月額表",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WageTable"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      }
    },
    "/gensen/v1/{year}/daily.json": {
      "get": {
        "summary": "日額表（甲欄・乙欄・丙欄）",
        "description": "その日の社会保険料等控除後の給与等の金額で引く表です。丙欄は日雇いなど、労働した日ごとに支払う給与等に使います。",
        "operationId": "getGensenDaily",
        "parameters": [
          {
            "name": "year",
            "in": "path",
            "required": true,
            "description": "年分（西暦4桁）。給与・賞与を支払う日の年。今は 2026（令和8年分）と 2027（令和9年分）",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{4}$"
            },
            "examples": {
              "r8": {
                "summary": "令和8年分",
                "value": "2026"
              },
              "r9": {
                "summary": "令和9年分",
                "value": "2027"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "日額表",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WageTable"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      }
    },
    "/gensen/v1/{year}/bonus.json": {
      "get": {
        "summary": "賞与に対する源泉徴収税額の算出率の表",
        "description": "前月の社会保険料等控除後の給与等の金額で率を選び、社会保険料等控除後の賞与の金額に掛けます。前月の給与が無い・賞与が前月の給与の10倍を超えるときは、この表を使わず月額表で計算します（table_not_used）。",
        "operationId": "getGensenBonus",
        "parameters": [
          {
            "name": "year",
            "in": "path",
            "required": true,
            "description": "年分（西暦4桁）。給与・賞与を支払う日の年。今は 2026（令和8年分）と 2027（令和9年分）",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{4}$"
            },
            "examples": {
              "r8": {
                "summary": "令和8年分",
                "value": "2026"
              },
              "r9": {
                "summary": "令和9年分",
                "value": "2027"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "賞与の算出率の表",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BonusTable"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Rate": {
        "type": "object",
        "required": [
          "rate",
          "rate_x1000"
        ],
        "properties": {
          "rate": {
            "type": "number",
            "description": "率（％）"
          },
          "rate_x1000": {
            "type": "integer",
            "description": "率（％）を1000倍した整数（20.42％ → 20420）。Math.floor(金額 * rate_x1000 / 100000) で1円未満を切り捨てた額になる"
          }
        }
      },
      "WageTable": {
        "type": "object",
        "required": [
          "year",
          "table",
          "bottom",
          "rows",
          "top",
          "dependents"
        ],
        "properties": {
          "year": {
            "type": "integer"
          },
          "year_label": {
            "type": "string",
            "examples": [
              "令和9年分"
            ]
          },
          "payment_from": {
            "type": "string",
            "format": "date",
            "description": "この表を使う支払日の最初の日"
          },
          "payment_to": {
            "type": "string",
            "format": "date",
            "description": "この表を使う支払日の最後の日"
          },
          "taxes": {
            "type": "string",
            "description": "この表で源泉徴収する税"
          },
          "table": {
            "type": "string",
            "enum": [
              "monthly",
              "daily"
            ]
          },
          "table_label": {
            "type": "string",
            "enum": [
              "月額表",
              "日額表"
            ]
          },
          "unit": {
            "const": "円"
          },
          "amount_basis": {
            "type": "string"
          },
          "columns": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "bottom": {
            "type": "object",
            "description": "表の最下段（「under 円未満」）。甲欄・丙欄は表の額、乙欄は金額 × otsu.rate",
            "required": [
              "under",
              "kou",
              "otsu"
            ],
            "properties": {
              "under": {
                "type": "integer"
              },
              "kou": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "minItems": 8,
                "maxItems": 8
              },
              "otsu": {
                "$ref": "#/components/schemas/Rate"
              },
              "hei": {
                "type": "integer"
              }
            }
          },
          "rows": {
            "type": "array",
            "description": "金額の小さい順。from 以上 to 未満",
            "items": {
              "type": "object",
              "required": [
                "from",
                "to",
                "kou",
                "otsu"
              ],
              "properties": {
                "from": {
                  "type": "integer"
                },
                "to": {
                  "type": "integer"
                },
                "kou": {
                  "type": "array",
                  "items": {
                    "type": "integer"
                  },
                  "minItems": 8,
                  "maxItems": 8,
                  "description": "甲欄。扶養親族等の数0人〜7人の税額"
                },
                "otsu": {
                  "type": "integer"
                },
                "hei": {
                  "type": "integer",
                  "description": "丙欄（日額表だけ）"
                }
              }
            }
          },
          "top": {
            "type": "object",
            "description": "最後の行を超える金額の式。区間の from 以上・次の区間の from 未満は tax ＋ (金額 − from) × 率（1円未満切り捨て）",
            "required": [
              "from",
              "kou",
              "otsu"
            ],
            "properties": {
              "from": {
                "type": "integer"
              },
              "kou": {
                "type": "array",
                "items": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Rate"
                    },
                    {
                      "type": "object",
                      "required": [
                        "from",
                        "tax"
                      ],
                      "properties": {
                        "from": {
                          "type": "integer"
                        },
                        "tax": {
                          "type": "array",
                          "items": {
                            "type": "integer"
                          },
                          "minItems": 8,
                          "maxItems": 8
                        }
                      }
                    }
                  ]
                }
              },
              "otsu": {
                "type": "array",
                "items": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Rate"
                    },
                    {
                      "type": "object",
                      "required": [
                        "from",
                        "tax"
                      ],
                      "properties": {
                        "from": {
                          "type": "integer"
                        },
                        "tax": {
                          "type": "integer"
                        }
                      }
                    }
                  ]
                }
              },
              "hei": {
                "type": "array",
                "items": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Rate"
                    },
                    {
                      "type": "object",
                      "required": [
                        "from",
                        "tax"
                      ],
                      "properties": {
                        "from": {
                          "type": "integer"
                        },
                        "tax": {
                          "type": "integer"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "dependents": {
            "type": "object",
            "properties": {
              "kou_max_in_table": {
                "const": 7
              },
              "kou_over7_deduction_per_person": {
                "type": "integer",
                "description": "7人を超える1人ごとに7人の税額から引く額（月額表 1610・日額表 50）"
              },
              "otsu_deduction_per_person": {
                "type": "integer",
                "description": "乙欄で「従たる給与についての扶養控除等申告書」の扶養親族等1人ごとに引く額"
              }
            }
          },
          "data_version": {
            "type": "string",
            "format": "date"
          },
          "source": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "rounding": {
            "type": "string"
          },
          "notice": {
            "type": "string",
            "description": "根拠の財務省告示"
          }
        }
      },
      "BonusTable": {
        "type": "object",
        "required": [
          "year",
          "kou",
          "otsu",
          "table_not_used"
        ],
        "properties": {
          "year": {
            "type": "integer"
          },
          "year_label": {
            "type": "string",
            "examples": [
              "令和9年分"
            ]
          },
          "payment_from": {
            "type": "string",
            "format": "date",
            "description": "この表を使う支払日の最初の日"
          },
          "payment_to": {
            "type": "string",
            "format": "date",
            "description": "この表を使う支払日の最後の日"
          },
          "taxes": {
            "type": "string",
            "description": "この表で源泉徴収する税"
          },
          "table": {
            "const": "bonus"
          },
          "table_label": {
            "type": "string"
          },
          "amount_basis": {
            "type": "string"
          },
          "kou": {
            "type": "array",
            "minItems": 8,
            "maxItems": 8,
            "items": {
              "type": "object",
              "properties": {
                "dependents": {
                  "type": "integer",
                  "description": "扶養親族等の数（7 は「7人以上」）"
                },
                "bands": {
                  "type": "array",
                  "minItems": 21,
                  "maxItems": 21,
                  "items": {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/Rate"
                      },
                      {
                        "type": "object",
                        "required": [
                          "from",
                          "to"
                        ],
                        "properties": {
                          "from": {
                            "type": "integer",
                            "description": "前月の社会保険料等控除後の給与等の金額の「以上」（円）"
                          },
                          "to": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "「未満」（円）。いちばん上の段は null"
                          }
                        }
                      }
                    ]
                  }
                }
              }
            }
          },
          "otsu": {
            "type": "array",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Rate"
                },
                {
                  "type": "object",
                  "required": [
                    "from",
                    "to"
                  ],
                  "properties": {
                    "from": {
                      "type": "integer",
                      "description": "前月の社会保険料等控除後の給与等の金額の「以上」（円）"
                    },
                    "to": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "「未満」（円）。いちばん上の段は null"
                    }
                  }
                }
              ]
            }
          },
          "dependents": {
            "type": "object"
          },
          "table_not_used": {
            "type": "object",
            "properties": {
              "multiplier": {
                "type": "integer"
              },
              "when": {
                "type": "string"
              },
              "then": {
                "type": "string"
              }
            }
          },
          "data_version": {
            "type": "string",
            "format": "date"
          },
          "source": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "rounding": {
            "type": "string"
          },
          "notice": {
            "type": "string",
            "description": "根拠の財務省告示"
          }
        }
      },
      "MetaResponse": {
        "type": "object",
        "properties": {
          "data_version": {
            "type": "string",
            "format": "date"
          },
          "built_at": {
            "type": "string",
            "format": "date-time"
          },
          "years": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "year": {
                  "type": "integer"
                },
                "year_label": {
                  "type": "string",
                  "examples": [
                    "令和9年分"
                  ]
                },
                "payment_from": {
                  "type": "string",
                  "format": "date",
                  "description": "この表を使う支払日の最初の日"
                },
                "payment_to": {
                  "type": "string",
                  "format": "date",
                  "description": "この表を使う支払日の最後の日"
                },
                "taxes": {
                  "type": "string",
                  "description": "この表で源泉徴収する税"
                },
                "notice": {
                  "type": "object"
                },
                "page": {
                  "type": "string",
                  "format": "uri"
                },
                "source_date": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date"
                },
                "files": {
                  "type": "object"
                },
                "counts": {
                  "type": "object"
                }
              }
            }
          },
          "how_to_choose": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "fetched_at": {
            "type": "string",
            "format": "date-time"
          },
          "note": {
            "type": "string"
          }
        }
      },
      "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"
              }
            }
          }
        }
      }
    }
  }
}
