Obix

Minify and mangle JavaScript with one POST.

Two endpoints, one key, no options. /minify returns smaller code, /mangle returns code that is hard to read. Works from any language that can send HTTPS.

$ curl -X POST https://obix.dev/v1/minify \
    -H "X-Api-Key: YOUR_KEY" \
    -H "Content-Type: application/json" \
    -d '{"code":"function pay(user, amount) { ... }"}'{
  "ok": 1,
  "code": "function pay(user,amount){let token=user.secret+\":\"+amount;return sign(token,\"kdf9x2\")}",
  "bytesIn": 108,
  "bytesOut": 87,
  "ms": 6
}

The same function, three ways

RouteCode
you send
function pay(user, amount) {
    let token = user.secret + ":" + amount;
    return sign(token, "kdf9x2");
}
108bytes
/minify
function pay(user,amount){let token=user.secret+":"+amount;return sign(token,"kdf9x2")}
87bytes
/mangle
var _0x3a=['c2VjcmV0','a2RmOXgy'];function _0x1f(a,b){var t=a[_0x3a[0]]+':'+b;return sign(t,atob(_0x3a[1]));}
109bytes

/minify removes whitespace, shortens names and drops dead code. /mangle renames, encodes strings and flattens control flow; the output is larger and slow to reverse.

What you need to know

Auth
One header, X-Api-Key. The same key works on both endpoints.
Request
JSON body with one field, code. There is no options object.
Response
JSON with the result in code, plus bytes in, bytes out and milliseconds. Errors return ok:0 and err.
Limits
Payload cap is 10 MB. Current limits are on the limits page.
From anywhere
cURL, PHP, Node.js, the browser, a CI step. Copy an example.
Parse errors
Invalid JavaScript returns 422 with the position of the error.