Code API
Minify, beautify and convert JavaScript, CSS, HTML, SVG, JSON, XML and dozens of language pairs — over a clean JSON REST contract.
Text in → text out. Send a snippet via JSON, get back a minified, beautified, or converted result. Powered by the same Node toolchain (Terser, clean-css, html-minifier-terser, prettier, svgo) that runs our web tools — so output matches exactly.
# Minify a JavaScript snippet
curl -X POST https://jinero.online/api/v1/code/minify \
-H "Content-Type: application/json" \
-d '{"code": "function add(a, b) { return a + b; }", "type": "js"}'
const r = await fetch("https://jinero.online/api/v1/code/minify", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ code: source, type: "js", mode: "minify" }),
});
const { output, savings_percent } = await r.json();
All endpoints are public — no key required. Operations are pure text transforms (no GPU, no image processing), so limits are higher than the Images API.
# Anonymous limits (per IP):
# POST /code/minify 30 req/min
# POST /code/detect 30 req/min
# POST /code/convert 30 req/min
# GET /code/converters 30 req/min
# Max snippet size: 200,000 chars (~200 KB)
Compress or pretty-print a snippet. The same endpoint handles both directions via the mode param — useful when you have JSON config files or one-line minified CSS you want to read.
https://jinero.online/api/v1/code/minify
| Parameter | Type | Description |
|---|---|---|
code |
string | Source code. Max 200,000 characters. |
type |
string | One of: js, css, html, svg, json, xml, auto. Use "auto" to let the server sniff content. |
mode |
string | minify (default) or beautify. |
keep_license |
boolean | Preserve /*! ... */ license comments when minifying. Default: true. |
curl -X POST https://jinero.online/api/v1/code/minify \
-H "Content-Type: application/json" \
-d @- <<JSON
{
"code": ".btn { color: red; padding: 8px 12px; }",
"type": "css",
"mode": "minify"
}
JSON
const r = await fetch("https://jinero.online/api/v1/code/minify", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
code: cssSource,
type: "css",
mode: "minify",
keep_license: true,
}),
});
const data = await r.json();
$response = Http::post("https://jinero.online/api/v1/code/minify", [
"code" => $jsSource,
"type" => "js",
"mode" => "minify",
]);
$minified = $response->json("output");
{
"success": true,
"type": "css",
"mode": "minify",
"output": ".btn{color:red;padding:8px 12px}",
"original_size": 46,
"output_size": 27,
"savings_percent": 41.3,
"line_count": 1
}
Auto-detect the language of a snippet. Returns the inferred type plus the list of converter targets that accept it as input — handy for building "convert to…" dropdowns.
https://jinero.online/api/v1/code/detect
| Parameter | Type | Description |
|---|---|---|
code |
string | Source code. Max 200,000 characters. |
curl -X POST https://jinero.online/api/v1/code/detect \
-H "Content-Type: application/json" \
-d '{"code": "{\"name\": \"jinero\"}"}'
const r = await fetch("https://jinero.online/api/v1/code/detect", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ code: snippet }),
});
const { detected_type, available_targets } = await r.json();
{
"success": true,
"detected_type": "json",
"confidence": 0.97,
"available_targets": ["yaml", "toml", "xml", "csv"]
}
Discover every supported (from → to) conversion plus its per-pair options schema. Use this to build UIs that adapt automatically when we add new converters.
https://jinero.online/api/v1/code/converters
curl https://jinero.online/api/v1/code/converters
const r = await fetch("https://jinero.online/api/v1/code/converters");
const { converters } = await r.json();
// converters is a flat list of { id, from, to, label, optionsSchema }
{
"success": true,
"converters": [
{ "id": "json-to-yaml", "from": "json", "to": "yaml", "label": "JSON → YAML", "optionsSchema": {} },
{ "id": "css-to-scss", "from": "css", "to": "scss", "label": "CSS → SCSS", "optionsSchema": {} },
{ "id": "html-to-pug", "from": "html", "to": "pug", "label": "HTML → Pug", "optionsSchema": {} }
]
}
Convert a snippet from one language to another. Supports JSON↔YAML↔TOML↔XML, CSS↔SCSS, HTML↔Pug, SVG↔JSX, and more — call /code/converters for the full list.
https://jinero.online/api/v1/code/convert
| Parameter | Type | Description |
|---|---|---|
code |
string | Source code. Max 200,000 characters. |
from |
string | Source language identifier from /code/converters. |
to |
string | Target language identifier. |
options |
object | Converter-specific knobs (see optionsSchema in /code/converters). |
curl -X POST https://jinero.online/api/v1/code/convert \
-H "Content-Type: application/json" \
-d '{"code": "{\"name\": \"jinero\"}", "from": "json", "to": "yaml"}'
const r = await fetch("https://jinero.online/api/v1/code/convert", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
code: jsonSource,
from: "json",
to: "yaml",
}),
});
const { output } = await r.json();
$res = Http::post("https://jinero.online/api/v1/code/convert", [
"code" => $cssSource,
"from" => "css",
"to" => "scss",
]);
$scss = $res->json("output");
{
"success": true,
"from": "json",
"to": "yaml",
"output": "name: jinero\n",
"notes": null
}
Standard HTTP semantics. Errors return JSON with a "message" field describing the failure.
// 422 — validation (unknown type, oversize snippet, unsupported converter)
{ "message": "The type field must be one of: js, css, html, svg, json, xml, auto." }
// 422 — minification/conversion error from the underlying tool
{ "message": "Unexpected token at line 12" }
// 429 — rate limit exceeded
{ "message": "Too Many Attempts." }
// 500 — registry unreachable (Node helper crashed)
{ "message": "Registry unavailable" }
About the jinero.online Code API
Free REST API for minifying, beautifying and converting source code — JS, CSS, HTML, SVG, JSON, YAML, TOML, XML, Pug, SCSS — over a single clean JSON contract.
Real-world tools
Terser, clean-css, html-minifier-terser, prettier, svgo — same engines as everyone else, exposed as a clean REST contract.
Conversion matrix
20+ language pairs: JSON↔YAML↔TOML↔XML, CSS↔SCSS, HTML↔Pug, SVG↔JSX. Discover them at /code/converters.
High rate limits
30 requests/minute per IP — text in, text out, no file storage to worry about.
Stateless & private
Snippets are processed in-memory and never logged. Nothing to clean up afterward.
Frequently Asked Questions
No. The Code API is public and rate-limited per IP — 30 requests/minute on each endpoint. Sign up for a token if you need higher limits.
200,000 characters (~200 KB) per request. That fits even very large bundled CSS or JSON config files. For huge minification jobs, use Terser locally.
Yes. Both call the same Node helper scripts (resources/node/minify.js and resources/node/converter.js) with the same flags, so behavior is identical.
Twenty-plus pairs at the moment: JSON↔YAML↔TOML↔XML, CSV↔JSON, CSS↔SCSS, HTML↔Pug, SVG↔JSX, and others. Call GET /code/converters for the live, machine-readable list — it includes per-pair option schemas.
No. The request body is written to a temp file for the Node helper, processed, and deleted immediately. We do not log code contents — only the request meta (size, type, status code) for rate limiting.