# Minify API
> Shrink your web assets. Minify CSS, JavaScript and HTML through one simple API and get back the compact output plus how many bytes (and what percent) you saved. CSS is minified with clean-css, JavaScript with Terser (with optional name-mangling and compression toggles), and HTML with html-minifier-terser (collapsing whitespace, dropping comments and redundant attributes, and minifying inline CSS and JS). Pass the source as a parameter or in the request body (up to 5 MB). Pure local processing — no key, no third-party service, instant. Live. 4 endpoints. Built for build pipelines, on-the-fly asset optimisation, email-HTML slimming, CMS and CDN tooling, and page-speed work.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/minify-api/..."
```

## Pricing
- **Free** (Free) — 1,400 calls/Mo, 2 req/s
- **Starter** ($6/Mo) — 23,000 calls/Mo, 8 req/s
- **Pro** ($25/Mo) — 172,000 calls/Mo, 20 req/s
- **Mega** ($61/Mo) — 880,000 calls/Mo, 50 req/s

## Endpoints

### Minify

#### `GET /v1/css` — Minify CSS

**Parameters:**
- `code` (query, required, string) — CSS source Example: `body { color: red; margin: 0 0 0 0; }`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/minify-api/v1/css?code=body+%7B+color%3A+red%3B+margin%3A+0+0+0+0%3B+%7D"
```

**Response:**
```json
{
    "data": {
        "minified": "body{color:red;margin:0}",
        "saved_bytes": 13,
        "minified_size": 24,
        "original_size": 37,
        "saved_percent": 35.14
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:57.196Z",
        "request_id": "14b462c4-a6e0-4976-92cf-c965752d4062"
    },
    "status": "ok",
    "message": "Minify CSS",
    "success": true
}
```

#### `GET /v1/html` — Minify HTML

**Parameters:**
- `code` (query, required, string) — HTML source Example: `<div>  <!-- c --> <p>hi</p> </div>`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/minify-api/v1/html?code=%3Cdiv%3E++%3C%21--+c+--%3E+%3Cp%3Ehi%3C%2Fp%3E+%3C%2Fdiv%3E"
```

**Response:**
```json
{
    "data": {
        "minified": "<div><p>hi</p></div>",
        "saved_bytes": 14,
        "minified_size": 20,
        "original_size": 34,
        "saved_percent": 41.18
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:57.306Z",
        "request_id": "5a997430-3203-4e90-85a1-fcabcb28521d"
    },
    "status": "ok",
    "message": "Minify HTML",
    "success": true
}
```

#### `GET /v1/js` — Minify JavaScript

**Parameters:**
- `code` (query, required, string) — JavaScript source Example: `function add(a, b) { return a + b; }`
- `mangle` (query, optional, string) — false to disable name mangling
- `compress` (query, optional, string) — false to disable compression

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/minify-api/v1/js?code=function+add%28a%2C+b%29+%7B+return+a+%2B+b%3B+%7D"
```

**Response:**
```json
{
    "data": {
        "minified": "function add(n,d){return n+d}",
        "saved_bytes": 7,
        "minified_size": 29,
        "original_size": 36,
        "saved_percent": 19.44
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:57.403Z",
        "request_id": "feb337d9-7a94-4e8e-9fa1-78bc4712a4d4"
    },
    "status": "ok",
    "message": "Minify JavaScript",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/minify-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "auth": "none upstream; this gateway requires x-api-key",
        "name": "Minify API",
        "note": "Minify web assets. /v1/css, /v1/js (terser; ?mangle=&?compress= toggles) and /v1/html — pass ?code= the source (or POST body, up to 5 MB). Each returns the minified output plus original/minified size and the percent saved. Instant, nothing stored.",
        "source": "Local minification (clean-css, terser, html-minifier-terser) — no key, no upstream",
        "endpoints": 4
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:57.484Z",
        "request_id": "33e1943c-2b1b-4a1a-9c85-77ed6dd9f162"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/minify-api
OpenAPI spec: https://www.oanor.com/api/minify-api/openapi.json
