Pricing Docs Blog About GitHub Get started
← Back to blog

The simplest image hosting API

Most projects don't need a media-processing platform. They need one call to upload an image and one URL back. Here's what a good image hosting API looks like — and how to use one.

Search for an "image hosting API" and you land on two extremes: consumer tools like imgbb with a single anonymous upload endpoint and no real auth, or enterprise platforms like Cloudinary with SDKs, transformation DSLs, and a $89/month floor. Most applications sit in the middle — they just need to accept an upload and return a durable URL. This is what that looks like done well.

The whole flow: two calls

Register once to get an API key, then POST a file. The response is a permanent CDN URL.

# 1. Register — returns your API key
curl -X POST https://api.pixelvault.dev/v1/auth/register \
  -d '{"email":"you@example.com","password":"secure-pass"}'

# 2. Upload — returns a permanent CDN URL
curl -X POST https://api.pixelvault.dev/v1/images \
  -H "Authorization: Bearer pv_live_xxx" \
  -F "file=@photo.jpg"

# { "id": "img_xyz", "url": "https://img.pixelvault.dev/proj_abc/img_xyz.jpg" }

What a good image hosting API needs

Before you pick one — or build your own on top of S3 — check for these:

  • Real authentication. Per-project API keys, not a single shared token. imgbb-style anonymous uploads don't cut it for production.
  • A global CDN with no egress fees. Serving is where naive S3 setups get expensive. Zero egress (via Cloudflare R2) means bandwidth doesn't bill you by surprise.
  • Idempotent, retry-safe uploads. Networks fail; a retried upload shouldn't create duplicates or error out.
  • Management, not just upload. List, fetch, and delete images by ID — the operations you need once real data accumulates.
  • An OpenAPI spec. A machine-readable contract means predictable error codes and easy client generation (and lets AI agents consume it directly).
  • Broad format support. JPEG, PNG, GIF, WebP, AVIF, and SVG in, correct Content-Type out.

Predictable errors

A good API fails clearly: 401 for a bad key, 413 when a file exceeds your plan's limit, 415 for an unsupported type. No guessing, no HTML error pages — just JSON your code (or your agent) can branch on. PixelVault publishes the full contract as an OpenAPI 3.1 spec.

Use it from anything

Because it's a plain REST API, the same two calls work from curl, Node, Python, Go, a CI job, or an AI agent. If you're wiring it into a coding agent specifically, see our guide to image hosting for AI agents. Comparing options? Here are the best Cloudinary alternatives and how PixelVault stacks up against ImgBB.

Free to start

PixelVault's free tier includes 200 MB storage, 500 uploads/month, and 1 GB bandwidth — no credit card, no trial expiry. Paid plans start at $9/month.

Read the API docs →