UnifyUnits Developers
POST /v1/convert Requires API key

Single conversion via JSON body

Identical conversion behaviour to GET /v1/convert, using a JSON request body instead of query parameters. Both methods share the same conversion engine.

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
value string Yes Measurement value as a decimal string
from string Yes Source unit identifier
to string Yes Target unit identifier
decimals integer No Round the result to this many fractional decimal places (0-40, half-even). Omit for the full engine precision string.
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 · INVALID_REQUEST · UNSUPPORTED_MEDIA_TYPE · PAYLOAD_TOO_LARGE · UNAUTHORIZED · INVALID_API_KEY · RATE_LIMIT_EXCEEDED · QUOTA_EXCEEDED · SERVICE_UNAVAILABLE

All endpoints · Error reference

cURL
curl "https://api.unifyunits.com/v1/convert" \
  -X POST \
  -H "Authorization: Bearer $UNIFYUNITS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "value": "1",
    "from": "ft",
    "to": "m"
  }'

Response 200

json
{
  "data": {
    "input": { "value": "1", "unit": "ft" },
    "result": { "value": "0.3048", "unit": "m" },
    "category": "length"
  }
}