docs

Start building with Refract.

Point Refract at an image origin you already have. Originals are fetched on demand and cached at the edge, never stored permanently — you build every variant from a URL.

quickstart: 3 steps

Your first transform in three steps.

1

Create a key, connect an origin.

Create an API key and point Refract at your existing image origin. No re-upload — originals are fetched on demand.

2

Request your first transform.

Append parameters to the URL and Refract answers with the transformed, optimized image.

https://demo.refract.dev/hero.jpg?w=1200&fm=auto&q=80
3

Automate with the SDK.

Build URLs in code with @refract/js.

sdk: javascript
import { refract } from "@refract/js";

const url = refract("hero.jpg", { width: 1200, format: "auto", quality: 80 });
// → https://demo.refract.dev/hero.jpg?w=1200&fm=auto&q=80

reference: 10 parameters

Every parameter, chainable.

Ten parameters ride the query string in any order. fm, q, and dpr are negotiated at the edge.

Parameter Accepted values Description
w integer, px Output width in pixels.
h integer, px Output height in pixels.
fit cover, contain, fill, crop Resize mode within the target box.
fm Negotiated jpeg, png, webp, avif, auto Output format. auto negotiates AVIF → WebP → JPEG from the Accept header.
q Negotiated 1 – 100, default 75 Output quality; re-encoded at the edge.
dpr Negotiated 1 – 3 Device pixel ratio for the render.
crop smart, center, edges Crop strategy. smart keeps the subject in frame.
rot 90, 180, 270 Rotation in degrees.
blur 0 – 100 Gaussian blur radius.
bg hex color Background fill for fit=contain.

caching & limits

Cached hard, purged instantly.

rate limit

50 requests/second per key, on all tiers.

cache window

Transformed variants are cached at the edge for 30 days.

purge

Instant purge by URL or by tag, whenever a source changes.