Skip to main content

Squillify development is paused indefinitely. Read why, and discover what this experiment achieved. Read the story

MicroSkills Reference

HTML Minifier

web.minify_html

ProductionEngine wrapper (Class A)Deterministicstrictfastv1.0.0
No network

Overview

You send an HTML document and we return a smaller version by collapsing removable whitespace and stripping comments (plus optional conservative markup cleanups when you enable them). Content inside pre, textarea, script, and style stays byte-stable — we never minify or parse JavaScript. This is not a sanitizer: dangerous markup you send in, including script payloads, comes back out. Use web.sanitize_html when you need XSS-safe HTML.

You want smaller markup without a minifier quietly rewriting a script block or being mistaken for a safety check it never performed.

Reliability

Same document and same options give the same bytes for as long as the HTML engine stays on the build named in _meta.parserProfile; an engine upgrade can shift the output slightly, so compare against that value rather than assuming byte stability forever. Nothing leaves the platform, and content inside pre, textarea, script, and style is copied through untouched, as is anything under a white-space:pre style. Two things surprise people: a small fragment can come back larger, because we return a complete document, and savedBytes then reports 0; and we are not a safety pass, so a script payload you send in comes straight back out. Three failures stop the call. HTML_PARSE_FAILED — the document could not be read at all, which is worth one retry after you check it really is HTML rather than another format; HTML_DEPTH_LIMIT_EXCEEDED — elements nest deeper than 256 levels, so flatten the markup or split the document, since retrying it unchanged fails again; HTML_OUTPUT_TOO_LARGE — the result would pass 2097152 bytes, which happens when a nearly full-size input grows during serialisation, so minify the page in sections instead.

Context footprint

The whole minified document comes back inline, so expect a reply about the size of the page itself, up to roughly two megabytes. A successful call costs 2 execution credits.

When to use it

When you hold markup you already trust and want it smaller but rendering the same.

When the markup came from somewhere you do not trust, or when what you really want compressed is the JavaScript or CSS.

Runs on jsoup's HTML parser and serializer, with the whitespace rules applied on top.

Scope

Note
We shrink an HTML document by dropping whitespace and comments that do not change how it renders.

Non-goals

  • Does not minify or even parse the JavaScript inside script elements
  • Does not minify CSS beyond collapsing its whitespace when you ask
  • Does not make markup safe — web.sanitize_html is the skill for that
  • Does not reorder attributes or restructure the document
  • Does not render the page or load anything it links to
  • Does not claim the smallest possible output

Properties

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

data-transformation

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call2 credits

File handling

Accepts file_refProduces file_refMax input2 MB

How we handle your data

Sensitive output possible
What this means

This skill may receive sensitive content and may return submitted, transformed, extracted, or reformatted content.

Squillify guarantees
  • Runs inside Squillify
  • This skill runs inside Squillify.
  • Payloads are not sent to an external service by this skill.
  • Squillify does not permanently store submitted payloads.
  • Telemetry records metadata only, not submitted content.
  • Submitted payloads are not used for training.
  • Submitted payloads are not reviewed by humans.
  • This skill does not target sensitive data.
  • The response may contain submitted or transformed content.
Your responsibility

Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.

Read the Microskill Data Handling Policy

Input schema

FieldTypeRequiredDescription
htmlstringYesHTML source to minify without executing scripts.
optionsobjectNoPurpose-bound bounded minification option object; omit it to use all safe defaults. It contains from 0 through 256 purpose-bound properties — unconstrained RFC 8259 JSON items.

Output schema

FieldTypeRequiredDescription
htmlstringYesMinified HTML preserving configured semantics.
inputBytesintegerYesOriginal UTF-8 byte count.
outputBytesintegerYesReturned UTF-8 byte count.
savedBytesintegerYesRemoved UTF-8 byte count.
savedPercentnumberYesPercentage of bytes removed.
transformationsarrayYesBounded array of applied transformation names in deterministic order. The item shape is defined by the nested schema and the array contains from 0 through 64 items.
findingsarrayYesBounded array of minification findings. The item shape is defined by the nested schema and the array contains from 0 through 20000 items.
_metaobjectYesClosed minifier metadata receipt with parser and option details. Its documented web receipt properties are bounded to 128 entries — unconstrained RFC 8259 JSON items.

