{
  "openapi": "3.1.0",
  "info": {
    "title": "Mortgage & Loan Calculator API",
    "version": "1.0.0",
    "description": "Monthly payment, total interest and a full amortisation schedule for any fixed-rate loan or mortgage.\n\nCalculate fixed-rate loan and mortgage payments: monthly payment, total cost, and total interest — with an optional full month-by-month amortization schedule. Supports down payments and any term in years or months.",
    "contact": {
      "name": "Data and APIs",
      "url": "https://dataandapis.com/contact"
    },
    "termsOfService": "https://dataandapis.com/terms-of-service",
    "license": {
      "name": "Data and APIs Terms of Service",
      "url": "https://dataandapis.com/terms-of-service"
    },
    "x-logo": {
      "url": "https://dataandapis.com/images/mortgage-calculator.webp"
    }
  },
  "externalDocs": {
    "description": "Documentation, live tester and pricing",
    "url": "https://dataandapis.com/apis/mortgage-loan-calculator"
  },
  "servers": [
    {
      "url": "https://api-mortgage-calculator.dataandapis.com"
    }
  ],
  "tags": [
    {
      "name": "Finance",
      "description": "Mortgage & Loan Calculator API belongs to the Finance category of the Data and APIs catalog."
    }
  ],
  "paths": {
    "/v1/mortgage": {
      "get": {
        "operationId": "mortgageCalculator",
        "summary": "Mortgage Calculator",
        "description": "Mortgage Calculator endpoint of the Mortgage & Loan Calculator API. Costs 1 token per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/mortgage-loan-calculator/mortgage-calculator"
        },
        "parameters": [
          {
            "name": "amount",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "300000"
          },
          {
            "name": "down_payment",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "60000"
          },
          {
            "name": "rate",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "6.5"
          },
          {
            "name": "schedule",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "false"
          },
          {
            "name": "years",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "30"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "amount": 300000,
                  "down_payment": 60000,
                  "loan_amount": 240000,
                  "annual_rate": 6.5,
                  "term_months": 360,
                  "number_of_payments": 360,
                  "monthly_payment": 1516.96,
                  "total_payment": 546106.77,
                  "total_interest": 306106.77
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key",
        "description": "Create a free key at https://dataandapis.com/sign-up. 500 tokens a month on the Free plan; this API costs 1 token per call."
      }
    }
  },
  "security": [
    {
      "ApiKey": []
    }
  ]
}