Unit Conversion API: One Endpoint, Ten Categories
Every product with international users eventually needs unit conversion, and hand-rolled conversion tables are where subtle bugs live (looking at you, temperature offsets).
One GET converts between any two compatible units across ten categories — pass a value, from, and to using short codes like km, mi, kg, lb, c, f. The category is inferred automatically.
Convert a value
curl -G "https://unit-converter26.p.rapidapi.com/convert" \
-d "value=100" -d "from=km" -d "to=mi" \
-H "X-RapidAPI-Key: YOUR_KEY" \
-H "X-RapidAPI-Host: unit-converter26.p.rapidapi.com"{
"value": 100,
"from": "km",
"to": "mi",
"category": "length",
"result": 62.1371
}Build dropdowns dynamically
GET /categories lists all ten categories, and GET /units returns every unit code within a category — so a converter UI can populate its selectors and validate input without hardcoding unit lists that drift out of sync with the backend.
The categories
Length, mass, temperature, volume, area, speed, data size, time, pressure, and energy. Temperature handles the offset conversions (Celsius/Fahrenheit/Kelvin) correctly — the classic source of DIY conversion bugs. Everything is pure math, stateless, and instant.
Run it in production
Unit Converter has a permanent free tier — 1,000 requests a month, no credit card. Paid plans start at $5/month for 100,000 requests.
FAQ
Do I need to specify the category?
No — it's inferred from the unit codes. You can pass it explicitly if two categories ever share a code.
How precise are the results?
Conversions use standard exact definitions (e.g., 1 in = 25.4 mm) with full floating-point precision; round for display as needed.
Can I convert currencies with this?
No — currency needs live rates. Use the Currency Exchange Rates API from the same catalog for that.