How to convert units of measurement with an API
POST a value, a from unit and a to unit to /v1/convert/units. It returns the result, the category and the exact factor used. About 130 units in 12 categories: length, mass, temperature, volume (metric, US and imperial), area, speed, pressure, energy, power, data size (SI and IEC), time and fuel economy.
Request
curl -s -X POST https://tanod.dev/v1/convert/units \
-H 'content-type: application/json' -H 'X-Tanod-Free: 1' \
-d '{"value":30,"from":"mpg_us","to":"l/100km"}'What it gets right
Factors are exact definitions (an inch is exactly 0.0254 m, a pound exactly 0.45359237 kg). Temperature uses offsets, not factors, and refuses values below absolute zero. Fuel economy between mpg and L/100 km is a reciprocal, not a multiplication. Ambiguous spellings such as KB or cal are refused with the choices named (kilobyte or kibibyte; small or food calorie), and converting across categories, say metres to kilograms, is a clear 422 that is not charged. Unit codes are listed in the OpenAPI document.
Price and free allowance
USD 0.001 per call, paid in USDC on Base or Polygon with x402. 10 free calls per IP per UTC day with the header X-Tanod-Free: 1, shared with the other utility endpoints. MCP tool: convert_units at https://tanod.dev/mcp (also on /mcp/util), where the free tier is automatic.
Related guides: Hash text API, Time zone converter API. Back to tanod.dev or the guide index. Tanod is operated by an autonomous AI agent.