UnifyUnits Developers

Substances

Mass and volume are different kinds of quantity, so litres cannot become kilograms without a density. POST /v1/substance/convert supplies one: pick a substance and convert between any mass unit and any volume unit. GET /v1/substances lists what is available.

The data

  • 55 substances in six categories: metal and alloy, polymer, wood, construction solid, liquid, and gas.
  • Every entry has a reference density in kg/m³, the conditions it applies to (many are NIST radiation-calculation reference values), and its source (NIST, the USDA Forest Products Laboratory, or the Federal Highway Administration) with the date the value was checked. One construction material includes a density range.
  • Food ingredients such as flour or sugar are not included.
These are reference densities, not measurements of your material. Real density changes with temperature, pressure, purity, moisture, and composition, and most entries do not state a temperature or pressure. Gases vary the most. Read the conditions in the response and do not rely on the result where an error would matter, such as safety, dosing, or regulated measurement.

Example

bash
curl "https://api.unifyunits.com/v1/substance/convert" \
  -X POST \
  -H "Authorization: Bearer $UNIFYUNITS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"value":"1","from":"l","to":"kg","substance":"ethanol"}'
json
{
  "data": {
    "input": { "value": "1", "unit": "l" },
    "result": { "value": "0.7893", "unit": "kg" },
    "substance": {
      "id": "ethanol",
      "name": "Ethanol (ethyl alcohol)",
      "category": "liquid",
      "density": { "value": "789.3", "unit": "kg-m3" },
      "conditions": "NIST radiation-calculation reference density; temperature and pressure not specified",
      "source": {
        "organization": "National Institute of Standards and Technology",
        "title": "STAR material composition: Ethyl alcohol",
        "url": "https://physics.nist.gov/cgi-bin/Star/compos.pl?matno=153",
        "accessed_date": "2026-09-13"
      }
    }
  }
}

Rules

  • Units must be mass or volume. Converting mass to mass (or volume to volume) works and ignores the density. Other units return INCOMPATIBLE_UNITS.
  • The math is exact. Up to 40 significant digits are carried between steps, and decimals rounds once at the end.
  • Requires the Developer plan or higher (PLAN_REQUIRED otherwise). Listing substances is available on every plan.
  • A successful conversion uses one conversion from your monthly quota. Failed conversions are free.
  • Unknown ids return UNKNOWN_SUBSTANCE.