Ratias Open Math API

Last updated: June 2026

Ratias provides a free, open-access mathematical API. Developers can programmatically access our catalog of 13 localized percentage formulas, or execute real-time calculations directly through our high-performance endpoints.

Postman Collection

Download our pre-configured Postman Collection containing all 13 mathematical percentage calculation endpoints to start testing instantly.

Download Collection

1. Formula Metadata API

Retrieve the complete schema, parameters, and localized descriptions for all 13 mathematical formulas:

GET https://www.ratias.com/api/formulas.json

Response Structure Example

{
  "api_version": "1.1",
  "total_formulas": 13,
  "formulas": [
    {
      "id": "formula1",
      "slugs": { "en": "percentage-calculator", "tr": "yuzde-hesaplama", "de": "prozentrechner", "fr": "calculateur-pourcentage" },
      "math_formula": "Result = (A * B) / 100",
      "description": { "en": "Calculates B percent of A.", "tr": "A sayısının yüzde B'sini hesaplar.", "de": "Berechnet B Prozent von A.", "fr": "Calcule B pour cent de A." },
      "parameters": { ... }
    }
  ]
}

2. Real-Time Calculation API

Compute mathematical values dynamically by sending query parameters to the serverless calculate endpoint. The response returns the numerical result, the mathematical formula, and a grammatically correct natural language string in the selected language.

GET https://www.ratias.com/api/calculate

Query Parameters

API Query Parameters Description
ParameterTypeRequiredDescription
formulaString / NumberYesThe formula identifier (e.g. 1, formula1 up to 13).
val1NumberYesFirst parameter value (Base number, sales price, etc.).
val2NumberYesSecond parameter value (Percentage rate, cost, etc.). Not required for some specific edge cases.
val3NumberNoThird parameter value (Required for formulas 8, 10, 13).
val4NumberNoFourth parameter value (Required for formula 13).
langStringNoOutput language: en, tr, de, fr (default: en).

Example Request

GET https://www.ratias.com/api/calculate?formula=1&val1=150&val2=20&lang=en

Example Response

{
  "success": true,
  "formula": "formula1",
  "lang": "en",
  "inputs": {
    "val1": 150,
    "val2": 20
  },
  "data": {
    "result": 30,
    "text": "20% of 150 is 30",
    "formula": "(150 × 20) ÷ 100 = 30"
  }
}

3. Integration Code Examples

JavaScript (Fetch API)

// Perform a calculation programmatically
fetch('https://www.ratias.com/api/calculate?formula=13&val1=1000&val2=200&val3=18&val4=20&lang=en')
  .then(response => response.json())
  .then(data => {
    if (data.success) {
      console.log("Calculated Result:", data.data.result);
      console.log("Output Text:", data.data.text);
    } else {
      console.error("Calculation Error:", data.error);
    }
  });

Python

import requests

# Query calculation endpoint
params = {
    'formula': 1,
    'val1': 150,
    'val2': 20,
    'lang': 'en'
}
response = requests.get("https://www.ratias.com/api/calculate", params=params)
data = response.json()

if data['success']:
    print(f"Result: {data['data']['result']}")
    print(f"Explanation: {data['data']['text']}")

cURL

curl -X GET "https://www.ratias.com/api/calculate?formula=1&val1=150&val2=20&lang=en"

4. Mathematical Formula Reference Table

The following table maps formula IDs to their standard mathematical equations and required inputs:

Formula Catalog and Inputs Reference
IDNameMathematical FormulaInputs Required
formula1Percentage Calculator(A × B) ÷ 100val1 (A), val2 (B)
formula2Percentage AddA × (1 + B ÷ 100)val1 (A), val2 (B)
formula3Reverse Percentage (Excl. VAT)A ÷ (1 + B ÷ 100)val1 (A), val2 (B)
formula4Percentage ExcludeA × (1 - B ÷ 100)val1 (A), val2 (B)
formula5Ratio Calculator(A ÷ B) × 100val1 (A), val2 (B)
formula6Percentage Increase((A ÷ B) - 1) × 100val1 (A), val2 (B)
formula7Percentage Decrease((B - A) ÷ B) × 100val1 (A), val2 (B)
formula8Large Number Percentage(B ÷ A) × Cval1 (A), val2 (B), val3 (C)
formula9Discount Percentage((B ÷ A) - 1) × 100val1 (A), val2 (B)
formula10Compound GrowthA × (1 + B/100)^Cval1 (A), val2 (B), val3 (C)
formula11Percentage Difference|A - B| ÷ ((A + B) ÷ 2) × 100val1 (A), val2 (B)
formula12Percentage Error|B - A| ÷ |A| × 100val1 (A), val2 (B)
formula13Net Profit Calculator(A / (1 + C/100) - B) * (1 - D/100)val1 (A), val2 (B), val3 (C), val4 (D)

5. License and Attribution

The Ratias Open Math API is released under the MIT License and can be used for both commercial and non-commercial purposes. Linking back to Ratias as the data source is highly appreciated.