← Docs

Measurement API

Measurements in. A decimal amount and a consistent unit out.

Pass a measurement, including its unit. Mixed values such as 5 ft 11 in become one decimal amount. Add to to choose a compatible target; omit it for the standard unit of that measurement type.

Every conversion uses one pooled request. Amounts are decimal strings: preserve the string for display, or use a decimal library for further arithmetic.

Parse and convert

GET
api.parseapi.com/measure/{measure}
Parse a measurement and optionally convert it
Explore
Parameters 4
measurestring · path · required

A measurement including units; URL-encode the complete value

tostring · query · optional

Compatible target unit. Use /measure/units for canonical unit identifiers

localestring · query · optional

Explicit locale for decimal and grouping punctuation, such as en-US or de-DE. Does not choose US or imperial units

systemstring · query · optional

Explicit meaning for a unit shared by US customary and imperial systems

Values: us, imperial

Run uses the free demo on API 2.0.0. Copied code uses your API key when signed in, or YOUR_API_KEY when signed out.

import { parseAPI } from '@parseapi/sdk';

const parse = parseAPI("YOUR_API_KEY");
const result = await parse.measure("5 ft 11 in", { to: "cm" });
console.log(result);

Run on your server with a secret key. Calling from a browser or app?

Example response
{
  "measure": "5 ft 11 in",
  "valid": true,
  "type": "length",
  "amount": "180.34",
  "unit": "cm",
  "reason": null,
  "choices": []
}

Run uses the free demo on API 2.0.0. Copied code uses your API key when signed in, or YOUR_API_KEY when signed out.

import { parseAPI } from '@parseapi/sdk';

const parse = parseAPI("YOUR_API_KEY");
const result = await parse.measure("2.5 kg", { to: "g" });
console.log(result);

Run on your server with a secret key. Calling from a browser or app?

Example response
{
  "measure": "2.5 kg",
  "valid": true,
  "type": "mass",
  "amount": "2500",
  "unit": "g",
  "reason": null,
  "choices": []
}

Response fields

measure
The measurement supplied by the caller
valid
Whether the measurement is understood without guessing
type
Measurement type, such as length, mass, or temperature; null when unresolved
amount
Decimal string in the returned unit, up to 18 significant digits rounded half away from zero. Null when invalid. Keep it as a string or use a decimal library when precision matters
unit
Canonical target unit, or the standard unit for this type when to is omitted
reason
Null when valid. Otherwise ambiguous_unit, unknown_unit, invalid_measure, ambiguous_number, or missing_unit
choices
Available unit interpretations as {unit, name} objects; empty when no choice is available

Make context explicit

locale controls how number punctuation is read. system=us or system=imperial disambiguates units shared by those systems. Neither is inferred from an IP address, browser, or account preference.

Unknown and ambiguous input returns HTTP 200 with valid: false. Read reason and display choices when present. A missing unit is not an invitation to infer one. An unsupported or incompatible target is an HTTP 400 request error.

Amounts use up to 18 significant digits, rounded half away from zero, with trailing fractional zeroes omitted. Keep the decimal string when storing the result; converting it to a floating-point number can lose precision. Unit discovery returns canonical codes. URL-encode the entire measurement, including slash and plus.

Run uses the free demo on API 2.0.0. Copied code uses your API key when signed in, or YOUR_API_KEY when signed out.

import { parseAPI } from '@parseapi/sdk';

const parse = parseAPI("YOUR_API_KEY");
const result = await parse.measure("180");
console.log(result);

Run on your server with a secret key. Calling from a browser or app?

Example response
{
  "measure": "180",
  "valid": false,
  "type": null,
  "amount": null,
  "unit": null,
  "reason": "missing_unit",
  "choices": []
}

Find compatible units

GET
api.parseapi.com/measure/units
Search the supported unit catalog
Explore
Parameters 4
qstring · query · optional

Search unit names, identifiers, or aliases

typestring · query · optional

Filter a measurement type, such as length

unitstring · query · optional

Return units compatible with this canonical unit

langstring · query · optional

Display language as one BCP 47 tag, such as fr or zh-Hant. Changes supported display labels only; IDs, codes, native names, facts, parsing and deep access stay unchanged. Omit for the original response. Unsupported regions use the supported language base; unsupported languages or scripts use English. Missing labels retain their source value. Accept-Language is not read automatically. Available on the current API contract; frozen 1.0.0 is unchanged.

Use ?q=meter to search, ?type=length for one measurement type, or ?unit=m to list compatible target units. Each row has unit, name, type, and an aliases array. Use the canonical unit in subsequent calls.

Conversion boundaries

Convert within supported measurement types. Mass to volume needs density; electrical current to power needs more than a unit change. Calendar months, currencies, substance-specific concentrations, and other conversions needing additional context are outside this lookup. Use °C or °F for absolute temperatures and delta_C or delta_F for differences. Absolute temperatures cannot be mixed with other units. Symbols are case-sensitive: MB and Mb differ. Unsupported expressions stay unresolved.

Display language

Pass lang with a language tag such as fr, pt-BR, or zh-Hant. units[].name on /measure/units, for 90 of the 527 current units with an exact source mapping. Unit symbols, aliases, searches and measurement parsing stay unchanged; locale still controls input number punctuation.

Omitting lang preserves the original response. Codes, IDs, numeric facts and native-name fields stay unchanged. Missing translations keep their existing source value; unknown values stay null. A preserved name_local may equal the translated name.

Send a chosen browser preference explicitly, for example { lang: navigator.language } in your JavaScript SDK options. The API does not read Accept-Language automatically. Unsupported regions fall back to their supported base language; unsupported languages or scripts use English. Empty, invalid or repeated tags return 400.

Content-Language identifies languages used in translated display fields and known English fallbacks. This option follows the current API contract. Requests selecting frozen 1.0.0 retain that contract. Select API 2.0.0 to use display language.

41 display language choices
Language tagLanguage
enAmerican English
zh-Hans简体中文
frfrançais (France)
deDeutsch
ititaliano
ja日本語
ko한국어
esespañol de España
arالعربية
bgбългарски
cacatalà
hrhrvatski
csčeština
dadansk
nlNederlands
fisuomi
elΕλληνικά
heעברית
hiहिन्दी
humagyar
idIndonesia
kkқазақ тілі
msMelayu
nbnorsk bokmål
plpolski
ptportuguês (Brasil)
roromână
ruрусский
skslovenčina
svsvenska
thไทย
trTürkçe
ukукраїнська
viTiếng Việt
zh-Hant繁體中文
en-AUAustralian English
en-GBBritish English
fr-CAfrançais canadien
es-419español latinoamericano
pt-PTportuguês europeu
zh-Hant-HK繁體中文(中國香港特別行政區)

Build with Measure

All tutorials →

Questions? Email