If your app lets users add images — avatars, listings, attachments — you need somewhere to put them and a fast way to serve them back. You can stand up your own storage + resizing + CDN, or you can call an image hosting API and move on. Here's how to do the latter for free.
The whole flow in one request
Create an API key in your account, then POST a file. You get back the asset URLs and metadata immediately:
curl -X POST https://swiftimg.com/v1/images \
-H "Authorization: Bearer $SWIFTIMG_KEY" \
-F file=@photo.jpg -F title="Sunset"
# {
# "id": "9fK2", "pageUrl": "https://swiftimg.com/i/9fK2",
# "directUrl": "https://i.swiftimg.com/originals/9fK2.jpg", ...
# }Prefer JavaScript? The zero-dependency client is a few lines:
import { createClient } from "@swiftimg/cli";
const swift = createClient({ apiKey: process.env.SWIFTIMG_KEY });
const { directUrl } = await swift.upload(file, { title: "Avatar" });What "free" includes
- Free, no-account uploads to start; API keys on the free tier.
- Automatic WebP
thumbanddisplayvariants. - Animated GIFs converted to animated WebP.
- Immutable, globally cached URLs — fast everywhere, with flat pricing.
Embedding what you get back
Serve the optimized variant and let the browser pick the size it needs:
<img src="https://i.swiftimg.com/variants/9fK2/display.webp" alt="Sunset" loading="lazy" />When you outgrow the free tier, paid plans add on-the-fly transforms, signed URLs, and custom domains — see the API docs and pricing, or how it compares to Cloudinary and ImgBB.