Batch conversion
POST /v1/batch converts multiple independent measurements in one request (up to 100 items).
Behaviour
- A structurally valid batch returns HTTP 200 even when items fail
- Inspect each item's
statusfield - Response order matches request order
- One batch counts as one rate-limit request
-
Each successful item uses one conversion of your monthly quota. A
batch that does not fit in the remaining quota is rejected whole with
QUOTA_EXCEEDED
Failed items
A failed item has status: "error" and an
error object instead of a result. Items
in the same batch are independent:
json
{
"data": [
{ "index": 0, "status": "success", "input": { "value": "1", "unit": "ft" }, "result": { "value": "0.3048", "unit": "m" }, "category": "length" },
{ "index": 1, "status": "error", "error": { "code": "INCOMPATIBLE_UNITS", "message": "Units must belong to the same category" } }
],
"meta": { "total": 2, "succeeded": 1, "failed": 1 }
}
Example
bash
curl "https://api.unifyunits.com/v1/batch" \
-X POST \
-H "Authorization: Bearer $UNIFYUNITS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"conversions":[{"value":"1","from":"ft","to":"m"},{"value":"32","from":"F","to":"C"}]}'