{
  "openapi": "3.0.3",
  "info": {
    "title": "US Freelancer Tax API",
    "version": "1.0.0",
    "description": "2026 US federal self-employment tax, income tax estimate, quarterly estimated payments with the safe-harbor minimum, and IRS due dates moved for weekends and holidays. Figures from SSA and IRS Rev. Proc. 2025-32, cited in /v1/figures. Also a 2025-2026 mileage deduction priced by trip date and a home office deduction comparing the simplified and regular methods. Planning estimates, not tax advice. Spreadsheet versions (our own products, $9 each): Freelancer Quarterly Tax Planner 2026, https://payhip.com/b/UspdI; Home Office Deduction Worksheet, https://payhip.com/b/8bG3C; Mileage Log 2026, https://payhip.com/b/TUHGi"
  },
  "servers": [
    {
      "url": "https://us-freelancer-tax-api.narwhalapis.workers.dev"
    }
  ],
  "paths": {
    "/v1/figures": {
      "get": {
        "summary": "Tax figures",
        "description": "Every 2026 figure the API uses (wage base, rates, brackets, deductions, thresholds) with official sources.",
        "tags": [
          "Reference"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "tax_year": 2026,
                  "figures": {
                    "ssBase": 184500,
                    "ssRate": 12.4,
                    "medRate": 2.9,
                    "nef": 92.35,
                    "minSE": 400,
                    "addRate": 0.9,
                    "addThr": {
                      "mfj": 250000,
                      "mfs": 125000,
                      "other": 200000
                    },
                    "std": {
                      "single": 16100,
                      "mfj": 32200,
                      "mfs": 16100,
                      "hoh": 24150
                    },
                    "rates": [
                      10,
                      12,
                      22,
                      24,
                      32,
                      35
                    ],
                    "tops": {
                      "single": [
                        12400,
                        50400,
                        105700,
                        201775,
                        256225,
                        640600
                      ],
                      "mfj": [
                        24800,
                        100800,
                        211400,
                        403550,
                        512450,
                        768700
                      ],
                      "mfs": [
                        12400,
                        50400,
                        105700,
                        201775,
                        256225,
                        384350
                      ],
                      "hoh": [
                        17700,
                        67450,
                        105700,
                        201750,
                        256200,
                        640600
                      ]
                    },
                    "qbiRate": 20,
                    "qbiThr": {
                      "mfj": 403500,
                      "mfs": 201775,
                      "other": 201750
                    },
                    "sh90": 90,
                    "sh100": 100,
                    "sh110": 110,
                    "shAgi": 150000,
                    "shAgiMfs": 75000
                  },
                  "sources": [
                    {
                      "what": "Social Security wage base 2026 ($184,500)",
                      "where": "Social Security Administration, 2026 COLA fact sheet",
                      "url": "https://www.ssa.gov/oact/cola/cbb.html"
                    },
                    {
                      "what": "2026 tax brackets and standard deductions",
                      "where": "IRS Revenue Procedure 2025-32",
                      "url": "https://www.irs.gov/pub/irs-drop/rp-25-32.pdf"
                    },
                    {
                      "what": "Self-employment tax rates and the 92.35% factor",
                      "where": "IRS Schedule SE / Self-employment tax page",
                      "url": "https://www.irs.gov/businesses/small-businesses-self-employed/self-employment-tax-social-security-and-medicare-taxes"
                    },
                    {
                      "what": "Estimated tax due dates and safe harbor",
                      "where": "IRS Form 1040-ES (2026)",
                      "url": "https://www.irs.gov/pub/irs-pdf/f1040es.pdf"
                    },
                    {
                      "what": "Additional Medicare Tax thresholds",
                      "where": "IRS Additional Medicare Tax Q&A",
                      "url": "https://www.irs.gov/businesses/small-businesses-self-employed/questions-and-answers-for-the-additional-medicare-tax"
                    }
                  ],
                  "version": "1.0.0",
                  "disclaimer": "Planning estimate of US federal tax for tax year 2026. Not tax, legal or accounting advice. Ignores credits, other income, itemized deductions and the full QBI limits."
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Not called through RapidAPI"
          }
        },
        "parameters": [],
        "operationId": "tax_figures_get",
        "x-example-request": "/v1/figures"
      }
    },
    "/v1/se-tax": {
      "get": {
        "summary": "Self-employment tax",
        "description": "Schedule SE tax (Social Security + Medicare), the deductible half and the Additional Medicare Tax.",
        "tags": [
          "Tax"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "tax_year": 2026,
                  "net_profit": 80000,
                  "net_earnings_from_self_employment": 73880,
                  "social_security": 9161.12,
                  "medicare": 2142.52,
                  "self_employment_tax": 11303.64,
                  "deductible_half": 5651.82,
                  "additional_medicare_tax": 0,
                  "filing_status": "single",
                  "currency": "USD",
                  "disclaimer": "Planning estimate of US federal tax for tax year 2026. Not tax, legal or accounting advice. Ignores credits, other income, itemized deductions and the full QBI limits."
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Not called through RapidAPI"
          }
        },
        "parameters": [
          {
            "name": "net_profit",
            "in": "query",
            "required": false,
            "description": "Net self-employment profit for 2026 (USD)",
            "schema": {
              "type": "number"
            },
            "example": 80000
          },
          {
            "name": "ytd_profit",
            "in": "query",
            "required": false,
            "description": "Profit so far this year (use with months instead of net_profit)",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "months",
            "in": "query",
            "required": false,
            "description": "Months covered by ytd_profit (1-12)",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "filing_status",
            "in": "query",
            "required": false,
            "description": "single, mfj (married filing jointly), mfs (married filing separately), hoh (head of household) or qss",
            "schema": {
              "type": "string",
              "enum": [
                "single",
                "mfj",
                "mfs",
                "hoh",
                "qss"
              ]
            }
          },
          {
            "name": "w2_wages",
            "in": "query",
            "required": false,
            "description": "Your W-2 wages (reduce the Social Security room)",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "spouse_w2_wages",
            "in": "query",
            "required": false,
            "description": "Spouse W-2 wages (mfj, for Additional Medicare)",
            "schema": {
              "type": "number"
            }
          }
        ],
        "operationId": "self-employment_tax_get",
        "x-example-request": "/v1/se-tax?net_profit=80000"
      },
      "post": {
        "summary": "Self-employment tax",
        "description": "Schedule SE tax (Social Security + Medicare), the deductible half and the Additional Medicare Tax.",
        "tags": [
          "Tax"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "tax_year": 2026,
                  "net_profit": 90000,
                  "net_earnings_from_self_employment": 83115,
                  "social_security": 7998,
                  "medicare": 2410.33,
                  "self_employment_tax": 10408.33,
                  "deductible_half": 5204.17,
                  "additional_medicare_tax": 28.03,
                  "filing_status": "single",
                  "currency": "USD",
                  "disclaimer": "Planning estimate of US federal tax for tax year 2026. Not tax, legal or accounting advice. Ignores credits, other income, itemized deductions and the full QBI limits."
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Not called through RapidAPI"
          }
        },
        "operationId": "self-employment_tax_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "net_profit": 90000,
                "w2_wages": 120000
              }
            }
          }
        }
      }
    },
    "/v1/estimate": {
      "get": {
        "summary": "Quarterly estimate",
        "description": "Total 2026 federal tax, what is still owed after withholding, % of profit to set aside, the safe-harbor minimum and the full quarterly payment, with due dates.",
        "tags": [
          "Tax"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "tax_year": 2026,
                  "filing_status": "single",
                  "net_profit_used": 80000,
                  "self_employment": {
                    "net_earnings": 73880,
                    "social_security": 9161.12,
                    "medicare": 2142.52,
                    "self_employment_tax": 11303.64,
                    "deductible_half": 5651.82
                  },
                  "additional_medicare_tax": 0,
                  "income_tax": {
                    "adjusted_gross_income": 74348.18,
                    "standard_deduction": 16100,
                    "qbi_deduction": 11649.64,
                    "qbi_over_threshold": false,
                    "taxable_income": 46598.54,
                    "federal_income_tax": 5343.83,
                    "top_bracket_pct": 12
                  },
                  "total_federal_tax": 16647.47,
                  "withholding": 0,
                  "federal_tax_still_owed": 16647.47,
                  "state_tax_estimate": 0,
                  "set_aside_pct_of_profit": 20.81,
                  "quarterly": {
                    "safe_harbor_required_annual": 14982.72,
                    "safe_harbor_basis": "current",
                    "minimum_quarterly_payment": 3745.68,
                    "full_quarterly_payment": 4161.87,
                    "estimated_payments_required": true,
                    "due_dates": [
                      {
                        "quarter": "Q1",
                        "statutory_date": "2026-04-15",
                        "due_date": "2026-04-15",
                        "moved": false
                      },
                      {
                        "quarter": "Q2",
                        "statutory_date": "2026-06-15",
                        "due_date": "2026-06-15",
                        "moved": false
                      },
                      {
                        "quarter": "Q3",
                        "statutory_date": "2026-09-15",
                        "due_date": "2026-09-15",
                        "moved": false
                      },
                      {
                        "quarter": "Q4",
                        "statutory_date": "2027-01-15",
                        "due_date": "2027-01-15",
                        "moved": false
                      }
                    ]
                  },
                  "currency": "USD",
                  "disclaimer": "Planning estimate of US federal tax for tax year 2026. Not tax, legal or accounting advice. Ignores credits, other income, itemized deductions and the full QBI limits."
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Not called through RapidAPI"
          }
        },
        "parameters": [
          {
            "name": "net_profit",
            "in": "query",
            "required": false,
            "description": "Net self-employment profit for 2026 (USD)",
            "schema": {
              "type": "number"
            },
            "example": 80000
          },
          {
            "name": "ytd_profit",
            "in": "query",
            "required": false,
            "description": "Profit so far this year (use with months instead of net_profit)",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "months",
            "in": "query",
            "required": false,
            "description": "Months covered by ytd_profit (1-12)",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "filing_status",
            "in": "query",
            "required": false,
            "description": "single, mfj (married filing jointly), mfs (married filing separately), hoh (head of household) or qss",
            "schema": {
              "type": "string",
              "enum": [
                "single",
                "mfj",
                "mfs",
                "hoh",
                "qss"
              ]
            }
          },
          {
            "name": "w2_wages",
            "in": "query",
            "required": false,
            "description": "Your W-2 wages",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "spouse_w2_wages",
            "in": "query",
            "required": false,
            "description": "Spouse W-2 wages (mfj only)",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "withholding",
            "in": "query",
            "required": false,
            "description": "Federal tax withheld from W-2 pay",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "qbi",
            "in": "query",
            "required": false,
            "description": "Apply the simplified 20% QBI deduction (default true)",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "state_rate_pct",
            "in": "query",
            "required": false,
            "description": "Flat state tax % to set aside",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "prior_year_tax",
            "in": "query",
            "required": false,
            "description": "2025 total tax (for the 100%/110% safe harbor)",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "prior_year_agi",
            "in": "query",
            "required": false,
            "description": "2025 AGI (110% rule above $150,000; $75,000 mfs)",
            "schema": {
              "type": "number"
            }
          }
        ],
        "operationId": "quarterly_estimate_get",
        "x-example-request": "/v1/estimate?net_profit=80000&filing_status=single"
      },
      "post": {
        "summary": "Quarterly estimate",
        "description": "Total 2026 federal tax, what is still owed after withholding, % of profit to set aside, the safe-harbor minimum and the full quarterly payment, with due dates.",
        "tags": [
          "Tax"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "tax_year": 2026,
                  "filing_status": "single",
                  "net_profit_used": 80000,
                  "self_employment": {
                    "net_earnings": 73880,
                    "social_security": 9161.12,
                    "medicare": 2142.52,
                    "self_employment_tax": 11303.64,
                    "deductible_half": 5651.82
                  },
                  "additional_medicare_tax": 0,
                  "income_tax": {
                    "adjusted_gross_income": 74348.18,
                    "standard_deduction": 16100,
                    "qbi_deduction": 11649.64,
                    "qbi_over_threshold": false,
                    "taxable_income": 46598.54,
                    "federal_income_tax": 5343.83,
                    "top_bracket_pct": 12
                  },
                  "total_federal_tax": 16647.47,
                  "withholding": 0,
                  "federal_tax_still_owed": 16647.47,
                  "state_tax_estimate": 0,
                  "set_aside_pct_of_profit": 20.81,
                  "quarterly": {
                    "safe_harbor_required_annual": 12000,
                    "safe_harbor_basis": "prior100",
                    "minimum_quarterly_payment": 3000,
                    "full_quarterly_payment": 4161.87,
                    "estimated_payments_required": true,
                    "due_dates": [
                      {
                        "quarter": "Q1",
                        "statutory_date": "2026-04-15",
                        "due_date": "2026-04-15",
                        "moved": false
                      },
                      {
                        "quarter": "Q2",
                        "statutory_date": "2026-06-15",
                        "due_date": "2026-06-15",
                        "moved": false
                      },
                      {
                        "quarter": "Q3",
                        "statutory_date": "2026-09-15",
                        "due_date": "2026-09-15",
                        "moved": false
                      },
                      {
                        "quarter": "Q4",
                        "statutory_date": "2027-01-15",
                        "due_date": "2027-01-15",
                        "moved": false
                      }
                    ]
                  },
                  "currency": "USD",
                  "disclaimer": "Planning estimate of US federal tax for tax year 2026. Not tax, legal or accounting advice. Ignores credits, other income, itemized deductions and the full QBI limits."
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Not called through RapidAPI"
          }
        },
        "operationId": "quarterly_estimate_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "net_profit": 80000,
                "filing_status": "single",
                "prior_year_tax": 12000,
                "prior_year_agi": 70000
              }
            }
          }
        }
      }
    },
    "/v1/due-dates": {
      "get": {
        "summary": "Due dates",
        "description": "Quarterly estimated tax due dates for any tax year 2000-2100, moved to the next business day for weekends and DC legal holidays.",
        "tags": [
          "Reference"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "tax_year": 2026,
                  "quarters": [
                    {
                      "quarter": "Q1",
                      "statutory_date": "2026-04-15",
                      "due_date": "2026-04-15",
                      "moved": false
                    },
                    {
                      "quarter": "Q2",
                      "statutory_date": "2026-06-15",
                      "due_date": "2026-06-15",
                      "moved": false
                    },
                    {
                      "quarter": "Q3",
                      "statutory_date": "2026-09-15",
                      "due_date": "2026-09-15",
                      "moved": false
                    },
                    {
                      "quarter": "Q4",
                      "statutory_date": "2027-01-15",
                      "due_date": "2027-01-15",
                      "moved": false
                    }
                  ],
                  "note": "Dates falling on a weekend or a Washington, DC legal holiday move to the next business day. Disaster-area postponements are not included."
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Not called through RapidAPI"
          }
        },
        "parameters": [
          {
            "name": "year",
            "in": "query",
            "required": false,
            "description": "Tax year (default 2026)",
            "schema": {
              "type": "integer"
            },
            "example": 2026
          }
        ],
        "operationId": "due_dates_get",
        "x-example-request": "/v1/due-dates?year=2026"
      }
    },
    "/v1/estimate/batch": {
      "post": {
        "summary": "Batch estimates",
        "description": "Up to 100 estimates in one request (e.g. one per client or contractor).",
        "tags": [
          "Tax"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "count": 2,
                  "results": [
                    {
                      "tax_year": 2026,
                      "filing_status": "single",
                      "net_profit_used": 50000,
                      "self_employment": {
                        "net_earnings": 46175,
                        "social_security": 5725.7,
                        "medicare": 1339.08,
                        "self_employment_tax": 7064.78,
                        "deductible_half": 3532.39
                      },
                      "additional_medicare_tax": 0,
                      "income_tax": {
                        "adjusted_gross_income": 46467.61,
                        "standard_deduction": 16100,
                        "qbi_deduction": 6073.52,
                        "qbi_over_threshold": false,
                        "taxable_income": 24294.09,
                        "federal_income_tax": 2667.29,
                        "top_bracket_pct": 12
                      },
                      "total_federal_tax": 9732.07,
                      "withholding": 0,
                      "federal_tax_still_owed": 9732.07,
                      "state_tax_estimate": 0,
                      "set_aside_pct_of_profit": 19.46,
                      "quarterly": {
                        "safe_harbor_required_annual": 8758.86,
                        "safe_harbor_basis": "current",
                        "minimum_quarterly_payment": 2189.71,
                        "full_quarterly_payment": 2433.02,
                        "estimated_payments_required": true,
                        "due_dates": [
                          {
                            "quarter": "Q1",
                            "statutory_date": "2026-04-15",
                            "due_date": "2026-04-15",
                            "moved": false
                          },
                          {
                            "quarter": "Q2",
                            "statutory_date": "2026-06-15",
                            "due_date": "2026-06-15",
                            "moved": false
                          },
                          {
                            "quarter": "Q3",
                            "statutory_date": "2026-09-15",
                            "due_date": "2026-09-15",
                            "moved": false
                          },
                          {
                            "quarter": "Q4",
                            "statutory_date": "2027-01-15",
                            "due_date": "2027-01-15",
                            "moved": false
                          }
                        ]
                      },
                      "currency": "USD",
                      "disclaimer": "Planning estimate of US federal tax for tax year 2026. Not tax, legal or accounting advice. Ignores credits, other income, itemized deductions and the full QBI limits."
                    },
                    {
                      "tax_year": 2026,
                      "filing_status": "mfj",
                      "net_profit_used": 120000,
                      "self_employment": {
                        "net_earnings": 110820,
                        "social_security": 13741.68,
                        "medicare": 3213.78,
                        "self_employment_tax": 16955.46,
                        "deductible_half": 8477.73
                      },
                      "additional_medicare_tax": 0,
                      "income_tax": {
                        "adjusted_gross_income": 111522.27,
                        "standard_deduction": 32200,
                        "qbi_deduction": 15864.45,
                        "qbi_over_threshold": false,
                        "taxable_income": 63457.82,
                        "federal_income_tax": 7118.94,
                        "top_bracket_pct": 12
                      },
                      "total_federal_tax": 24074.4,
                      "withholding": 0,
                      "federal_tax_still_owed": 24074.4,
                      "state_tax_estimate": 0,
                      "set_aside_pct_of_profit": 20.06,
                      "quarterly": {
                        "safe_harbor_required_annual": 21666.96,
                        "safe_harbor_basis": "current",
                        "minimum_quarterly_payment": 5416.74,
                        "full_quarterly_payment": 6018.6,
                        "estimated_payments_required": true,
                        "due_dates": [
                          {
                            "quarter": "Q1",
                            "statutory_date": "2026-04-15",
                            "due_date": "2026-04-15",
                            "moved": false
                          },
                          {
                            "quarter": "Q2",
                            "statutory_date": "2026-06-15",
                            "due_date": "2026-06-15",
                            "moved": false
                          },
                          {
                            "quarter": "Q3",
                            "statutory_date": "2026-09-15",
                            "due_date": "2026-09-15",
                            "moved": false
                          },
                          {
                            "quarter": "Q4",
                            "statutory_date": "2027-01-15",
                            "due_date": "2027-01-15",
                            "moved": false
                          }
                        ]
                      },
                      "currency": "USD",
                      "disclaimer": "Planning estimate of US federal tax for tax year 2026. Not tax, legal or accounting advice. Ignores credits, other income, itemized deductions and the full QBI limits."
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Not called through RapidAPI"
          }
        },
        "operationId": "batch_estimates_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "items": [
                  {
                    "net_profit": 50000
                  },
                  {
                    "net_profit": 120000,
                    "filing_status": "mfj"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/v1/mileage": {
      "get": {
        "summary": "2026 split-year mileage deduction from miles before and after July 1",
        "operationId": "mileageSplit",
        "parameters": [
          {
            "name": "business_jan_jun",
            "in": "query",
            "required": false,
            "description": "2026 business miles driven Jan 1 to Jun 30",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "business_jul_dec",
            "in": "query",
            "required": false,
            "description": "2026 business miles driven Jul 1 to Dec 31",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "medical_jan_jun",
            "in": "query",
            "required": false,
            "description": "2026 medical miles driven Jan 1 to Jun 30",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "medical_jul_dec",
            "in": "query",
            "required": false,
            "description": "2026 medical miles driven Jul 1 to Dec 31",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "moving_jan_jun",
            "in": "query",
            "required": false,
            "description": "2026 moving miles driven Jan 1 to Jun 30",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "moving_jul_dec",
            "in": "query",
            "required": false,
            "description": "2026 moving miles driven Jul 1 to Dec 31",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "charity_jan_jun",
            "in": "query",
            "required": false,
            "description": "2026 charity miles driven Jan 1 to Jun 30",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "charity_jul_dec",
            "in": "query",
            "required": false,
            "description": "2026 charity miles driven Jul 1 to Dec 31",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "parking_tolls",
            "in": "query",
            "required": false,
            "description": "Parking and tolls in USD, added on top",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deduction or reimbursement per purpose and per rate period",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          }
        },
        "x-example-request": "/v1/mileage?business_jan_jun=4000&business_jul_dec=3000"
      },
      "post": {
        "summary": "Mileage deduction from a trip log, each trip priced by its date (2025 and 2026)",
        "operationId": "mileageTrips",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "trips"
                ],
                "properties": {
                  "trips": {
                    "type": "array",
                    "maxItems": 5000,
                    "items": {
                      "type": "object",
                      "required": [
                        "date",
                        "miles"
                      ],
                      "properties": {
                        "date": {
                          "type": "string",
                          "example": "2026-07-15"
                        },
                        "miles": {
                          "type": "number"
                        },
                        "purpose": {
                          "type": "string",
                          "enum": [
                            "business",
                            "medical",
                            "moving",
                            "charity"
                          ],
                          "default": "business"
                        }
                      }
                    }
                  },
                  "parking_tolls": {
                    "type": "number"
                  },
                  "include_rows": {
                    "type": "boolean",
                    "default": false
                  }
                }
              },
              "example": {
                "trips": [
                  {
                    "date": "2026-06-30",
                    "miles": 100,
                    "purpose": "business"
                  },
                  {
                    "date": "2026-07-01",
                    "miles": 100,
                    "purpose": "business"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deduction or reimbursement per purpose and per rate period",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          }
        }
      }
    },
    "/v1/mileage/rates": {
      "get": {
        "summary": "IRS standard mileage rates by period (2025, Jan-Jun 2026, Jul-Dec 2026) with sources",
        "operationId": "mileageRates",
        "responses": {
          "200": {
            "description": "Rates in cents per mile",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "x-example-request": "/v1/mileage/rates"
      }
    },
    "/v1/home-office": {
      "get": {
        "summary": "Home office deduction: simplified vs regular (Form 8829) method side by side",
        "operationId": "homeOffice",
        "tags": [
          "Home office"
        ],
        "description": "Simplified method ($5 per sq ft up to 300 sq ft, part-year averaging, income limit) and the regular method (business share of home costs in Form 8829 order: mortgage interest and taxes, then operating costs, then 39-year MACRS depreciation with the Pub. 587 first-year table, plus carryovers). Flags the better method and the difference. Sources: IRS Pub. 587, Form 8829, Rev. Proc. 2013-13.",
        "parameters": [
          {
            "name": "office_sqft",
            "in": "query",
            "required": true,
            "description": "Square feet used regularly and exclusively for business (required)",
            "schema": {
              "type": "number"
            },
            "example": 200
          },
          {
            "name": "home_sqft",
            "in": "query",
            "required": false,
            "description": "Total square feet of the home (needed for the regular method)",
            "schema": {
              "type": "number"
            },
            "example": 1600
          },
          {
            "name": "months",
            "in": "query",
            "required": false,
            "description": "Months the office was used this year, 0 to 12 (default 12)",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "method",
            "in": "query",
            "required": false,
            "description": "compare (default when home_sqft is given), simplified or regular",
            "schema": {
              "type": "string",
              "enum": [
                "compare",
                "simplified",
                "regular"
              ]
            }
          },
          {
            "name": "gross_income",
            "in": "query",
            "required": false,
            "description": "Gross income from the business use of the home, for the income limit",
            "schema": {
              "type": "number"
            },
            "example": 60000
          },
          {
            "name": "other_expenses",
            "in": "query",
            "required": false,
            "description": "Business expenses not related to the home",
            "schema": {
              "type": "number"
            },
            "example": 5000
          },
          {
            "name": "mortgage_interest",
            "in": "query",
            "required": false,
            "description": "Deductible mortgage interest for the whole home",
            "schema": {
              "type": "number"
            },
            "example": 9000
          },
          {
            "name": "real_estate_taxes",
            "in": "query",
            "required": false,
            "description": "Real estate taxes for the whole home",
            "schema": {
              "type": "number"
            },
            "example": 4000
          },
          {
            "name": "rent",
            "in": "query",
            "required": false,
            "description": "Rent for the whole home",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "insurance",
            "in": "query",
            "required": false,
            "description": "Homeowner or renter insurance for the whole home",
            "schema": {
              "type": "number"
            },
            "example": 1200
          },
          {
            "name": "utilities",
            "in": "query",
            "required": false,
            "description": "Utilities for the whole home",
            "schema": {
              "type": "number"
            },
            "example": 3000
          },
          {
            "name": "repairs",
            "in": "query",
            "required": false,
            "description": "Repairs and maintenance for the whole home",
            "schema": {
              "type": "number"
            },
            "example": 800
          },
          {
            "name": "other_home",
            "in": "query",
            "required": false,
            "description": "Other indirect home expenses",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "direct",
            "in": "query",
            "required": false,
            "description": "Direct expenses for the office only (deducted in full)",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "prior_operating",
            "in": "query",
            "required": false,
            "description": "Operating expense carryover from last year",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "basis",
            "in": "query",
            "required": false,
            "description": "Home basis for depreciation (smaller of adjusted basis or value, excluding land)",
            "schema": {
              "type": "number"
            },
            "example": 240000
          },
          {
            "name": "first_month",
            "in": "query",
            "required": false,
            "description": "Month business use began this year, 1 to 12, or 0 if in use before this year",
            "schema": {
              "type": "number"
            },
            "example": 0
          },
          {
            "name": "prior_depreciation",
            "in": "query",
            "required": false,
            "description": "Depreciation carryover from last year",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Both methods with the better one flagged, or one method",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "method": "compare",
                  "simplified": {
                    "method": "simplified",
                    "avg_sqft": 200,
                    "capped_sqft": 200,
                    "capped": false,
                    "tentative": 1000,
                    "limit": 55000,
                    "deduction": 1000,
                    "lost": 0
                  },
                  "regular": {
                    "method": "regular",
                    "business_pct": 12.5,
                    "mort_tax": 1625,
                    "operating": 625,
                    "depreciation": 769.2,
                    "depreciation_rate": 2.564,
                    "limit": 53375,
                    "operating_allowed": 625,
                    "depreciation_allowed": 769.2,
                    "carry_operating": 0,
                    "carry_depreciation": 0,
                    "deduction": 3019.2
                  },
                  "better": "regular",
                  "difference": 2019.2,
                  "currency": "USD",
                  "note": "Home office deduction for a home used regularly and exclusively for business (IRS Pub. 587, Form 8829, Rev. Proc. 2013-13). Simplified: $5 per sq ft up to 300 sq ft, limited to business income. Regular: business share of home costs in Form 8829 order (mortgage interest and taxes, then operating costs, then 39-year depreciation), with carryovers. Employees cannot claim it. Planning estimate, not tax advice."
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          }
        },
        "x-example-request": "/v1/home-office?office_sqft=200&home_sqft=1600&gross_income=60000&other_expenses=5000&mortgage_interest=9000&real_estate_taxes=4000&insurance=1200&utilities=3000&repairs=800&basis=240000&first_month=0"
      },
      "post": {
        "summary": "Home office deduction from a JSON body (same fields as GET)",
        "operationId": "homeOfficePost",
        "tags": [
          "Home office"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "office_sqft"
                ],
                "properties": {
                  "office_sqft": {
                    "type": "number",
                    "description": "Square feet used regularly and exclusively for business (required)"
                  },
                  "home_sqft": {
                    "type": "number",
                    "description": "Total square feet of the home (needed for the regular method)"
                  },
                  "months": {
                    "type": "number",
                    "description": "Months the office was used this year, 0 to 12 (default 12)"
                  },
                  "method": {
                    "type": "string",
                    "description": "compare (default when home_sqft is given), simplified or regular"
                  },
                  "gross_income": {
                    "type": "number",
                    "description": "Gross income from the business use of the home, for the income limit"
                  },
                  "other_expenses": {
                    "type": "number",
                    "description": "Business expenses not related to the home"
                  },
                  "mortgage_interest": {
                    "type": "number",
                    "description": "Deductible mortgage interest for the whole home"
                  },
                  "real_estate_taxes": {
                    "type": "number",
                    "description": "Real estate taxes for the whole home"
                  },
                  "rent": {
                    "type": "number",
                    "description": "Rent for the whole home"
                  },
                  "insurance": {
                    "type": "number",
                    "description": "Homeowner or renter insurance for the whole home"
                  },
                  "utilities": {
                    "type": "number",
                    "description": "Utilities for the whole home"
                  },
                  "repairs": {
                    "type": "number",
                    "description": "Repairs and maintenance for the whole home"
                  },
                  "other_home": {
                    "type": "number",
                    "description": "Other indirect home expenses"
                  },
                  "direct": {
                    "type": "number",
                    "description": "Direct expenses for the office only (deducted in full)"
                  },
                  "prior_operating": {
                    "type": "number",
                    "description": "Operating expense carryover from last year"
                  },
                  "basis": {
                    "type": "number",
                    "description": "Home basis for depreciation (smaller of adjusted basis or value, excluding land)"
                  },
                  "first_month": {
                    "type": "number",
                    "description": "Month business use began this year, 1 to 12, or 0 if in use before this year"
                  },
                  "prior_depreciation": {
                    "type": "number",
                    "description": "Depreciation carryover from last year"
                  }
                }
              },
              "example": {
                "office_sqft": 200,
                "home_sqft": 1600,
                "gross_income": 60000,
                "other_expenses": 5000,
                "mortgage_interest": 9000,
                "real_estate_taxes": 4000,
                "insurance": 1200,
                "utilities": 3000,
                "repairs": 800,
                "basis": 240000,
                "first_month": 0
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Both methods with the better one flagged, or one method",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "method": "compare",
                  "simplified": {
                    "method": "simplified",
                    "avg_sqft": 200,
                    "capped_sqft": 200,
                    "capped": false,
                    "tentative": 1000,
                    "limit": 55000,
                    "deduction": 1000,
                    "lost": 0
                  },
                  "regular": {
                    "method": "regular",
                    "business_pct": 12.5,
                    "mort_tax": 1625,
                    "operating": 625,
                    "depreciation": 769.2,
                    "depreciation_rate": 2.564,
                    "limit": 53375,
                    "operating_allowed": 625,
                    "depreciation_allowed": 769.2,
                    "carry_operating": 0,
                    "carry_depreciation": 0,
                    "deduction": 3019.2
                  },
                  "better": "regular",
                  "difference": 2019.2,
                  "currency": "USD",
                  "note": "Home office deduction for a home used regularly and exclusively for business (IRS Pub. 587, Form 8829, Rev. Proc. 2013-13). Simplified: $5 per sq ft up to 300 sq ft, limited to business income. Regular: business share of home costs in Form 8829 order (mortgage interest and taxes, then operating costs, then 39-year depreciation), with carryovers. Employees cannot claim it. Planning estimate, not tax advice."
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          }
        }
      }
    },
    "/v1/retirement": {
      "get": {
        "summary": "SEP IRA vs Solo 401(k) maximum contribution for the self-employed (2026)",
        "operationId": "retirement",
        "tags": [
          "Retirement"
        ],
        "description": "Most a sole proprietor or single-member LLC owner can put into a SEP IRA vs a Solo 401(k) for 2026, per the IRS Pub. 560 rate worksheet: self-employment tax, earned income (profit minus half SE tax), the 20% employer limit, the $24,500 employee deferral (shared with other plans), age 50+ ($8,000) and 60-63 ($11,250) catch-ups, the $72,000 415(c) cap and $360,000 compensation cap, plus the income tax saved at your bracket. Sources: IRS Pub. 560, Notice 2025-67.",
        "parameters": [
          {
            "name": "net_profit",
            "in": "query",
            "required": true,
            "description": "2026 net profit from self-employment (Schedule C line 31 or K-1 share) (required)",
            "schema": {
              "type": "number"
            },
            "example": 100000
          },
          {
            "name": "age_group",
            "in": "query",
            "required": false,
            "description": "Age at year end: under50 (default), 50plus (50-59 or 64+), 60to63 (higher catch-up)",
            "schema": {
              "type": "string",
              "enum": [
                "under50",
                "50plus",
                "60to63"
              ]
            },
            "example": "under50"
          },
          {
            "name": "w2_wages",
            "in": "query",
            "required": false,
            "description": "W-2 Social Security wages from a job this year (reduce the SS wage base for SE tax)",
            "schema": {
              "type": "number"
            },
            "example": 0
          },
          {
            "name": "other_deferrals",
            "in": "query",
            "required": false,
            "description": "401(k)/403(b) elective deferrals already made at other jobs this year (share the $24,500 limit)",
            "schema": {
              "type": "number"
            },
            "example": 0
          },
          {
            "name": "plan_rate",
            "in": "query",
            "required": false,
            "description": "Plan employer contribution rate in % (0-25, default 25)",
            "schema": {
              "type": "number"
            },
            "example": 25
          },
          {
            "name": "bracket",
            "in": "query",
            "required": false,
            "description": "Federal income tax bracket in % for the tax-saved estimate (default 22)",
            "schema": {
              "type": "number"
            },
            "example": 22
          }
        ],
        "responses": {
          "200": {
            "description": "Maximum SEP IRA and Solo 401(k) contributions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "tax_year": 2026,
                  "net_profit": 100000,
                  "age_group": "under50",
                  "se_tax": {
                    "base": 92350,
                    "ss": 11451.4,
                    "medicare": 2678.15,
                    "total": 14129.55,
                    "half": 7064.78
                  },
                  "earned_income": 92935.22,
                  "reduced_rate_pct": 20,
                  "sep_ira": {
                    "employer": 18587.04,
                    "total": 18587.04
                  },
                  "solo_401k": {
                    "employer": 18587.04,
                    "deferral": 24500,
                    "catchup": 0,
                    "total": 43087.04
                  },
                  "better": "solo401k",
                  "difference": 24500,
                  "income_tax_saved": {
                    "bracket_pct": 22,
                    "sep_ira": 4089.15,
                    "solo_401k": 9479.15
                  },
                  "limits": {
                    "total_415c": 72000,
                    "elective_deferral": 24500,
                    "compensation_cap": 360000,
                    "catchup_50": 8000,
                    "catchup_60_63": 11250,
                    "ss_wage_base": 184500
                  },
                  "currency": "USD",
                  "note": "..."
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "error": "\"net_profit\" is required"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "SEP IRA vs Solo 401(k) maximum contribution (JSON body)",
        "operationId": "retirementPost",
        "tags": [
          "Retirement"
        ],
        "description": "Most a sole proprietor or single-member LLC owner can put into a SEP IRA vs a Solo 401(k) for 2026, per the IRS Pub. 560 rate worksheet: self-employment tax, earned income (profit minus half SE tax), the 20% employer limit, the $24,500 employee deferral (shared with other plans), age 50+ ($8,000) and 60-63 ($11,250) catch-ups, the $72,000 415(c) cap and $360,000 compensation cap, plus the income tax saved at your bracket. Sources: IRS Pub. 560, Notice 2025-67.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "net_profit"
                ],
                "properties": {
                  "net_profit": {
                    "type": "number",
                    "description": "2026 net profit from self-employment (Schedule C line 31 or K-1 share) (required)"
                  },
                  "age_group": {
                    "type": "string",
                    "enum": [
                      "under50",
                      "50plus",
                      "60to63"
                    ],
                    "description": "Age at year end: under50 (default), 50plus (50-59 or 64+), 60to63 (higher catch-up)"
                  },
                  "w2_wages": {
                    "type": "number",
                    "description": "W-2 Social Security wages from a job this year (reduce the SS wage base for SE tax)"
                  },
                  "other_deferrals": {
                    "type": "number",
                    "description": "401(k)/403(b) elective deferrals already made at other jobs this year (share the $24,500 limit)"
                  },
                  "plan_rate": {
                    "type": "number",
                    "description": "Plan employer contribution rate in % (0-25, default 25)"
                  },
                  "bracket": {
                    "type": "number",
                    "description": "Federal income tax bracket in % for the tax-saved estimate (default 22)"
                  }
                }
              },
              "example": {
                "net_profit": 600000,
                "age_group": "50plus"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Maximum SEP IRA and Solo 401(k) contributions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "tax_year": 2026,
                  "net_profit": 100000,
                  "age_group": "under50",
                  "se_tax": {
                    "base": 92350,
                    "ss": 11451.4,
                    "medicare": 2678.15,
                    "total": 14129.55,
                    "half": 7064.78
                  },
                  "earned_income": 92935.22,
                  "reduced_rate_pct": 20,
                  "sep_ira": {
                    "employer": 18587.04,
                    "total": 18587.04
                  },
                  "solo_401k": {
                    "employer": 18587.04,
                    "deferral": 24500,
                    "catchup": 0,
                    "total": 43087.04
                  },
                  "better": "solo401k",
                  "difference": 24500,
                  "income_tax_saved": {
                    "bracket_pct": 22,
                    "sep_ira": 4089.15,
                    "solo_401k": 9479.15
                  },
                  "limits": {
                    "total_415c": 72000,
                    "elective_deferral": 24500,
                    "compensation_cap": 360000,
                    "catchup_50": 8000,
                    "catchup_60_63": 11250,
                    "ss_wage_base": 184500
                  },
                  "currency": "USD",
                  "note": "..."
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "error": "\"net_profit\" is required"
                }
              }
            }
          }
        }
      }
    },
    "/v1/qbi": {
      "get": {
        "summary": "Section 199A QBI deduction for the self-employed (2026)",
        "operationId": "qbi",
        "tags": [
          "QBI"
        ],
        "description": "2026 qualified business income deduction for one trade or business: 20% of QBI, the 20%-of-taxable-income cap, Form 8995 vs 8995-A, the $201,750 / $403,500 thresholds and $75,000 / $150,000 phase-in, the W-2 wage / UBIA limit and the SSTB phase-out. Sources: IRC section 199A, IRS Form 8995-A instructions, Rev. Proc. 2025-32.",
        "parameters": [
          {
            "name": "qbi",
            "in": "query",
            "required": true,
            "description": "Qualified business income from the trade or business (net of the deductible half of SE tax, SE health insurance and retirement contributions) (required)",
            "schema": {
              "type": "number"
            },
            "example": 100000
          },
          {
            "name": "taxable_income",
            "in": "query",
            "required": true,
            "description": "Taxable income before the QBI deduction (required)",
            "schema": {
              "type": "number"
            },
            "example": 150000
          },
          {
            "name": "filing_status",
            "in": "query",
            "required": false,
            "description": "single (default), mfj, mfs, hoh or qss",
            "schema": {
              "type": "string",
              "enum": [
                "single",
                "mfj",
                "mfs",
                "hoh",
                "qss"
              ]
            },
            "example": "single"
          },
          {
            "name": "sstb",
            "in": "query",
            "required": false,
            "description": "true if a specified service trade or business (law, health, consulting, financial services, performing arts, athletics, etc.)",
            "schema": {
              "type": "boolean"
            },
            "example": false
          },
          {
            "name": "w2_wages",
            "in": "query",
            "required": false,
            "description": "W-2 wages the business paid to employees (used above the threshold)",
            "schema": {
              "type": "number"
            },
            "example": 0
          },
          {
            "name": "ubia",
            "in": "query",
            "required": false,
            "description": "Unadjusted basis immediately after acquisition of qualified property (used above the threshold)",
            "schema": {
              "type": "number"
            },
            "example": 0
          },
          {
            "name": "reit_ptp_income",
            "in": "query",
            "required": false,
            "description": "Qualified REIT dividends and publicly traded partnership income",
            "schema": {
              "type": "number"
            },
            "example": 0
          },
          {
            "name": "net_capital_gain",
            "in": "query",
            "required": false,
            "description": "Net capital gain (including qualified dividends), which reduces the taxable income cap",
            "schema": {
              "type": "number"
            },
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "QBI deduction breakdown",
            "content": {
              "application/json": {
                "example": {
                  "tax_year": 2026,
                  "filing_status": "single",
                  "qbi": 100000,
                  "taxable_income": 150000,
                  "form": "8995",
                  "zone": "below",
                  "deduction": 20000,
                  "taxable_income_cap": 30000,
                  "currency": "USD"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          }
        }
      },
      "post": {
        "summary": "Section 199A QBI deduction for the self-employed (2026)",
        "operationId": "qbiPost",
        "tags": [
          "QBI"
        ],
        "description": "2026 qualified business income deduction for one trade or business: 20% of QBI, the 20%-of-taxable-income cap, Form 8995 vs 8995-A, the $201,750 / $403,500 thresholds and $75,000 / $150,000 phase-in, the W-2 wage / UBIA limit and the SSTB phase-out. Sources: IRC section 199A, IRS Form 8995-A instructions, Rev. Proc. 2025-32.",
        "responses": {
          "200": {
            "description": "QBI deduction breakdown",
            "content": {
              "application/json": {
                "example": {
                  "tax_year": 2026,
                  "filing_status": "single",
                  "qbi": 100000,
                  "taxable_income": 150000,
                  "form": "8995",
                  "zone": "below",
                  "deduction": 20000,
                  "taxable_income_cap": 30000,
                  "currency": "USD"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "qbi",
                  "taxable_income"
                ],
                "properties": {
                  "qbi": {
                    "type": "number"
                  },
                  "taxable_income": {
                    "type": "number"
                  },
                  "filing_status": {
                    "type": "string",
                    "enum": [
                      "single",
                      "mfj",
                      "mfs",
                      "hoh",
                      "qss"
                    ]
                  },
                  "sstb": {
                    "type": "boolean"
                  },
                  "w2_wages": {
                    "type": "number"
                  },
                  "ubia": {
                    "type": "number"
                  },
                  "reit_ptp_income": {
                    "type": "number"
                  },
                  "net_capital_gain": {
                    "type": "number"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        }
      }
    }
  }
}