Conversion API

Convert values programmatically with a single JSON POST. No API key, no signup — fair use only.

Quick start

Endpoint: POST https://convertrubix.com/api/convert

curl -s -X POST 'https://convertrubix.com/api/convert' \
  -H 'Content-Type: application/json' \
  -d '{"converterId":"length","value":180,"from":"cm","to":"inch"}'

Example success response: {"success":true,"result":70.8661,"from":"cm","to":"inch","value":180}

Request body

FieldTypeDescription
converterIdstringConverter id (e.g. length, currency)
valuenumber | numeric stringFinite numeric value in the from unit. Strings are parsed with parseFloat; NaN, Infinity, and -Infinity are rejected.
fromstringSource unit id (case-sensitive)
tostringTarget unit id (case-sensitive)

Discovery (GET)

GET https://convertrubix.com/api/convert returns API metadata and the full converter catalog (ids and unit ids). Use this to stay in sync when new converters ship.

Errors

  • 400 — missing required fields, malformed JSON body, non-finitevalue, unknown from/to unit id, or a conversion error (e.g. temperature out of range)
  • 404 — unknown converterId

Error bodies: {"error":"message"}. Unit ids are case-sensitive —CM is not cm and will return a 400.

JavaScript example

const response = await fetch("https://convertrubix.com/api/convert", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    converterId: "length",
    value: 180,
    from: "cm",
    to: "inch",
  }),
});
const data = await response.json();

Limits and behavior

  • Currency: the API uses the same built-in fallback rates as server-side conversion (not the live rates shown in the browser UI). For trading or billing, use an official FX source.
  • CORS: this API is intended for backend and serverless callers. Browser requests from other origins are not supported and may be blocked.
  • Rate limits: none enforced today; please cache results and avoid abusive volume. Limits may be added later without notice.
  • Cost calculators (trip fuel, bill splitter, etc.) are not available via this API — only the 19 unit converters.

Converter catalog

19 converters · unit ids are case-sensitive.

angle— Angle Converter (Mathematics)

Hub: /converters/angle

degree, gon, gradian, milliradian, minute_arc, radian, second_arc, turn

area— Area Converter (Measurement)

Hub: /converters/area

acre, hectare, sqcm, sqft, sqin, sqkm, sqm, sqmi, sqmm, sqyd

currency— Currency Converter (Finance)

Hub: /converters/currency

aed, ars, aud, brl, cad, chf, clp, cny, cop, czk, dkk, egp, eur, gbp, hkd, huf, idr, ils, inr, jpy, krw, mxn, myr, nok, nzd, php, pkr, pln, ron, rub, sar, sek, sgd, thb, try, usd, zar

data-storage— Data Storage Converter (Digital)

Hub: /converters/data-storage

bit, bluray, byte, cd, dvd, gb, gib, kb, kib, mb, mib, nibble, pb, tb, tib, word

density— Density Converter (Physics)

Hub: /converters/density

g_per_cm3, g_per_liter, kg_per_liter, kg_per_m3, lb_per_ft3, lb_per_gallon_uk, lb_per_gallon_us, lb_per_in3, oz_per_in3

energy— Energy Converter (Physics)

Hub: /converters/energy

btu, calorie, electronvolt, foot_pound, joule, kilocalorie, kilojoule, kilowatt_hour, watt_hour

force— Force Converter (Physics)

Hub: /converters/force

dyne, kilogram_force, kilonewton, kip, newton, pound_force, poundal, ton_force

frequency— Frequency Converter (Physics)

Hub: /converters/frequency

fps, gigahertz, hertz, kilohertz, megahertz, rad_per_second, rpm, terahertz

fuel-economy— Fuel Economy Converter (Automotive)

Hub: /converters/fuel-economy

km_per_gallon_us, km_per_liter, liter_per_100km, miles_per_liter, mpg_uk, mpg_us

illuminance— Illuminance Converter (Physics)

Hub: /converters/illuminance

candela_per_m2, foot_candle, lumen_per_ft2, lumen_per_m2, lux, nox, phot

length— Length Converter (Measurement)

Hub: /converters/length

cm, foot, inch, km, meter, mile, yard

power— Power Converter (Physics)

Hub: /converters/power

btu_per_hour, foot_pound_per_second, horsepower, kilowatt, megawatt, metric_horsepower, ton_refrigeration, watt

pressure— Pressure Converter (Measurement)

Hub: /converters/pressure

atm, bar, inhg, kpa, mbar, mmhg, mpa, pa, psf, psi, torr

speed— Speed Converter (Measurement)

Hub: /converters/speed

c, fps, knot, kph, mach, mph, mps

temperature— Temperature Converter (Measurement)

Hub: /converters/temperature

celsius, fahrenheit, kelvin

time— Time Converter (Measurement)

Hub: /converters/time

day, hour, minute, month, second, week, year

torque— Torque Converter (Physics)

Hub: /converters/torque

dyne_centimeter, foot_pound, inch_pound, kilogram_force_meter, kilonewton_meter, newton_meter, ounce_force_inch

volume— Volume Converter (Measurement)

Hub: /converters/volume

cup, floz, gallon, imp-floz, imp-gallon, imp-pint, l, m3, ml, pint, quart, tbsp, tsp

weight— Weight Converter (Measurement)

Hub: /converters/weight

gram, kg, lb, ounce, short_ton, stone, ton