# Unicode Escape/Unescape API

> Unicode Escape/Unescape converts text into Unicode escape sequences or restores escaped strings back into readable characters. Send any string to get the transformed text and total character count.

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

## Overview

A Unicode escape and unescape API for converting text to \uXXXX format and back. Send a string with action set to escape and every character comes back as an escape sequence, ready to paste into JavaScript, JSON, Java or C# source without encoding problems. Send escaped text with action set to unescape and get the readable string back. Emoji and other characters outside the Basic Multilingual Plane are written as surrogate pairs, the form those languages expect.

Developers use it to debug mojibake in logs, to inspect exactly which invisible or look-alike characters a string contains, to build string literals for localisation files, and to clean up escaped text copied out of JSON payloads or stack traces.

On the Free plan the escape action returns the escaped string and a character count. Paid plans add a per-character breakdown listing each character with its escape sequence and its U+ code point, which is the quickest way to spot a zero-width space or a Cyrillic letter hiding in Latin text.

## 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 -X POST "https://api.apiverve.com/v1/unicodeescape" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello World","action":"escape"}'
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `text` | string | Yes | The text to escape; leading and trailing whitespace is escaped too. length 1-inf |
| `action` | string | No | The action to perform. default escape. One of: escape, unescape |

## Response fields

- `action` — string · The action performed on the text (escape or unescape)
- `original` — string · The original input text before conversion
- `escaped` — string · The converted text with Unicode escape sequences applied
- `character_count` — number · Total number of characters in the original text
  - `unicode_points.0.char` — string · Individual character from the input text · (premium)
  - `unicode_points.0.unicode` — string · Unicode escape sequence representation of the character · (premium)
  - `unicode_points.0.codepoint` — string · Unicode codepoint notation (e.g., U+0048) for the character · (premium)

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "action": "escape",
    "original": "Hello World",
    "escaped": "\\u0048\\u0065\\u006C\\u006C\\u006F\\u0020\\u0057\\u006F\\u0072\\u006C\\u0064",
    "character_count": 11,
    "unicode_points": [
      {
        "char": "H",
        "unicode": "\\u0048",
        "codepoint": "U+0048"
      },
      {
        "char": "e",
        "unicode": "\\u0065",
        "codepoint": "U+0065"
      },
      {
        "char": "l",
        "unicode": "\\u006C",
        "codepoint": "U+006C"
      },
      {
        "char": "l",
        "unicode": "\\u006C",
        "codepoint": "U+006C"
      },
      {
        "char": "o",
        "unicode": "\\u006F",
        "codepoint": "U+006F"
      },
      {
        "char": " ",
        "unicode": "\\u0020",
        "codepoint": "U+0020"
      },
      {
        "char": "W",
        "unicode": "\\u0057",
        "codepoint": "U+0057"
      },
      {
        "char": "o",
        "unicode": "\\u006F",
        "codepoint": "U+006F"
      },
      {
        "char": "r",
        "unicode": "\\u0072",
        "codepoint": "U+0072"
      },
      {
        "char": "l",
        "unicode": "\\u006C",
        "codepoint": "U+006C"
      },
      {
        "char": "d",
        "unicode": "\\u0064",
        "codepoint": "U+0064"
      }
    ]
  }
}
```

## Use cases

- **JSON Processing** — Escape Unicode characters in JSON strings for safe transmission and storage
- **Code Generation** — Generate Unicode escape sequences for use in source code, configuration files, or string literals
- **Data Migration** — Convert Unicode characters to escape sequences when migrating between systems with different encoding support
- **Debugging** — View Unicode escape sequences of characters to debug encoding issues and identify problematic characters

## SDKs

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

## More

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