deterministic
no-api-key
num
finance
money
allocation

Money split: allocate an amount into shares with no rounding loss

Money split: split a money amount into shares without losing or inventing a cent. Divide evenly into N parts, or by a list of ratios, and the remainder is distributed one minor unit at a time by a named, deterministic rule — largest-remainder, first-wins or last-wins — so the parts always sum exactly to the original. Uses the ISO 4217 minor-unit exponent of the currency, so zero- and three-decimal currencies work (JPY 0, KWD 3); metals and XXX are rejected.

Output (data): shares [decimal strings], shares_minor [integers], total (equals amount exactly), currency, minor_units, remainder_distributed, rule.

Deterministic: identical input returns identical output, so the response is served with Cache-Control: private, max-age=31536000, immutable (the paying client may cache it indefinitely; shared caches must not, because the response is paid).

Sources: iso-4217 SIX list one 2026-09-17, list three 2026-01-01 (published 2026-09-17, Public data (owner decision 2026-09-29)). Echoed in meta.sources.

Price: $0.05 USDC per call (x402, Base). Route contract version 1.0.0. Docs: https://api.duoleads.com/docs#num-allocate

get/v1/num/allocate

Request

  • Base URL: https://api.duoleads.com
  • URL: https://api.duoleads.com/v1/num/allocate
  • Auth: none declared

Query parameters

amountstring required

Decimal amount, absolute value below 1e12. Accepted: a decimal amount with absolute value below 1e12.

currencystring required

ISO 4217 alpha-3 code. Accepted: an ISO 4217 alpha-3 code.

partsinteger

Number of equal parts, 1-1000. One of parts or ratios. Accepted: integer 1-1000.

ratiosstring

Comma-separated non-negative ratios, at most 1000, each with at most 15 integer digits and 15 decimal places. One of parts or ratios. Accepted: comma-separated non-negative numbers, at most 1000.

rule'largest-remainder' | 'first' | 'last' | 'round-robin'

Remainder rule: largest-remainder (default), first, last or round-robin. Accepted: largest-remainder, first, last, round-robin.

Response

Paid and settled. data is route-specific; a route that judges its input returns 200 with data.valid: false for a bad value.

okunknown required
route'/v1/num/allocate' required
version'1.0.0' required

Changes

No recorded changes to this operation across all 1 revision of this API.