Unit Conversion API
11 categories
100+ units
Batch: 50

Convert any unit.To any other.

Length, mass, volume, temperature, time, digital, speed, area, energy, power, pressure. 100+ units across 11 categories — single conversion or batches of 50. Precision dial 0–15.

11 · categories100+ · units0–15 · precision50 · per batch

Why Unit Conversion API

Measurements, made boring.

11 Categories
Length, mass, volume, temperature, time, digital, speed, area, energy, power, pressure — every measurement type you'll need.
100+ Units
Backed by the convert-units library. mm to mi, mg to ton, °C to K, L to gal — all the common abbreviations.
Precision Control
Optional precision parameter (0–15 decimal places). Round to the level your downstream system actually needs.
Reverse Flag
Set reverse=true to swap from/to without rewriting your URL — handy for symmetric workflows.
Discoverable
Two info endpoints: `/categories` lists every category, `/units/:category` lists every unit identifier in it.
GET or POST
GET with query params for quick tests, POST with a JSON body or array for batch jobs (up to 50 per call).

/api/v1/unit-conversion

Endpoints, at a glance.

One conversion route, two discovery routes, two ops routes. Mix GET and POST as your tooling prefers.

GET / POST/unit-conversion/convert
Single conversion
Convert one value from one unit to another. POST also accepts a JSON array for batch.
PRIMARY
GET/unit-conversion/batch
Batch conversion (≤50)
URL-encoded JSON array via the `conversions` query parameter. Up to 50 items.
GET/unit-conversion/categories
List categories
Returns all 11 measurement categories supported by the service.
GET/unit-conversion/units/:category
Units in category
Returns every valid unit identifier inside a given category.
GET/health
Service health
Status, version, uptime. Root / redirects here.
GET/metrics
Prometheus metrics
Conversion counters, processing durations, and category distribution.
ParameterTypeRequiredDescription
fromstringyesSource unit identifier (e.g. "kg", "m", "°C").
tostringyesTarget unit identifier — must be in the same category.
valuenumberyesNumeric value to convert. Range: −1e15 to 1e15.
precisionintegernoDecimal places for result rounding (0–15). Default: no rounding.
reversebooleannoSwap from/to (default false). Handy for symmetric workflows.
api_keystringyesAPI key via query string. Alternatively pass as x-api-key header.

Requests & responses.

Use GET for quick conversions in tooling, POST for batched workloads.

Single conversion
5 kg → 11.02 lb at precision 2.
GET https://datpaq.com/api/v1/unit-conversion/convert?api_key=YOUR_API_KEY\
  &from=kg&to=lb&value=5&precision=2
Batch (≤50)
Send an array, get an array. Same order, same indices.
POST https://datpaq.com/api/v1/unit-conversion/convert
Content-Type: application/json

[
  { "from": "km", "to": "mi", "value": 10, "precision": 4 },
  { "from": "L",  "to": "ml", "value": 3 },
  { "from": "C",  "to": "F",  "value": 25, "precision": 1 }
]
Health
https://datpaq.com/api/v1/unit-conversion/health
Metrics
https://datpaq.com/api/v1/unit-conversion/metrics

Error reference

Predictable errors, always structured.

Every error response includes a correlationId for request tracing and a clear error message.

400Missing Parameters
Required parameters not provided. Include from, to, and value for every conversion.
400Unknown Unit
Unit identifier not recognized. Hit /units/:category to discover valid identifiers for that category.
400Incompatible Units
From/to units must be in the same category. "kg" ↔ "m" will return an error.
400Invalid Precision
Precision must be an integer between 0 and 15. Out-of-range values are rejected.
400Batch Size Exceeded
More than 50 conversions in a single batch. Split into smaller batches.
401Unauthorized
API key missing or invalid. Pass api_key as a query param or x-api-key as a header.
Example error response
{
  "success": false,
  "error": "Incompatible unit types: 'kg' ↔ 'm'",
  "correlationId": "conv-error123"
}

FAQ

API questions developers ask first.

How do I authenticate with this API?

Create an API key in your Datpaq dashboard and send it with each request as a bearer token in the Authorization header.

Is there a free tier?

Yes. Datpaq APIs include a free tier for building, testing, and small production workloads before you move to a paid plan.

What format do requests and responses use?

Datpaq APIs use REST over HTTPS and return JSON by default. Endpoint docs show the supported methods, query parameters, request bodies, and response fields.

Where can I see limits and errors?

Each API documents rate limits, validation rules, and error responses in the landing page and API docs so integrations can retry and fail cleanly.

Convert anything to anything.

11 categories, 100+ unit identifiers, precision dial 0-15. One GET for ad-hoc, one POST for batches of 50.