/v1/substance/convert
Requires API key
Convert between mass and volume for a substance
Converts between mass and volume using a substance's reference density, for example litres of ethanol to kilograms. The response includes the substance with its density, conditions, and source, because real density varies with temperature, pressure, and composition. Same-kind conversions (mass to mass) pass straight through. `GET /v1/substance/convert` accepts the same fields as query parameters. Requires the Developer plan or higher.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value
|
string | Yes | Decimal amount as a string (e.g. "1") |
from
|
string | Yes | Mass or volume unit identifier |
to
|
string | Yes | Mass or volume unit identifier |
substance
|
string | Yes | Substance id from GET /v1/substances (e.g. "ethanol") |
decimals
|
integer | No | Round the result to this many fractional places (0-40, half-even). |
format_locale
|
string | No | Language tag such as de-DE. Adds a formatted display string to the result. |
Possible errors
INVALID_REQUEST
·
INVALID_VALUE
·
UNKNOWN_UNIT
·
UNKNOWN_SUBSTANCE
·
INCOMPATIBLE_UNITS
·
OUT_OF_RANGE
·
PLAN_REQUIRED
·
UNAUTHORIZED
·
INVALID_API_KEY
·
RATE_LIMIT_EXCEEDED
·
QUOTA_EXCEEDED