Tinyfile API

Send a file, get the smaller file back, with the same content (lossless).

Authentication

Create an API key on the Account page and send it as Authorization: Bearer sk_live_....

POST /v1/optimize

curl -X POST https://tinyfile.dev/v1/optimize \
  -H "Authorization: Bearer $TINYFILE_KEY" \
  -F [email protected] -D - -o photo.small.png

Form fields: file (required, up to 10 MB), level (1 to 9), lossy (true), keepMetadata (true). One file per request.

Response 200: the optimized file (or the original if it cannot be made smaller) with headers X-Tinyfile-Status (optimized or unchanged), X-Tinyfile-Before, X-Tinyfile-After.

Errors

400 bad request, 402 subscription required, 403 invalid or missing key, 413 file too large, 422 unsupported file, 429 rate limited, 504 timeout.

Billing

The web tool is free and needs no account. The API costs $0.005 per file that actually gets smaller ($5.00 per 1,000 files); unchanged, skipped and failed files are free. Machine-readable description: openapi.yaml.