{
  "openapi": "3.1.0",
  "info": {
    "title": "Candid calculation API",
    "version": "1.0.0",
    "description": "Free UK personal finance calculators from Candid. No key needed, 60 requests a minute. Answers are not stored. Results are worked out from the answers given, using UK rules for the current tax year. They are guidance, not regulated financial advice: Candid Personal Finance Ltd is not authorised or regulated by the Financial Conduct Authority.",
    "contact": {
      "name": "Candid",
      "url": "https://www.candid-finance.co.uk/about",
      "email": "admin@candid-finance.co.uk"
    },
    "termsOfService": "https://www.candid-finance.co.uk/terms.html"
  },
  "servers": [
    {
      "url": "https://www.candid-finance.co.uk"
    }
  ],
  "paths": {
    "/api/calc/tax-trap": {
      "get": {
        "operationId": "taxTrap",
        "summary": "£100,000 tax trap and childcare cliff",
        "description": "Whether adjusted net income falls in the Personal Allowance taper (£100,000 to £125,140), what it costs including lost Tax-Free Childcare and funded hours, and the pension salary sacrifice that would bring income back to £100,000. Returns figures and a one-sentence summary. Guidance, not regulated financial advice.",
        "parameters": [
          {
            "name": "salary",
            "in": "query",
            "required": true,
            "description": "Gross annual salary, £.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 10000000
            }
          },
          {
            "name": "bonus",
            "in": "query",
            "required": false,
            "description": "Annual bonus, £. Default 0.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 10000000
            }
          },
          {
            "name": "pension",
            "in": "query",
            "required": false,
            "description": "Pension salary sacrifice, % of salary. Default 0.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            }
          },
          {
            "name": "kids",
            "in": "query",
            "required": false,
            "description": "Children under 5. Default 0.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10
            }
          },
          {
            "name": "loan",
            "in": "query",
            "required": false,
            "description": "Student loan plan, if repaying one. Default none.",
            "schema": {
              "type": "string",
              "enum": [
                "none",
                "plan1",
                "plan2",
                "plan4",
                "plan5",
                "postgrad"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "A required answer is missing or not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: 60 a minute per IP address."
          }
        }
      }
    },
    "/api/calc/student-loan": {
      "get": {
        "operationId": "studentLoan",
        "summary": "Student loan: overpay or not",
        "description": "Whether overpaying a UK student loan (Plan 1, 2, 4, 5 or Postgraduate) reduces total repayments, or only hands over money that would otherwise be written off. Returns figures and a one-sentence summary. Guidance, not regulated financial advice.",
        "parameters": [
          {
            "name": "salary",
            "in": "query",
            "required": true,
            "description": "Gross annual salary, £.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 10000000
            }
          },
          {
            "name": "plan",
            "in": "query",
            "required": true,
            "description": "Loan plan.",
            "schema": {
              "type": "string",
              "enum": [
                "plan1",
                "plan2",
                "plan4",
                "plan5",
                "postgrad"
              ]
            }
          },
          {
            "name": "balance",
            "in": "query",
            "required": true,
            "description": "Loan balance now, £.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 10000000
            }
          },
          {
            "name": "overpay",
            "in": "query",
            "required": true,
            "description": "Overpayment considered, £ a month.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 10000000
            }
          },
          {
            "name": "rate",
            "in": "query",
            "required": false,
            "description": "The loan's interest rate, % a year, if known. Default: the plan's rate for this salary.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 20
            }
          },
          {
            "name": "growth",
            "in": "query",
            "required": false,
            "description": "Salary growth: stable, moderate or high. Default stable.",
            "schema": {
              "type": "string",
              "enum": [
                "stable",
                "moderate",
                "high"
              ]
            }
          },
          {
            "name": "finished",
            "in": "query",
            "required": false,
            "description": "Year the course finished, which sets the write-off date.",
            "schema": {
              "type": "integer",
              "minimum": 1990,
              "maximum": 2100
            }
          },
          {
            "name": "age",
            "in": "query",
            "required": false,
            "description": "Age, used to estimate the write-off date when finished isn't given.",
            "schema": {
              "type": "integer",
              "minimum": 16,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "A required answer is missing or not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: 60 a minute per IP address."
          }
        }
      }
    },
    "/api/calc/mortgage-vs-savings": {
      "get": {
        "operationId": "mortgageVsSavings",
        "summary": "Mortgage overpayment vs savings",
        "description": "Over the time left on a fixed-rate mortgage, the value of overpaying against saving the same monthly amount, after tax and the Personal Savings Allowance. Without savingsRate, uses the highest easy-access rate Candid tracks. Returns figures and a one-sentence summary. Guidance, not regulated financial advice.",
        "parameters": [
          {
            "name": "balance",
            "in": "query",
            "required": true,
            "description": "Mortgage balance, £.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 10000000
            }
          },
          {
            "name": "term",
            "in": "query",
            "required": true,
            "description": "Years left on the mortgage.",
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 40
            }
          },
          {
            "name": "rate",
            "in": "query",
            "required": true,
            "description": "Mortgage rate, % a year.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 20
            }
          },
          {
            "name": "fixEnds",
            "in": "query",
            "required": true,
            "description": "When the fixed rate ends: YYYY-MM or YYYY-MM-DD, in the future.",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}(-\\d{2})?$"
            }
          },
          {
            "name": "overpay",
            "in": "query",
            "required": true,
            "description": "Monthly amount to overpay or save, £.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 10000000
            }
          },
          {
            "name": "savingsRate",
            "in": "query",
            "required": false,
            "description": "Savings rate, % AER. Default: the highest easy-access rate Candid tracks.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 20
            }
          },
          {
            "name": "account",
            "in": "query",
            "required": false,
            "description": "isa (Cash ISA, tax-free) or standard (taxed above the Personal Savings Allowance). Default isa.",
            "schema": {
              "type": "string",
              "enum": [
                "isa",
                "standard"
              ]
            }
          },
          {
            "name": "band",
            "in": "query",
            "required": false,
            "description": "Income tax band, for tax on savings interest. Default basic.",
            "schema": {
              "type": "string",
              "enum": [
                "basic",
                "higher",
                "additional"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "A required answer is missing or not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: 60 a minute per IP address."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Result": {
        "type": "object",
        "properties": {
          "calculator": {
            "type": "string"
          },
          "inputs": {
            "type": "object",
            "description": "The answers used, including defaults."
          },
          "summary": {
            "type": "string",
            "description": "The result in one neutral sentence."
          },
          "result": {
            "type": "object",
            "description": "The figures, in £ unless named otherwise."
          },
          "rules": {
            "type": "string",
            "description": "Which year's rules and rates were used."
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "disclaimer": {
            "type": "string"
          },
          "links": {
            "type": "object",
            "description": "calculator: the same answers on the calculator page."
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "example": {
            "type": "string"
          },
          "docs": {
            "type": "string"
          }
        }
      }
    }
  }
}
