Search by task, endpoint, field, or error.
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
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
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?
{
"measure": "5 ft 11 in",
"valid": true,
"type": "length",
"amount": "180.34",
"unit": "cm",
"reason": null,
"choices": []
}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?
{
"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.
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?
{
"measure": "180",
"valid": false,
"type": null,
"amount": null,
"unit": null,
"reason": "missing_unit",
"choices": []
}Find compatible units
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 tag | Language |
|---|---|
| en | American English |
| zh-Hans | 简体中文 |
| fr | français (France) |
| de | Deutsch |
| it | italiano |
| ja | 日本語 |
| ko | 한국어 |
| es | español de España |
| ar | العربية |
| bg | български |
| ca | català |
| hr | hrvatski |
| cs | čeština |
| da | dansk |
| nl | Nederlands |
| fi | suomi |
| el | Ελληνικά |
| he | עברית |
| hi | हिन्दी |
| hu | magyar |
| id | Indonesia |
| kk | қазақ тілі |
| ms | Melayu |
| nb | norsk bokmål |
| pl | polski |
| pt | português (Brasil) |
| ro | română |
| ru | русский |
| sk | slovenčina |
| sv | svenska |
| th | ไทย |
| tr | Türkçe |
| uk | українська |
| vi | Tiếng Việt |
| zh-Hant | 繁體中文 |
| en-AU | Australian English |
| en-GB | British English |
| fr-CA | français canadien |
| es-419 | español latinoamericano |
| pt-PT | português europeu |
| zh-Hant-HK | 繁體中文(中國香港特別行政區) |
Build with Measure
All tutorials →Questions? Email