Iminify API v1

Iminify API

Everything the website does with images, over HTTP. Send a file or an image's address, pick a level, a format and a size, and download the result. Or hand it a web page and get back every image on it, compressed.

Base URL https://www.iminify.com/api/v1
One image, four calls
  1. POST /images 202 queued
  2. GET /images/9d3c5b8e… 200 optimizing
  3. GET /images/9d3c5b8e… 200 completed, 2.71 MB → 207.89 KB
  4. GET /images/9d3c5b8e…/download 200 team-offsite.webp

The Iminify API lets your own code do everything the website does. Send an image and get back a smaller one, in the format and at the size you asked for. Give it the address of a web page and it finds every image the page loads and compresses them all. Rename, share or re-run what you made, and download one file or a zip of many.

It's JSON over HTTPS. Every request goes to https://www.iminify.com/api/v1, carries your API key, and gets JSON back, apart from downloads, which get the file.

Quickstart

You need an account with a verified email address. The free plan works; there is no separate API plan and nothing to pay for.

1. Create a key

Open Settings > API Tokens, give the key a name you'll recognise later (the script or the server it's for), and press Create. Copy the key straight away: it is shown once. Then put it in your environment, where every sample on these pages reads it from:

Shell
export IMINIFY_API_KEY="paste-your-key-here"

2. Check it works

Shell
curl "https://www.iminify.com/api/v1/account" \
  -H "Authorization: Bearer $IMINIFY_API_KEY" \
  -H "Accept: application/json"

A 200 with your plan in it means the key is good. A 401 means it was mistyped, and a 403 with email_not_verified means the account still has a verification email waiting.

3. Compress an image

This script uploads photo.jpg, asks for WebP at 1600 pixels wide, waits for the result and saves it. Pick your language; the choice sticks on every page.

#!/usr/bin/env bash
# Compress photo.jpg to WebP at 1600 pixels wide, wait for it, save the result.
# Needs curl 7.76 or newer and jq.
set -euo pipefail

API="https://www.iminify.com/api/v1"
AUTH="Authorization: Bearer $IMINIFY_API_KEY"

# 1. Upload. The answer comes back straight away, queued, with the image's id.
id=$(curl -sS --fail-with-body "$API/images" \
  -H "$AUTH" -H "Accept: application/json" \
  -F "[email protected]" -F "format=webp" -F "width=1600" \
  | jq -r '.data.id')

# 2. Poll until it has finished.
while true; do
  image=$(curl -sS --fail-with-body "$API/images/$id" -H "$AUTH" -H "Accept: application/json")
  status=$(jq -r '.data.status' <<< "$image")

  case "$status" in
    completed|already-optimized) break ;;
    failed|cancelled) echo "The image ended as $status" >&2; exit 1 ;;
  esac

  sleep 2
done

jq -r '.data | "\(.original.size) bytes -> \(.optimized.size) bytes (\(.saved_percent)% smaller)"' <<< "$image"

# 3. Download the optimized copy under the name it was given.
curl -sS --fail-with-body -o "$(jq -r '.data.name' <<< "$image")" "$API/images/$id/download" -H "$AUTH"

That's the whole shape of the API: create something, poll it until it has finished, then fetch the result.

How it works

Work happens in the background. An upload answers straight away with 202 Accepted, the status queued and a Location header pointing at the image. A worker usually picks it up within seconds, the status moves to optimizing, and it ends as completed, already-optimized or failed, or as cancelled if someone calls it off while it waits (from the API or the website). Most images take a few seconds; a large photograph converted to AVIF can take a minute. Poll the image every second or two until the status changes. Page scans work the same way, over minutes rather than seconds.

It's your account, not a copy of it. Images you compress through the API show up in the results table on the website, and the other way round. Both spend the same allowances: an image compressed on the website counts against the same daily and per-minute limits as one sent through the API. Your plan's limits are on the pricing page.

Nothing is deleted behind your back. An image and its optimized copy stay until you delete them, from the API or the website.

What you can do

Conventions

  • Every request carries Authorization: Bearer <key>; Authentication has the details.
  • Send Accept: application/json. Errors come back as JSON either way, in one shape.
  • Bodies are JSON, except an upload, which is multipart/form-data.
  • Ids are UUIDs. Sizes are in bytes, dimensions in pixels, and times in ISO 8601, in UTC.
  • Lists come a page at a time, 15 to a page unless you ask for up to 100 with per_page, with links and meta to find the rest.

For tools and agents

The whole API is described in an OpenAPI 3.1 document at https://www.iminify.com/api/v1/openapi.json, with every sample on these pages inside it. Import it into Postman, Insomnia or a client generator, or hand it to an AI agent that should call the API for you. It needs no key.