Punycode converter: IDN domain to ASCII and back, with IDNA2008 label validation
Punycode converter: convert internationalised domain names between Unicode and ASCII punycode in either direction, label by label, and validate each label against IDNA2008: length, leading and trailing hyphens, the hyphen-hyphen rule at positions 3 and 4, disallowed code points and bidirectional rules. Returns both forms, the per-label breakdown and the first rule violated. Strict mode is IDNA2008 (UTS 46 non-transitional); it may reject names /v1/code/url displays.
Output (data): ascii (string|null, null only when a label cannot be converted at all, e.g. a disallowed code point; a label that merely breaks a hyphen rule is still converted, valid:false), unicode (string|null, same), valid, labels [{index, unicode, ascii (string|null), length (integer|null, null when the label cannot be converted), punycoded, valid, reason (string|null)}], reason (first failure or null), total_length (integer|null, null when a label cannot be converted).
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: unicode-idna-tables Unicode 17.0.0 (UTS #46 IdnaMappingTable via tr46 6.0.0) (published 2026-09-29, Unicode License v3). Echoed in meta.sources.
Price: $0.05 USDC per call (x402, Base). Route contract version 1.0.0. Docs: https://api.duoleads.com/docs#code-idn
Request
- Base URL: https://api.duoleads.com
- URL: https://api.duoleads.com/v1/code/idn
- Auth: none declared
Query parameters
Domain name in Unicode or punycode form. Accepted: at most 512 characters.
ascii, unicode or both (default). Validated only: the response always carries both forms. Accepted: ascii, unicode, both.
true (default) applies IDNA2008 strictly; false uses UTS 46 transitional (IDNA2003-compatible) processing, which maps e.g. ß to ss; current browsers and /v1/code/url use non-transitional processing, so its output can differ from them. Accepted: true or false.
Response
Paid and settled. data is route-specific; a route that judges its input returns 200 with data.valid: false for a bad value.
Changes
No recorded changes to this operation across all 1 revision of this API.