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
| Route | Code | |
|---|---|---|
| you send | | 108bytes |
/minify | | 87bytes |
/mangle | | 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 returnok:0anderr. - 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
422with the position of the error.
