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
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.
Build with Measure
All tutorials →Questions? Email