{
  "openapi": "3.1.0",
  "info": {
    "title": "シルギア 印紙税額API",
    "version": "1.0.0",
    "description": "登録不要・無料の印紙税額API。印紙税法 別表第一の課税文書（第1号〜第20号）の印紙税額の表と、文書・記載金額・作成日から税額を出す計算を返します。第1号のうち不動産の譲渡に関する契約書と、第2号のうち建設工事の請負に関する契約書は、租税特別措置法第91条の軽減措置（平成26年4月1日〜令和9年3月31日に作成）を作成日で判定します。国税庁の印紙税額の一覧表と照らし合わせて作成し、照合した日を data_version で返します。説明: https://api.shirugear.com/stamp/ 。v1 の中では項目や文書を足すことはあっても、名前や意味は変えません（知らない項目は無視してください）。",
    "termsOfService": "https://api.shirugear.com/terms/",
    "contact": {
      "name": "アナライズギア株式会社（シルギア）",
      "url": "https://shirugear.com/contact"
    }
  },
  "servers": [
    {
      "url": "https://api.shirugear.com"
    }
  ],
  "paths": {
    "/stamp/v1/tax.json": {
      "get": {
        "summary": "文書・記載金額・作成日から印紙税額を出す",
        "operationId": "getTax",
        "parameters": [
          {
            "name": "doc",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "no1_realestate",
                "no1",
                "no2_construction",
                "no2",
                "no3",
                "no3_flat",
                "no4",
                "no5",
                "no6",
                "no7",
                "no8",
                "no9",
                "no10",
                "no11",
                "no12",
                "no13",
                "no14",
                "no15",
                "no16",
                "no17_1",
                "no17_2",
                "no18",
                "no19",
                "no20"
              ]
            },
            "description": "文書"
          },
          {
            "name": "amount",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]{0,14}|none)$"
            },
            "description": "記載金額（0以上の整数の円・カンマなし）。記載金額のない文書は none。定額の文書（pricing が flat・per_year）では省略できる"
          },
          {
            "name": "date",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "作成日 YYYY-MM-DD。省略すると日本時間の今日（軽減措置の期間の判定に使う）"
          }
        ],
        "responses": {
          "200": {
            "description": "税額",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tax"
                }
              }
            }
          },
          "400": {
            "description": "指定の誤り（doc・amount・date の形、記載金額が必ずある文書で amount=none など）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "無い文書",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "日本国内以外から",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "GET/HEAD以外",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/stamp/v1/rates.json": {
      "get": {
        "summary": "全部の文書の税額表",
        "operationId": "getRates",
        "responses": {
          "200": {
            "description": "全部の文書",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rates"
                }
              }
            }
          },
          "403": {
            "description": "日本国内以外から",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "GET/HEAD以外",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/stamp/v1/{key}.json": {
      "get": {
        "summary": "1つの文書の税額表",
        "operationId": "getDocument",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "no1_realestate",
                "no1",
                "no2_construction",
                "no2",
                "no3",
                "no3_flat",
                "no4",
                "no5",
                "no6",
                "no7",
                "no8",
                "no9",
                "no10",
                "no11",
                "no12",
                "no13",
                "no14",
                "no15",
                "no16",
                "no17_1",
                "no17_2",
                "no18",
                "no19",
                "no20"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "1つの文書",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentResponse"
                }
              }
            }
          },
          "400": {
            "description": "URLの形が違う",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "無い文書",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "日本国内以外から",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "GET/HEAD以外",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/stamp/v1/meta.json": {
      "get": {
        "summary": "データの版・出典・文書の一覧",
        "operationId": "getMeta",
        "responses": {
          "200": {
            "description": "版",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Meta"
                }
              }
            }
          },
          "403": {
            "description": "日本国内以外から",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "GET/HEAD以外",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Tier": {
        "type": "object",
        "required": [
          "over",
          "upto",
          "tax"
        ],
        "properties": {
          "over": {
            "type": [
              "integer",
              "null"
            ],
            "description": "この金額を超え（円）。最初の区分は null"
          },
          "upto": {
            "type": [
              "integer",
              "null"
            ],
            "description": "この金額以下（円）。最後の区分は null（上限なし）"
          },
          "tax": {
            "type": "integer",
            "description": "印紙税額（円）"
          }
        }
      },
      "Reduced": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "date"
          },
          "until": {
            "type": "string",
            "format": "date"
          },
          "over": {
            "type": "integer",
            "description": "記載金額がこの額を超えるときだけ軽減後の表"
          },
          "basis": {
            "type": "string"
          },
          "tiers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Tier"
            }
          }
        }
      },
      "Document": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "enum": [
              "no1_realestate",
              "no1",
              "no2_construction",
              "no2",
              "no3",
              "no3_flat",
              "no4",
              "no5",
              "no6",
              "no7",
              "no8",
              "no9",
              "no10",
              "no11",
              "no12",
              "no13",
              "no14",
              "no15",
              "no16",
              "no17_1",
              "no17_2",
              "no18",
              "no19",
              "no20"
            ]
          },
          "number": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "group": {
            "type": "string",
            "enum": [
              "contract",
              "bill",
              "security",
              "receipt",
              "passbook"
            ]
          },
          "name": {
            "type": "string"
          },
          "covers": {
            "type": "string"
          },
          "pricing": {
            "type": "string",
            "enum": [
              "by_amount",
              "flat",
              "per_year"
            ]
          },
          "tax": {
            "type": [
              "integer",
              "null"
            ],
            "description": "定額の税額（円）。by_amount は null"
          },
          "exempt_below": {
            "type": [
              "integer",
              "null"
            ],
            "description": "記載金額がこの額未満なら非課税（円）"
          },
          "tiers": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/Tier"
            }
          },
          "no_amount_tax": {
            "type": [
              "integer",
              "null"
            ],
            "description": "記載金額のないものの税額（0は非課税・nullは該当なし）"
          },
          "reduced": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Reduced"
              }
            ]
          }
        }
      },
      "DocumentResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Document"
          },
          {
            "type": "object",
            "properties": {
              "currency": {
                "const": "JPY"
              },
              "data_version": {
                "type": "string",
                "format": "date"
              }
            }
          }
        ]
      },
      "Rates": {
        "type": "object",
        "properties": {
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Document"
            }
          },
          "currency": {
            "const": "JPY"
          },
          "data_version": {
            "type": "string",
            "format": "date"
          }
        }
      },
      "Meta": {
        "type": "object",
        "properties": {
          "data_version": {
            "type": "string"
          },
          "checked_at": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "documents": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "counts": {
            "type": "object"
          },
          "reduced_period": {
            "type": [
              "object",
              "null"
            ]
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Tax": {
        "type": "object",
        "properties": {
          "document": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string"
              },
              "number": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              },
              "exempt_below": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            }
          },
          "amount": {
            "type": [
              "integer",
              "null"
            ]
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "date_defaulted": {
            "type": "boolean"
          },
          "tax": {
            "type": "integer",
            "description": "印紙税額（円）。非課税は0"
          },
          "taxable": {
            "type": "boolean"
          },
          "rule": {
            "type": "string",
            "enum": [
              "exempt",
              "no_amount",
              "base",
              "reduced",
              "flat",
              "per_year"
            ]
          },
          "bracket": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "over": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "upto": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            }
          },
          "reduced": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "from": {
                "type": "string"
              },
              "until": {
                "type": "string"
              },
              "in_period": {
                "type": "boolean"
              },
              "applied": {
                "type": "boolean"
              }
            }
          },
          "currency": {
            "const": "JPY"
          },
          "data_version": {
            "type": "string",
            "format": "date"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "status": {
                "type": "integer"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
