UnifyUnits Developers
POST /v1/parse Requires API key

Parse a written measurement

Deterministically parses text such as `12.5 kilograms`, `100km/h`, or `5 ft 11 in` into a canonical value and unit. Optional `to` converts the parsed measurement in the same request. Ambiguous regional words return `AMBIGUOUS_UNIT` with candidates.

Prefer a language client when available: JavaScript / TypeScript, Python, or PHP (Laravel). Samples on this page stay raw HTTP so they match the OpenAPI contract.

Parameters

Name Type Required Description
text string Yes Written measurement (e.g. "5 ft 11 in" or "12.5 kg")
to string No Optional target unit identifier for an immediate convert
decimals integer No When `to` is set, round the converted result to this many fractional places (0-40, half-even).
format_locale string No Language tag such as de-DE. Adds a formatted display string (for example 1,5 km) to the result next to the exact value. Requires the Developer plan or higher.

Possible errors

PLAN_REQUIRED · INVALID_VALUE · UNKNOWN_UNIT · AMBIGUOUS_UNIT · INCOMPATIBLE_UNITS · OUT_OF_RANGE · UNAUTHORIZED · INVALID_API_KEY · RATE_LIMIT_EXCEEDED

All endpoints · Error reference

cURL
curl "https://api.unifyunits.com/v1/parse" \
  -X POST \
  -H "Authorization: Bearer $UNIFYUNITS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"5 ft 11 in","to":"in","decimals":0}'

Response 200

json
{
  "data": {
    "parsed": { "value": "1.8034", "unit": "m", "category": "length" },
    "result": { "value": "71", "unit": "in" }
  }
}