# Unit Converter API

> Unit Converter converts values between 200 units across 24 measures, from length, mass and volume to speed, pressure, data size, energy and electrical units. Pass a numeric value with source and target units (codes such as lb or km/h, or everyday names such as pounds, mph or °F) to get the converted result and unit abbreviations. On paid plans, precision sets the decimal places and conversions=true adds the value in every unit of the same measure.

**Endpoint:** `GET https://api.apiverve.com/v1/unitconverter`  
**Category:** Data Conversion  
**Cost:** 1 credit per call  
**Canonical page:** https://apiverve.com/marketplace/unitconverter

## Overview

A unit conversion API that replaces hand-maintained conversion tables in your code. It covers 200 units across 24 measures, so the everyday conversions are one call each: liters to gallons, miles per hour to kilometers per hour, Celsius to Fahrenheit, megabytes to gigabytes, psi to bar, pounds to kilograms, stone to kilograms, kilocalories to kilojoules, horsepower to kilowatts, inches of mercury to hectopascals, mpg to liters per 100 km, and kilowatt-hours to joules. Units can be sent as codes or as everyday names, plurals and abbreviations in any casing, so lbs, pounds, KG, mph and °F all work. Beyond length, area, mass, volume and temperature it handles time, speed, pace, pressure, digital storage, parts per million, frequency, angles, illuminance, volume flow rate and electrical units from volts and amperes to watts and kilowatt-hours. Results are rounded to 2 decimal places, and results under 1 keep 4 significant figures so small conversions never round to zero. On paid plans, precision returns up to 10 decimal places, so very small results no longer round to zero, and conversions=true returns the same value in every unit of its measure in one call, such as a mass in micrograms through metric tons.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl "https://api.apiverve.com/v1/unitconverter?value=100&from=lb&to=kg&precision=4&conversions=true" \
  -H "x-api-key: YOUR_API_KEY"
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `value` | number | Yes | The value to convert |
| `from` | string | Yes | The unit to convert from: a code such as lb, km/h or C, or a common name, plural or abbreviation such as pounds, lbs, mph, feet, tbsp or °F (any casing) |
| `to` | string | Yes | The unit to convert to, in the same forms as from |
| `precision` | integer | No | Decimal places to round results to, between 0 and 10. Without it, results are rounded to 2 decimal places and results under 1 keep 4 significant figures. range 0-10. Premium field |
| `conversions` | boolean | No | Also return the value converted into every unit of the same measure. default false |

## Response fields

- `result` — object · The conversion result. The numeric value is nested at result.result; result.from and result.to echo the units
  - `result.result` — number · Converted numeric value in target units
  - `result.from` — string · Original value with source unit abbreviation
  - `result.to` — string · Target unit abbreviation for conversion
- `unitDefinitions` — object · The full definitions of the source and target units
  - `unitDefinitions.from` — object · Definition of the source unit, including its singular and plural names
    - `unitDefinitions.from.abbr` — string · Source unit abbreviation code · (premium)
    - `unitDefinitions.from.measure` — string · Physical quantity being measured from · (premium)
    - `unitDefinitions.from.system` — string · Measurement system of source unit · (premium)
    - `unitDefinitions.from.singular` — string · Singular name of source unit · (premium)
    - `unitDefinitions.from.plural` — string · Plural name of source unit · (premium)
  - `unitDefinitions.to` — object · Definition of the target unit, including its singular and plural names
    - `unitDefinitions.to.abbr` — string · Target unit abbreviation code · (premium)
    - `unitDefinitions.to.measure` — string · Physical quantity being measured to · (premium)
    - `unitDefinitions.to.system` — string · Measurement system of target unit · (premium)
    - `unitDefinitions.to.singular` — string · Singular name of target unit · (premium)
    - `unitDefinitions.to.plural` — string · Plural name of target unit · (premium)
- `conversions` — object · With conversions=true, the value in every unit of the same measure, keyed by unit abbreviation and rounded to precision · (premium)
  - `conversions.mcg` — number · (premium)
  - `conversions.mg` — number · (premium)
  - `conversions.g` — number · (premium)
  - `conversions.kg` — number · (premium)
  - `conversions.mt` — number · (premium)
  - `conversions.oz` — number · (premium)
  - `conversions.lb` — number · (premium)
  - `conversions.t` — number · (premium)

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "result": {
      "result": 45.36,
      "from": "100 lb",
      "to": "kg"
    },
    "unitDefinitions": {
      "from": {
        "abbr": "lb",
        "measure": "mass",
        "system": "imperial",
        "singular": "Pound",
        "plural": "Pounds"
      },
      "to": {
        "abbr": "kg",
        "measure": "mass",
        "system": "metric",
        "singular": "Kilogram",
        "plural": "Kilograms"
      }
    },
    "conversions": {
      "mcg": 45359200000,
      "mg": 45359200,
      "g": 45359.2,
      "kg": 45.36,
      "mt": 0.05,
      "oz": 1600,
      "lb": 100,
      "t": 0.05
    }
  }
}
```

## Use cases

- **Measurement Converters** — Convert measurements such as weight, length, area, temperature, and more by using the Unit Converter API. Use the API to convert units between different systems
- **Unit Standardization** — Standardize units across different systems by using the Unit Converter API. Convert units to a common standard for consistency and compatibility
- **Unit Calculation** — Perform unit calculations by using the Unit Converter API to convert units in mathematical operations. Use the API to simplify unit conversions in calculations

## SDKs

- **npm** — `npm install @apiverve/unitconverter` (https://www.npmjs.com/package/@apiverve/unitconverter)
- **PyPI** — `pip install apiverve-unitconverter` (https://pypi.org/project/apiverve-unitconverter/)
- **NuGet** — `dotnet add package APIVerve.API.UnitConverter` (https://www.nuget.org/packages/APIVerve.API.UnitConverter)
- **Source** — https://github.com/apiverve/unitconverter-api

## More

- Full reference: https://docs.apiverve.com/ref/unitconverter
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
