OPEN API

Public API reference

Send requests to the existing endpoint URLs. The examples use this base URL https://zxso.net.

Response format

JSON responses contain code (integer, the HTTP status), msg (string), and data (the result). On a 4xx or 5xx error, data is null and msg describes the problem. Encoding and Chinese text endpoints accept form fields.

{"code":400,"msg":"请输入二维码内容","data":null}

QR codes

Generate a QR code

GET/api/qrcode

Request parameters

ParameterRequiredTypeDescription
textYesstringText to encode
wNofloatModule size in pixels (2–24, default 5.34)
ofNointQuiet zone width in modules (default 2)
elNoh/q/m/lError correction level (default q)
bgNohexBackground color, e.g. ffffff
fgNohexForeground color, e.g. 000000

Success response

image/png · Success returns a PNG image. Missing text returns HTTP 400 and a JSON error.

Example

curl -X GET 'https://zxso.net/api/qrcode' -G --data-urlencode 'text=hello' -d 'w=8&el=q' --output qrcode.png

Decode a QR code

POST/api/deqrcode

Request parameters

ParameterRequiredTypeDescription
fileYesfileUpload a PNG or JPG file up to 2 MB. The image is processed only during the request. Maximum dimensions: 3000 × 3000 pixels. Up to 5 requests per IP per minute.

Success response

ParameterTypeDescription
data.textstringText from the QR code

Example

curl -X POST 'https://zxso.net/api/deqrcode' -F 'file=@qrcode.png'

{"code":200,"msg":"success","data":{"text":"hello"}}

Encoding conversions

HEX

POST/api/hex/encodeText → hex

POST/api/hex/decodeHex → text

Request parameters

ConversionParameterRequiredTypeDescription
Text → hexstrNostringText to encode. Omitting it or sending an empty string returns empty strings.
Hex → texthexYesstringHex bytes, two digits per byte. Spaces, tabs and line breaks are ignored. At least one byte is required.

Success response

ConversionParameterTypeDescription
Text → hexdata.strstringOriginal input text.
Text → hexdata.hexstringLowercase hexadecimal representation of the UTF-8 input bytes.
Hex → textdata.strstringText decoded from the hexadecimal bytes.
Hex → textdata.hexstringInput hex string with spaces, tabs and line breaks removed.

Example

curl -X POST 'https://zxso.net/api/hex/encode' --data-urlencode 'str=AB'

{"code":200,"msg":"success","data":{"str":"AB","hex":"4142"}}
curl -X POST 'https://zxso.net/api/hex/decode' --data-urlencode 'hex=4142'

{"code":200,"msg":"success","data":{"str":"AB","hex":"4142"}}

Unicode

POST/api/unicode/encodeText → Unicode

POST/api/unicode/decodeUnicode → text

Request parameters

ConversionParameterRequiredTypeDescription
Text → UnicodetextYesstringText to escape. Only characters from U+4E01 through U+9FA4 are escaped. Other characters pass through.
Unicode → texttextYesstringText containing a backslash, u and four hex digits, e.g. \u98ce.

Success response

ConversionParameterTypeDescription
Text → Unicodedata.textstringText after escaping characters, e.g. 风 becomes \u98ce.
Unicode → textdata.textstringText with Unicode escape sequences decoded.

Example

curl -X POST 'https://zxso.net/api/unicode/encode' --data-urlencode 'text=风'

{"code":200,"msg":"success","data":{"text":"\\u98ce"}}
curl -X POST 'https://zxso.net/api/unicode/decode' --data-urlencode 'text=\u98ce'

{"code":200,"msg":"success","data":{"text":"风"}}

Punycode

POST/api/punycode/encodeDomain → Punycode

POST/api/punycode/decodePunycode → domain

Request parameters

ConversionParameterRequiredTypeDescription
Domain → PunycodedomainYesstringDomain name to encode, e.g. 例子.cn.
Punycode → domaindomainYesstringASCII domain name to decode, e.g. xn--fsqu00a.cn.

Success response

ConversionParameterTypeDescription
Domain → Punycodedata.domainstringEncoded ASCII domain name, e.g. xn--fsqu00a.cn.
Punycode → domaindata.domainstringDecoded Unicode domain name, e.g. 例子.cn.

Example

curl -X POST 'https://zxso.net/api/punycode/encode' --data-urlencode 'domain=例子.cn'

{"code":200,"msg":"success","data":{"domain":"xn--fsqu00a.cn"}}
curl -X POST 'https://zxso.net/api/punycode/decode' --data-urlencode 'domain=xn--fsqu00a.cn'

{"code":200,"msg":"success","data":{"domain":"例子.cn"}}