{
"ok": true,
"data": {
"category": "temperature",
"input": {
"value": 100,
"unit": {
"code": "C",
"name": "degree Celsius"
}
},
"result": {
"value": 212,
"unit": {
"code": "F",
"name": "degree Fahrenheit"
}
},
"formatted": "212 F",
"exact": true,
"note": "Temperatures are converted as absolute readings (offsets applied). For a temperature difference, convert C↔K 1:1 and C↔F by 9/5."
}
}
curl --location --request GET 'https://zylalabs.com/api/15644/unit+conversion+and+formatting+api/42327/convert+a+value+between+two+units+using+get?value=100&from=C&to=F&precision=2' --header 'Authorization: Bearer YOUR_API_KEY'
{
"ok": true,
"data": {
"category": "fuel",
"input": {
"value": 30,
"unit": {
"code": "mpg",
"name": "miles per US gallon"
}
},
"result": {
"value": 7.84,
"unit": {
"code": "L/100km",
"name": "liters per 100 kilometers"
}
},
"formatted": "7.84 L/100km",
"exact": true
}
}
curl --location --request POST 'https://zylalabs.com/api/15644/unit+conversion+and+formatting+api/42328/convert+a+value+between+two+units' --header 'Authorization: Bearer YOUR_API_KEY'
--data-raw '{"value":30,"from":"mpg","to":"L/100km","precision":2}'
{
"ok": true,
"data": {
"categoryCount": 1,
"unitCount": 4,
"categories": [
{
"id": "temperature",
"label": "Temperature (absolute scale values, with offsets)",
"baseUnit": "C",
"units": [
{
"code": "C",
"name": "degree Celsius",
"aliases": [
"°C",
"ºC",
"degC",
"celsius",
"Celsius",
"centigrade"
],
"exact": true
},
{
"code": "F",
"name": "degree Fahrenheit",
"aliases": [
"°F",
"ºF",
"degF",
"fahrenheit",
"Fahrenheit"
],
"exact": true
},
{
"code": "K",
"name": "kelvin",
"aliases": [
"kelvin",
"Kelvin",
"kelvins"
],
"exact": true
},
{
"code": "R",
"name": "degree Rankine",
"aliases": [
"°R",
"degR",
"rankine",
"Rankine"
],
"exact": true
}
]
}
],
"note": "Codes and aliases are matched exactly first, then ignoring case when unambiguous. Data units: B = byte, bit/b = bit; MB = 10^6 bytes, MiB = 2^20 bytes, Mb/Mbit = megabits. Lowercase mb/gb/tb are read as bytes."
}
}
curl --location --request GET 'https://zylalabs.com/api/15644/unit+conversion+and+formatting+api/42329/list+unit+categories+and+codes' --header 'Authorization: Bearer YOUR_API_KEY'
{
"ok": true,
"data": {
"count": 3,
"succeeded": 2,
"failed": 1,
"results": [
{
"index": 0,
"ok": true,
"data": {
"category": "length",
"input": {
"value": 1,
"unit": {
"code": "mi",
"name": "mile"
}
},
"result": {
"value": 1.6093,
"unit": {
"code": "km",
"name": "kilometer"
}
},
"formatted": "1.6093 km",
"exact": true,
"factor": 1.609344
}
},
{
"index": 1,
"ok": true,
"data": {
"category": "data",
"input": {
"value": 1,
"unit": {
"code": "GiB",
"name": "gibibyte (1024^3 B)"
}
},
"result": {
"value": 1.0737,
"unit": {
"code": "GB",
"name": "gigabyte (10^9 B)"
}
},
"formatted": "1.0737 GB",
"exact": true,
"factor": 1.073741824
}
},
{
"index": 2,
"ok": false,
"error": {
"code": "incompatible_units",
"message": "Cannot convert mass (kg) to length (m)."
}
}
]
}
}
curl --location --request POST 'https://zylalabs.com/api/15644/unit+conversion+and+formatting+api/42330/convert+up+to+100+values+in+one+call' --header 'Authorization: Bearer YOUR_API_KEY'
--data-raw '{"precision":4,"items":[{"value":1,"from":"mi","to":"km"},{"value":1,"from":"GiB","to":"GB"},{"value":1,"from":"kg","to":"m"}]}'
{
"ok": true,
"data": {
"input": "3.2 GB",
"category": "data",
"value": 3.2,
"unit": {
"code": "GB",
"name": "gigabyte (10^9 B)"
},
"parts": [
{
"value": 3.2,
"unit": {
"code": "GB",
"name": "gigabyte (10^9 B)"
},
"text": "GB"
}
],
"converted": {
"value": 2.98,
"unit": {
"code": "GiB",
"name": "gibibyte (1024^3 B)"
},
"formatted": "2.98 GiB"
}
}
}
curl --location --request GET 'https://zylalabs.com/api/15644/unit+conversion+and+formatting+api/42331/parse+a+quantity+string+using+get?text=3.2 GB&to=GiB&precision=3' --header 'Authorization: Bearer YOUR_API_KEY'
{
"ok": true,
"data": {
"input": "5 ft 11 in",
"category": "length",
"value": 5.91666666666667,
"unit": {
"code": "ft",
"name": "foot"
},
"parts": [
{
"value": 5,
"unit": {
"code": "ft",
"name": "foot"
},
"text": "ft"
},
{
"value": 11,
"unit": {
"code": "in",
"name": "inch"
},
"text": "in"
}
],
"converted": {
"value": 180.34,
"unit": {
"code": "cm",
"name": "centimeter"
},
"formatted": "180.34 cm"
}
}
}
curl --location --request POST 'https://zylalabs.com/api/15644/unit+conversion+and+formatting+api/42332/parse+a+quantity+string+and+optionally+convert+it' --header 'Authorization: Bearer YOUR_API_KEY'
--data-raw '{"text":"5 ft 11 in","to":"cm"}'
{
"ok": true,
"data": {
"input": {
"value": 0.0042,
"unit": {
"code": "km",
"name": "kilometer"
}
},
"category": "length",
"best": {
"system": "metric",
"value": 4.2,
"unit": {
"code": "m",
"name": "meter"
},
"formatted": "4.2 m"
},
"results": [
{
"system": "metric",
"value": 4.2,
"unit": {
"code": "m",
"name": "meter"
},
"formatted": "4.2 m"
},
{
"system": "imperial",
"value": 13.78,
"unit": {
"code": "ft",
"name": "foot"
},
"formatted": "13.78 ft"
}
],
"note": "The best unit is the largest unit in each system where the absolute value is at least 1."
}
}
curl --location --request GET 'https://zylalabs.com/api/15644/unit+conversion+and+formatting+api/42333/format+a+value+in+the+best+unit+using+get?value=0.0042&unit=km&system=metric,imperial&decimals=2' --header 'Authorization: Bearer YOUR_API_KEY'
{
"ok": true,
"data": {
"input": {
"value": 1536000,
"unit": {
"code": "B",
"name": "byte"
}
},
"category": "data",
"best": {
"system": "iec",
"value": 1.46,
"unit": {
"code": "MiB",
"name": "mebibyte (1024^2 B)"
},
"formatted": "1.46 MiB"
},
"results": [
{
"system": "iec",
"value": 1.46,
"unit": {
"code": "MiB",
"name": "mebibyte (1024^2 B)"
},
"formatted": "1.46 MiB"
},
{
"system": "si",
"value": 1.54,
"unit": {
"code": "MB",
"name": "megabyte (10^6 B)"
},
"formatted": "1.54 MB"
}
],
"note": "The best unit is the largest unit in each system where the absolute value is at least 1."
}
}
curl --location --request POST 'https://zylalabs.com/api/15644/unit+conversion+and+formatting+api/42334/format+a+value+in+the+best+human-friendly+unit' --header 'Authorization: Bearer YOUR_API_KEY'
--data-raw '{"value":1536000,"unit":"B"}'
After signing up, every developer is assigned a personal API access key, a unique combination of letters and digits provided to access to our API endpoint. To authenticate with the Unit Conversion and Formatting API simply include your bearer token in the Authorization header.
| Header | Description |
|---|---|
Authorization
|
Required
Should be Bearer access_key. See "Your API Access Key" above when you are subscribed.
|
No long-term commitment. Upgrade, downgrade, or cancel anytime. Free Trial includes up to 50 requests.
Exact unit conversion for length, mass, volume, temperature, data size (MB and MiB), pressure, energy, fuel economy and more, plus batch, quantity parsing and best-unit formatting.
Exact SI and NIST definitions: 1 in = 2.54 cm, 1 lb = 0.45359237 kg, 1 US gallon = 3.785411784 L, 1 imperial gallon = 4.54609 L, 1 atm = 101325 Pa, 1 BTU (IT) = 1055.05585262 J, and 1 hp = 550 ft·lbf/s. Units without a fixed length, such as the average month and year, are marked exact: false in the response.
As absolute readings with offsets applied, so 100 °C = 212 °F and 0 K = -459.67 °F. Values below absolute zero return a 400. To convert a temperature difference instead, use 1 °C = 1 K = 1.8 °F.
MB, GB, and TB are SI (decimal) units: 1 MB = 1,000,000 bytes. MiB, GiB, and TiB are IEC (binary) units: 1 MiB = 1,048,576 bytes. Codes are case-sensitive where it matters: MB is megabytes and Mb or Mbit is megabits. Lowercase mb, gb, and tb are read as bytes. The format endpoint can show both, for example 1.46 MiB and 1.54 MB.
L/100km is the reciprocal of distance per volume, so the API converts through km/L instead of a fixed factor. For example, 30 mpg (US) is about 7.84 L/100km. US and imperial mpg are separate units (mpg and mpgImp). A value of 0 is rejected because it has no reciprocal.
A number followed by a unit code, symbol, or name, such as 72.5kg, 3.2 GB, -40 °F, 1,234.5 m, 1.5e3 W, or 1 ½ cups. Compound values in one category are summed, such as 5 ft 11 in, 5'11", and 2 hours and 30 minutes. Text is limited to 200 characters. Mixed categories return a 400.
By default, results are rounded to 15 significant digits to remove floating-point noise (so 1 ft is exactly 12 in). Set precision for decimal places (0-15) or significantDigits (1-17). In a batch, top-level settings apply to every item unless an item sets its own.
The batch still returns 200. Each result has ok: true with data, or ok: false with an error code and message, and the response counts succeeded and failed items. A batch can hold up to 100 items.
Categories with a natural unit ladder: data size (SI, IEC, and bits), length, mass, volume, area, time, pressure, energy (including Wh/kWh), power, and angle. It picks the largest unit where the value is at least 1. Temperature, speed, and fuel economy are not scaled; use convert for those.
To obtain your API key, first sign in to your account and navigate to the API you want to use. From the API's Pricing section, choose a plan and complete the subscription process. Once subscribed, return to the API page and you will see your API Access Key displayed at the top of the documentation page. You can use this key to authenticate your requests.
You can’t switch APIs during the free trial. If you subscribe to a different API, your trial will end and the new subscription will start as a paid plan.
The free trial lasts for 7 days and allows you to make up to 50 API requests.
No, the free trial is available only once, so we recommend using it on the API that interests you the most. Most of our APIs offer a free trial, but some may not include this option.
Yes. If the API offers a free trial, you will see a "Free 7-Day Trial" option in its Pricing section. The trial lasts for 7 days and allows up to 50 API requests, enabling you to evaluate the API before subscribing to a paid plan.
Zyla API Hub is like a big store for APIs, where you can find thousands of them all in one place. We also offer dedicated support and real-time monitoring of all APIs. Once you sign up, you can pick and choose which APIs you want to use. Just remember, each API needs its own subscription. But if you subscribe to multiple ones, you'll use the same key for all of them, making things easier for you.
You can monitor your API usage through the response headers included with every request:
x-zyla-api-calls-monthly-used: Shows the total number of API requests you have used during the current billing period.
x-zyla-api-calls-monthly-remaining: Shows the number of API requests you have remaining for the current billing period.
Yes, you can cancel your subscription at any time. Simply go to the Pricing section of the API you're subscribed to and click the "Unsubscribe" button.
Please note that upgrades, downgrades, and cancellations take effect immediately. Once your subscription is canceled, access to the service will end immediately, regardless of any remaining API calls in your quota.
Please have a look at our Refund Policy: https://zylalabs.com/terms#refund