Quickstart
Make your first conversion in under a minute. Prefer a language client when you can; use curl for any language or quick checks.
-
Get an API key
Sign in with Google to create a free Bearer API key. Production keys use the
uu_live_prefix. -
Store it securely
Set the key as an environment variable. Never commit it or embed it in client-side code.
bashexport UNIFYUNITS_API_KEY="uu_live_your_key_here" -
Convert with a client (recommended)
Install the v0.1 client for your stack, then convert 1 foot to meters. The clients cover convert, batch, categories, units, and health; use raw HTTP for parse, normalize, currency, substances, unit price,
decimals, andformat_locale. Full guides: JavaScript, Python, PHP.JavaScript / TypeScript
bashnpm install github:unifyunits/unifyunits-js#v0.1.0typescriptimport { UnifyUnits } from "@unifyunits/sdk"; const units = new UnifyUnits({ apiKey: process.env.UNIFYUNITS_API_KEY }); // The client returns untyped JSON; narrow it to the fields you use. const result = (await units.convert({ value: "1", from: "ft", to: "m" })) as { data: { result: { value: string; unit: string } }; }; console.log(result.data.result); // { value: "0.3048", unit: "m" }Python
bashpython -m pip install "unifyunits @ git+https://github.com/unifyunits/[email protected]"pythonimport os from unifyunits import UnifyUnits with UnifyUnits(api_key=os.environ["UNIFYUNITS_API_KEY"]) as client: result = client.convert("1", "ft", "m") print(result["data"]["result"]) # {"value": "0.3048", "unit": "m"}PHP (Laravel)
bashcomposer config repositories.unifyunits-laravel vcs https://github.com/unifyunits/unifyunits-php composer require unifyunits/unifyunits-laravel:^0.1php<?php use UnifyUnits\Laravel\Facades\UnifyUnits; $result = UnifyUnits::convert('1', 'ft', 'm'); echo $result['data']['result']['value']; // "0.3048" -
Or convert with curl
Any language can call the same HTTP contract:
bashcurl "https://api.unifyunits.com/v1/convert?value=1&from=ft&to=m" \ -H "Authorization: Bearer $UNIFYUNITS_API_KEY" -
Read the response
The result is always a decimal string.
1 ft = 0.3048 mexactly.json{ "data": { "input": { "value": "1", "unit": "ft" }, "result": { "value": "0.3048", "unit": "m" }, "category": "length" } } -
Try batch conversion
Up to 100 items per call (curl example):
bashcurl "https://api.unifyunits.com/v1/batch" \ -X POST \ -H "Authorization: Bearer $UNIFYUNITS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"conversions":[{"value":"1","from":"ft","to":"m"},{"value":"32","from":"F","to":"C"}]}'