# Punycode Converter API

> Convert between Unicode and Punycode for internationalized domain names (IDN).

**Endpoint:** `GET https://api.apiverve.com/v1/punycode`  
**Category:** Data Conversion  
**Cost:** 1 credit per call  
**Canonical page:** https://apiverve.com/marketplace/punycode

## Overview

A Punycode converter for international domain names. Send a Unicode domain such as münchen.de and get the xn-- form that DNS and certificates use, or send an xn-- name and get the readable Unicode back. It is essential for working with international domain names containing non-ASCII characters like accents, Chinese, Arabic, or Cyrillic, whether you are registering domains, validating signup forms or displaying links.

The response also reports which writing systems appear in the non-ASCII labels, and checks for homograph spoofing: labels that mix scripts in a way no real language does, such as a Latin 'a' swapped for a visually identical Cyrillic one. That is the pattern behind look-alike phishing domains, so security tools, email filters and link scanners can flag it before a user clicks.

The Free plan returns the converted output, whether the input was treated as a domain, and the scripts list. Paid plans add isIDN, which says whether the name actually needs Punycode, and mixedScript, the spoofing verdict.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl "https://api.apiverve.com/v1/punycode?text=m%C3%BCnchen.de&mode=encode" \
  -H "x-api-key: YOUR_API_KEY"
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `text` | string | Yes | Unicode label, domain, email address or URL to encode; only the domain of an email or the host of a URL is converted (max 1000 characters). length 1-1000 |
| `mode` | string | No | encode or decode; when omitted, an all-ASCII input with an xn-- label is decoded and anything else is encoded. default encode. One of: encode, decode |

## Response fields

- `input` — string · Original Unicode text provided for encoding conversion
- `output` — string · Converted Punycode text with xn-- prefix format
- `mode` — string · Conversion mode used for the transformation operation
- `isIDN` — boolean · Indicates if result is valid internationalized domain name · (premium)
- `isDomain` — boolean · Whether the input was treated as a domain name (that is, it contained a dot) rather than a single label.
- `scripts` — array · Writing systems (Latin, Cyrillic, Greek, Han, etc.) detected in the domain's non-ASCII labels. Empty for a plain ASCII domain; a single entry for a legitimate international domain
- `mixedScript` — boolean · True when a single domain label mixes writing systems in a way no real language does (e.g. Latin combined with Cyrillic) — the signature of a homograph / look-alike phishing domain. Legitimate combinations such as Japanese (Han + Hiragana/Katakana) are not flagged. Detects cross-script spoofs, not same-script look-alikes · (premium)

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "input": "münchen.de",
    "output": "xn--mnchen-3ya.de",
    "mode": "encode",
    "isIDN": true,
    "isDomain": true,
    "scripts": [
      "Latin"
    ],
    "mixedScript": false
  }
}
```

## Use cases

- **Domain Registration** — Verify and convert international domain names
- **Web Development** — Handle IDN domains in applications
- **Email Systems** — Process internationalized email addresses
- **Security** — Detect homograph attacks using similar-looking Unicode characters

## SDKs

- **npm** — `npm install @apiverve/punycode` (https://www.npmjs.com/package/@apiverve/punycode)
- **NuGet** — `dotnet add package APIVerve.API.PunycodeConverter` (https://www.nuget.org/packages/APIVerve.API.PunycodeConverter)
- **Source** — https://github.com/apiverve/punycode-api

## More

- Full reference: https://docs.apiverve.com/ref/punycode
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
