POST /v1/core/unit-convert
Unit converter
Length, mass, volume, temperature, data and speed, with the arithmetic done exactly.
Convert between units now No key, no code — 1 credit either way.
curl -X POST "$DOATHING_API/v1/core/unit-convert" \
-H "x-api-key: $DOATHING_KEY" \
-H "content-type: application/json" \
-d '{"value": 100, "from": "c", "to": "f"}'
Length, mass, volume, temperature, data and speed, with the arithmetic done exactly.
Convert values between length, mass, volume, temperature, data-size, speed and time units.
Response
The result carries your remaining balance alongside it, so you can track spend without a second call.
{
"result": 212,
"from": "c",
"to": "f",
"dimension": "temperature",
"request_id": "37f01edb-0163-42a1-ac51-0acaef979800",
"credits_remaining": 96
}
Cost
1 credit per call, whether it is run from the site or from the API — the credential differs, the price does not. A new account starts with 20 credits.
A rejected request still costs a credit: the authorizer decrements before the tool validates. A call rejected for a missing or invalid key is free.
Parameters
Generated from the endpoint’s own validation, so this is exactly what it accepts. A body field goes at the top level; an option goes inside options.
| Name | In | Type | Default | Notes |
|---|---|---|---|---|
| value * | body | number | — | The number to convert. |
| from * | body | string | — | A unit such as km, kg, c or gib. one of b, c, cm, cup, d, f, floz, fps, ft, g, gal, gb, gib, h, in, k, kb, kg, kib, km, kmh, kn, l, lb, m, m3, mb, mg, mi, mib, min, ml, mm, mph, mps, ms, nmi, oz, pt, qt, s, st, t, tb, tbsp, tib, tsp, wk, yd |
| to * | body | string | — | A unit of the same kind — converting mass to length is refused. one of b, c, cm, cup, d, f, floz, fps, ft, g, gal, gb, gib, h, in, k, kb, kg, kib, km, kmh, kn, l, lb, m, m3, mb, mg, mi, mib, min, ml, mm, mph, mps, ms, nmi, oz, pt, qt, s, st, t, tb, tbsp, tib, tsp, wk, yd |
| precision | options | integer | 10 | Decimal places in the result. 0 to 15 |