Skip to main content
Developer API

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

Convert 25 kilograms to pounds in one request.
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}'
Response
{
  "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.

Keys are staff-issued, not self-serve yet — see Getting an API Key below.

Endpoints

Base URL: https://curepdf.com/api/v1/
MethodPathAuthDescription
GET/conversions/NoneList every supported category and its unit codes.
GET/conversions/{category}/NoneFull unit metadata (code, name, symbol) for one category.
POST/conversions/convert/RequiredConvert a value from one unit to another within a category.
GET/ai/manifest/NoneMachine-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

Only categories actually implemented and tested are ever listed here — this table is generated live from the same registry the API itself reads, so it can't drift out of sync with what convert/ actually accepts.
CategorySlugUnit 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

The same request in three languages. Replace YOUR_API_KEY with a real key — never a placeholder committed to source control.
cURL
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}'
Python
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"])
JavaScript
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

Every error uses the same shape: {"success": false, "error": {"code": "...", "message": "..."}}. No stack traces are ever returned.
HTTPCodeMeaning
401MISSING_API_KEYNo key was sent on a request that requires one.
401INVALID_API_KEYThe key doesn't exist, was revoked, or has expired.
429RATE_LIMIT_EXCEEDEDToo many requests in the last 60 seconds for this key.
429DAILY_LIMIT_EXCEEDEDThis key's daily request cap was reached.
429MONTHLY_LIMIT_EXCEEDEDThis key's monthly request cap was reached.
400UNSUPPORTED_CATEGORYThe category isn't one of the values from GET /conversions/.
400UNSUPPORTED_UNITThe from/to unit isn't valid for the given category.
400INVALID_VALUEvalue is non-finite, too large, or (for temperature) below absolute zero.
400INVALID_PRECISIONprecision is outside the 0–12 range.
400PARSE_ERRORThe request body isn't valid JSON.
404NOT_FOUNDThe category in GET /conversions/{category}/ doesn't exist.
503SERVICE_UNAVAILABLECurrency 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.