POST
/
investment
/
calculator
curl --request POST \
  --url https://api.magebank.ai/investment/calculator \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <x-api-key>' \
  --data '{
  "amount": 123,
  "days": 123,
  "customRate": 123
}'
{
  "principal": 1000,
  "days": 365,
  "interestRate": 4.5,
  "interestEarned": "45.00",
  "totalAmount": "1045.00",
  "annualYield": "4.50%",
  "calculation": {
    "formula": "principal × rate × (days ÷ 365)",
    "steps": [
      "1000 × 0.045 × 365/365",
      "1000 × 0.045 × 1.000000",
      "1000 × 0.045 × 0.045000",
      "45.000000"
    ]
  }
}

Investment Planning: Project potential earnings on investments with detailed calculation breakdowns for financial planning.

Request Headers

x-api-key
string
required

Your API key for authentication

Request Body

amount
number
required

Principal amount to invest

days
number
required

Investment duration in days

customRate
number

Optional custom interest rate (annual percentage)

Response

principal
number

Principal amount for the calculation

days
number

Duration of the investment in days

interestRate
number

Annual interest rate applied to the calculation

interestEarned
string

Interest amount earned over the period

totalAmount
string

Total amount including principal and interest

annualYield
string

Annual percentage yield

calculation
object
{
  "principal": 1000,
  "days": 365,
  "interestRate": 4.5,
  "interestEarned": "45.00",
  "totalAmount": "1045.00",
  "annualYield": "4.50%",
  "calculation": {
    "formula": "principal × rate × (days ÷ 365)",
    "steps": [
      "1000 × 0.045 × 365/365",
      "1000 × 0.045 × 1.000000",
      "1000 × 0.045 × 0.045000",
      "45.000000"
    ]
  }
}

Status Codes

Status CodeDescription
200Interest calculation completed successfully
400Invalid request parameters
500Internal Error

Default Rate: If no custom rate is provided, the calculation uses the platform’s current base interest rate.

Simple Interest: The calculator uses a simple interest formula that divides the annual rate by 365 days for daily accrual.