{"id":"money-minor-units-convert","version":"1.0.0","description":"Convert a decimal money amount to integer minor units (cents, fils, yen) or back, using the ISO 4217 exponent.","supported_operations":["convert dollars to cents","12.345 KWD in minor units","yen amount to minor units","KWD three decimals to fils","cents to dollars string","amount in smallest currency unit for a payment API","minor units to decimal amount","round amount to currency precision then convert to cents"],"unsupported_operations":["exchange rate conversion between currencies","currency symbol or locale number formatting","cash rounding to 0.05 or other increments","amounts given as JSON numbers or scientific notation"],"semantics":["direction to_minor: amount is a decimal string in major units and the result minor_units is amount x 10^scale as an integer string. direction from_minor: amount must be an integer string of minor units (a fraction part such as \"12.0\" is invalid_input, reason not_integer) and the output amount is minor_units / 10^scale with exactly scale fraction digits.","Exactly one of currency or scale is required. currency is a 3-letter ISO 4217 code (case-insensitive, echoed upper-case) that must be active with a numeric minor unit (USD 2, JPY 0, KWD 3, CLF 4); unknown, historic (HRK, SLL, ANG) and minor-unit-less codes (XAU, XDR, XXX) are unsupported_input. scale is an integer 0..18 for non-ISO units and then currency is null.","Excess precision is judged on value: to_minor accepts \"12.500\" at scale 2 but \"12.505\" without rounding is invalid_input with details.reason excess_precision. When rounding is given, an amount x 10^scale that is not an integer is rounded once by that mode and exact is false.","The ten rounding modes act on the exact value: half_even, half_up (ties away from zero: -2.5 gives -3), half_down, half_ceiling (-2.5 gives -2), half_floor, up, down, ceiling, floor, and unnecessary (an inexact result is not_computable, reason rounding_necessary). rounding is validated when present in either direction but has no effect on from_minor.","Zero has no sign: \"-0\" and results that round to zero give minor_units \"0\" and amount \"0.00\" (scale-formatted), never \"-0\".","Decimal strings match ^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$ with at most 60 digits and 40 fraction digits (invalid_input); a string over 62 characters is limit_exceeded, checked before the syntax. A JSON number is invalid_input.","Data is the pinned ISO 4217 snapshot named by data_version; no clock, locale or network.","Disclaimer: arithmetic calculation only; not financial, tax, legal, or investment advice."],"limits":{"max_decimal_chars":62,"max_decimal_digits":60,"max_fraction_digits":40,"max_scale":18},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["amount","direction"],"properties":{"amount":{"type":"string","minLength":1,"maxLength":62,"pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"to_minor: money amount as a decimal string (major units). from_minor: an integer string of minor units (no fraction part)."},"direction":{"type":"string","enum":["to_minor","from_minor"]},"currency":{"type":"string","minLength":3,"maxLength":3,"pattern":"^[A-Za-z]{3}$","description":"Active ISO 4217 alphabetic code with a minor unit (case-insensitive). Give exactly one of currency or scale."},"scale":{"type":"integer","minimum":0,"maximum":18,"description":"Fraction digits for non-ISO units. Give exactly one of currency or scale."},"rounding":{"type":"string","enum":["half_even","half_up","half_down","half_ceiling","half_floor","up","down","ceiling","floor","unnecessary"],"description":"Only used by to_minor when amount has more precision than the scale. If omitted then, invalid_input excess_precision."}}},"output_schema":{"type":"object","additionalProperties":false,"required":["amount","minor_units","currency","scale","exact","data_version"],"properties":{"amount":{"type":"string","minLength":1,"maxLength":400,"pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Amount in major units with exactly `scale` fraction digits (after rounding for to_minor)."},"minor_units":{"type":"string","minLength":1,"maxLength":400,"pattern":"^-?(0|[1-9][0-9]*)$"},"currency":{"type":["string","null"],"pattern":"^[A-Z]{3}$"},"scale":{"type":"integer","minimum":0,"maximum":18},"exact":{"type":"boolean","description":"false only when to_minor rounded a non-integer number of minor units."},"data_version":{"type":"string","const":"iso4217-datasets-7cdc784-2026-07-27"}}},"examples":[{"input":{"amount":"19.99","direction":"to_minor","currency":"USD"},"output":{"amount":"19.99","minor_units":"1999","currency":"USD","scale":2,"exact":true,"data_version":"iso4217-datasets-7cdc784-2026-07-27"}},{"input":{"amount":"2500","direction":"from_minor","currency":"jpy"},"output":{"amount":"2500","minor_units":"2500","currency":"JPY","scale":0,"exact":true,"data_version":"iso4217-datasets-7cdc784-2026-07-27"}},{"input":{"amount":"-2.5","direction":"to_minor","scale":0,"rounding":"half_up"},"output":{"amount":"-3","minor_units":"-3","currency":null,"scale":0,"exact":false,"data_version":"iso4217-datasets-7cdc784-2026-07-27"}}],"execute_url":"/v1/tools/money-minor-units-convert/versions/1.0.0/execute"}