API contract

POST /v1/execute
curl
curl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"web.minify_html","input":{"html":"<p>Hi</p>"}}'
Integrations
TypeScript SDK
import { Squillify } from "@squillify/sdk";

const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });

const { output } = await sq.execute("web.minify_html", {"html":"<html>\n  <body>\n    <!-- comment -->\n    <p>Hello   world</p>\n  </body>\n</html>"});

Errors

CodeHTTPRetryableDescription
VALIDATION_ERROR400NoThe request payload failed schema validation.
UNAUTHORIZED401NoMissing or invalid API key.
SKILL_NOT_ACCESSIBLE403NoThe API key is not granted access to this skill.
SKILL_NOT_AVAILABLE_FOR_PLAN403NoThis skill is not included in your current plan.
PLAN_ELIGIBILITY_UNAVAILABLE503YesPlan eligibility could not be decided. Retry after backoff.
SKILL_NOT_FOUND404NoThe requested skill or version does not exist.
TENANT_RATE_LIMITED429YesRequest rate limit exceeded. Retry after backoff.
QUOTA_EXCEEDED429YesPlan quota exhausted. Retryable once the quota period resets.
EXECUTION_TIMEOUT504YesExecution exceeded the allowed time budget.
HTML_PARSE_FAILED400NoThe request payload failed this skill's input validation.
HTML_DEPTH_LIMIT_EXCEEDED429NoA size, quota, rate, or time limit was exceeded.
HTML_OUTPUT_TOO_LARGE429NoA size, quota, rate, or time limit was exceeded.

Other limits

LimitValue
Recommended inline bytes32 KiB

Limitations

  • Does not minify or even parse the JavaScript inside script elements
  • Does not minify CSS beyond collapsing its whitespace when you ask
  • Does not make markup safe — web.sanitize_html is the skill for that
  • Does not reorder attributes or restructure the document
  • Does not render the page or load anything it links to
  • Does not claim the smallest possible output
  • Making untrusted markup safe to display, which web.sanitize_html handles
  • Bundling or compressing JavaScript and CSS

How to call

POST /v1/execute (requires authentication)

Request bodyjson
{
  "skillKey": "web.minify_html",
  "input": {
    "html": "<html>\n  <body>\n    <!-- comment -->\n    <p>Hello   world</p>\n  </body>\n</html>"
  }
}

Examples

Marketing landing page snippet — comment stripped and whitespace collapsed

Inputjson
{
  "html": "<html>\n  <body>\n    <!-- comment -->\n    <p>Hello   world</p>\n  </body>\n</html>"
}
Expected outputjson
{
  "outputBytes": 57,
  "html": "<html><head></head><body><p>Hello world</p></body></html>",
  "transformations": [
    "REMOVE_COMMENTS",
    "COLLAPSE_WHITESPACE"
  ],
  "findings": [],
  "savedPercent": 27.85,
  "inputBytes": 79,
  "savedBytes": 22,
  "_meta": {
    "parserProfile": "jsoup-1.18.3",
    "preservedRegions": 0
  }
}

Inline script preserved byte-for-byte while surrounding markup shrinks

Inputjson
{
  "html": "<html><body><script>var x = 1;</script><p>Hi</p></body></html>"
}
Expected outputjson
{
  "outputBytes": 75,
  "html": "<html><head></head><body><script>var x = 1;</script><p>Hi</p></body></html>",
  "transformations": [
    "COLLAPSE_WHITESPACE"
  ],
  "findings": [],
  "savedPercent": 0,
  "inputBytes": 62,
  "savedBytes": 0,
  "_meta": {
    "parserProfile": "jsoup-1.18.3",
    "preservedRegions": 1
  }
}
  • Shrink HTML templates before you ship or store them
  • Strip authoring whitespace and build comments out of a static page
  • Measure how much a page would gain from minification

Avoid for

  • Making untrusted markup safe to display, which web.sanitize_html handles
  • Bundling or compressing JavaScript and CSS

Composable with

Safety & privacy

  • Runs without calling any external service.
  • Your payloads are never stored permanently.
  • Telemetry captures metadata only — never your payload contents.
  • We never train models on your payloads.
  • No human reviews your payloads.

Tags

htmlwebtransformation