UnifyUnits Developers

Quickstart

Make your first conversion in under a minute. Prefer a language client when you can; use curl for any language or quick checks.

  1. Get an API key

    Sign in with Google to create a free Bearer API key. Production keys use the uu_live_ prefix.

    Create your API key →

  2. Store it securely

    Set the key as an environment variable. Never commit it or embed it in client-side code.

    bash
    export UNIFYUNITS_API_KEY="uu_live_your_key_here"
  3. 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, and format_locale. Full guides: JavaScript, Python, PHP.

    JavaScript / TypeScript

    bash
    npm install github:unifyunits/unifyunits-js#v0.1.0
    typescript
    import { 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

    bash
    python -m pip install "unifyunits @ git+https://github.com/unifyunits/[email protected]"
    python
    import 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)

    bash
    composer config repositories.unifyunits-laravel vcs https://github.com/unifyunits/unifyunits-php
    composer require unifyunits/unifyunits-laravel:^0.1
    php
    <?php
    use UnifyUnits\Laravel\Facades\UnifyUnits;
    
    $result = UnifyUnits::convert('1', 'ft', 'm');
    echo $result['data']['result']['value']; // "0.3048"
  4. Or convert with curl

    Any language can call the same HTTP contract:

    bash
    curl "https://api.unifyunits.com/v1/convert?value=1&from=ft&to=m" \
      -H "Authorization: Bearer $UNIFYUNITS_API_KEY"
  5. Read the response

    The result is always a decimal string. 1 ft = 0.3048 m exactly.

    json
    {
      "data": {
        "input":  { "value": "1",      "unit": "ft" },
        "result": { "value": "0.3048", "unit": "m"  },
        "category": "length"
      }
    }
  6. Try batch conversion

    Up to 100 items per call (curl example):

    bash
    curl "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"}]}'