---
title: "Convert internationalised domain names to and from Punycode (RFC 3492): bücher.example ⇄ xn--bcher-kva.example."
method: POST
path: "/api/v1/punycode"
tags: ["Encoders & Decoders"]
---

# Convert internationalised domain names to and from Punycode (RFC 3492): bücher.example ⇄ xn--bcher-kva.example.

`POST /api/v1/punycode`

## Request

- Base URL: `https://programmes.net`
- URL: `https://programmes.net/api/v1/punycode`
- Auth: none declared

Punycode & IDN Converter. Operations: `to-ascii` — Encode each Unicode label as an xn-- label (one domain, email or URL per line; labels are NFC-normalised and lowercased). `to-unicode` — Decode each xn-- label back to Unicode (one domain, email or URL per line). `encode` — Encode one string with the bare RFC 3492 algorithm (no xn-- prefix, case kept). `decode` — Decode one bare Punycode string (no xn-- prefix) with the RFC 3492 algorithm.

## Request body

- union
  - PunycodeToAscii: Encode each Unicode label as an xn-- label (one domain, email or URL per line; labels are NFC-normalised and lowercased).
    - `operation` 'to-ascii', required
    - `input` string: Domain names, email addresses or URLs, one per line.
    - `options` object
  - PunycodeToUnicode: Decode each xn-- label back to Unicode (one domain, email or URL per line).
    - `operation` 'to-unicode', required
    - `input` string: Domain names, email addresses or URLs with xn-- labels, one per line.
    - `options` object
  - PunycodeEncode: Encode one string with the bare RFC 3492 algorithm (no xn-- prefix, case kept).
    - `operation` 'encode', required
    - `input` string: The Unicode string to encode.
    - `options` object
  - PunycodeDecode: Decode one bare Punycode string (no xn-- prefix) with the RFC 3492 algorithm.
    - `operation` 'decode', required
    - `input` string: The Punycode string to decode.
    - `options` object

## Response `200`

The operation ran.

- object
  - `ok` unknown, required
  - `tool` 'punycode', required
  - `operation` 'to-ascii' | 'to-unicode' | 'encode' | 'decode', required
  - `result` unknown, required

## Other responses

- `400`: The request is not valid (https://programmes.net/api#invalid-request); The tool has no such operation (https://programmes.net/api#unknown-operation)
- `404`: No such tool (https://programmes.net/api#unknown-tool)
- `413`: The request or its input is too large (https://programmes.net/api#content-too-large)
- `415`: The body must be JSON (https://programmes.net/api#unsupported-media-type)
- `422`: An option is missing, of the wrong type or out of range (https://programmes.net/api#invalid-options); This call needs more CPU than one API call may use (https://programmes.net/api#refused); The operation could not process the input (https://programmes.net/api#tool-error)
- `429`: Too many requests (https://programmes.net/api#rate-limited)
- `500`: Internal error (https://programmes.net/api#internal-error)

---

[API](https://skmtc.dev/programmes/apis/programmes-net-api.md) · [All operations](https://skmtc.dev/programmes/apis/programmes-net-api/llms.txt) · [OpenAPI document](https://skmtc.dev/programmes/apis/programmes-net-api/revisions/aa939784a2e6?raw)
