Unit Conversion API
A free, versioned REST API for deterministic unit conversion — length, weight, speed, angle, data storage, temperature, and currency. Built for developers and AI agents alike.
Quickstart
curl -X POST https://curepdf.com/api/v1/conversions/convert/ \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"category": "weight", "from": "kg", "to": "lb", "value": 25}'
{
"success": true,
"result": {"input": {"value": 25.0, "unit": "kg"}, "output": {"value": 55.1156, "unit": "lb"}},
"conversion": {"category": "weight", "from": "kg", "to": "lb"},
"formula": "lb = kg × 2.2046226218487757",
"formatted_result": "55.1156 lb",
"precision": 6,
"meta": {"api_version": "v1", "timestamp": "2026-01-01T00:00:00Z", "source": {"name": "CurePDF Unit Conversion API"}}
}
Authentication
The two discovery endpoints (category list, category detail) and the AI manifest are public — no key required.
POST /conversions/convert/ requires an API key, sent as a bearer token:
Authorization: Bearer YOUR_API_KEY
An X-API-Key: YOUR_API_KEY header also works, for clients that can't set a custom Authorization scheme. Keys are never accepted via query string.
Endpoints
https://curepdf.com/api/v1/| Method | Path | Auth | Description |
|---|---|---|---|
GET | /conversions/ | None | List every supported category and its unit codes. |
GET | /conversions/{category}/ | None | Full unit metadata (code, name, symbol) for one category. |
POST | /conversions/convert/ | Required | Convert a value from one unit to another within a category. |
GET | /ai/manifest/ | None | Machine-readable discovery manifest for AI agents/tooling. |
POST /conversions/convert/ accepts category, from, to, value (required),
plus optional precision (integer, 0–12, default 6) and mode ("decimal" or "binary", only used by category="data_storage").
Supported Converters
convert/ actually accepts.| Category | Slug | Unit codes |
|---|---|---|
| Length Converter | length |
km, m, dm, cm, mm, um, nm, mi, yd, ft, in, nmi |
| Weight Converter | weight |
t, kg, g, mg, ug, lb, oz, st, us_ton, uk_ton, ct |
| Speed Converter | speed |
mps, kmh, mph, kn, fps, mach |
| Angle Converter | angle |
deg, rad, grad, turn |
| Data Storage Converter | data_storage |
bit, byte, k, m, g, t, p |
| Temperature Converter | temperature |
c, f, k, r, re |
| Currency Converter | currency |
USD, EUR, GBP, INR, JPY, CAD, AUD, CHF, CNY, SGD |
Code Examples
YOUR_API_KEY with a real key — never a placeholder committed to source control.curl -X POST https://curepdf.com/api/v1/conversions/convert/ \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"category": "temperature", "from": "c", "to": "f", "value": 100}'
import requests
resp = requests.post(
"https://curepdf.com/api/v1/conversions/convert/",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"category": "temperature", "from": "c", "to": "f", "value": 100},
)
print(resp.json()["result"]["output"])
const resp = await fetch("https://curepdf.com/api/v1/conversions/convert/", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({ category: "temperature", from: "c", to: "f", value: 100 }),
});
const data = await resp.json();
console.log(data.result.output);
Error Codes
{"success": false, "error": {"code": "...", "message": "..."}}. No stack traces are ever returned.| HTTP | Code | Meaning |
|---|---|---|
| 401 | MISSING_API_KEY | No key was sent on a request that requires one. |
| 401 | INVALID_API_KEY | The key doesn't exist, was revoked, or has expired. |
| 429 | RATE_LIMIT_EXCEEDED | Too many requests in the last 60 seconds for this key. |
| 429 | DAILY_LIMIT_EXCEEDED | This key's daily request cap was reached. |
| 429 | MONTHLY_LIMIT_EXCEEDED | This key's monthly request cap was reached. |
| 400 | UNSUPPORTED_CATEGORY | The category isn't one of the values from GET /conversions/. |
| 400 | UNSUPPORTED_UNIT | The from/to unit isn't valid for the given category. |
| 400 | INVALID_VALUE | value is non-finite, too large, or (for temperature) below absolute zero. |
| 400 | INVALID_PRECISION | precision is outside the 0–12 range. |
| 400 | PARSE_ERROR | The request body isn't valid JSON. |
| 404 | NOT_FOUND | The category in GET /conversions/{category}/ doesn't exist. |
| 503 | SERVICE_UNAVAILABLE | Currency conversion requested, but live rates aren't currently available. |
Rate Limits
Every key has its own per-minute, daily, and monthly caps, set by CurePDF staff when the key is issued — there's no single global limit. A capped value of 0 means unlimited for that window. Limits are checked in that order (per-minute, then daily, then monthly), so the response tells you exactly which one was hit.
Getting an API Key
API keys are currently issued by CurePDF staff rather than through self-serve signup. Contact us with what you're building and your expected request volume, and we'll set you up with a key and reasonable limits.
Once issued, treat the key like a password: it's shown once, at creation, and only a hash is stored afterward — if it's lost, ask us to revoke it and issue a new one.