Developers · free API

Free image hosting API

Upload images from your apps, bots and scripts. One request returns a direct link, HTML, BBCode and Markdown.

Get an API key

Authentication

Create a key under Dashboard → Settings → API Keys. Send it with every request:

Header
Authorization: Bearer YOUR_API_KEY

Keep keys on your server. Anyone with a key can upload to and delete from your account.

Upload an image

POST /api/v1/upload

FieldDescription
imageImage file (multipart), up to 4 MB
urlPublic image URL to fetch instead, up to 32 MB
nameOptional title, used for the image page
expiresInOptional auto-delete: 1h (1 hour), 1d (1 day), 1w (1 week), 1m (1 month), 6m (6 months)
curl: upload a file
curl -X POST https://imgsharehub.com/api/v1/upload \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "[email protected]" \
  -F "name=Login error"
curl: upload from a URL
curl -X POST https://imgsharehub.com/api/v1/upload \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/photo.jpg", "expiresIn": "1w"}'
Node.js
import { readFile } from "node:fs/promises";

const form = new FormData();
form.append("image", new Blob([await readFile("photo.jpg")]), "photo.jpg");

const res = await fetch("https://imgsharehub.com/api/v1/upload", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.IMGSHAREHUB_KEY}` },
  body: form,
});
const { data } = await res.json();
console.log(data.direct_url);
Python
import os, requests

res = requests.post(
    "https://imgsharehub.com/api/v1/upload",
    headers={"Authorization": f"Bearer {os.environ['IMGSHAREHUB_KEY']}"},
    files={"image": open("photo.jpg", "rb")},
)
print(res.json()["data"]["direct_url"])

Response (201)

JSON
{
  "success": true,
  "data": {
    "id": "a1b2c3",
    "url": "https://imgsharehub.com/a1b2c3",
    "direct_url": "https://imgsharehub.com/i/a1b2c3.webp",
    "html": "<a href=\"https://imgsharehub.com/a1b2c3\" target=\"_blank\"><img src=\"https://imgsharehub.com/i/a1b2c3.webp\" alt=\"Image hosted on ImgShareHub\" /></a>",
    "bbcode": "[url=https://imgsharehub.com/a1b2c3][img]https://imgsharehub.com/i/a1b2c3.webp[/img][/url]",
    "markdown": "[![Image](https://imgsharehub.com/i/a1b2c3.webp)](https://imgsharehub.com/a1b2c3)",
    "width": 1920,
    "height": 1080,
    "size": 284512,
    "private": false,
    "expires_at": null
  }
}

Get or delete an image

Works for images owned by the key's account. GET also returns created_at and views.

Get
curl https://imgsharehub.com/api/v1/images/a1b2c3 \
  -H "Authorization: Bearer YOUR_API_KEY"
Delete
curl -X DELETE https://imgsharehub.com/api/v1/images/a1b2c3 \
  -H "Authorization: Bearer YOUR_API_KEY"

Limits and errors

Each key can upload 100 images per hour and make 1,000 other requests per hour. Every response includes X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers. Errors return {"success": false, "error": "..."}.

StatusMeaning
400Missing image, unsupported file, file too large, or a URL that can't be fetched
401Missing, unknown or revoked API key
404Image not found, or it doesn't belong to your key's account
429Rate limit reached; see the X-RateLimit-Reset header
500Something went wrong on our side; retry later

No code needed

API questions

Is the ImgShareHub API free?

Yes. Create up to 5 keys from your account settings. Each key can upload 100 images per hour.

What is the maximum file size?

Files sent directly in the request can be up to 4 MB. For larger images, up to 32 MB, send a public image URL and ImgShareHub downloads it.

Where do images uploaded with the API appear?

In the dashboard of the account that owns the key, alongside images you upload on the website.

Can uploaded images expire automatically?

Yes. Set expiresIn to one of: 1h (1 hour), 1d (1 day), 1w (1 week), 1m (1 month), 6m (6 months). Expired images stop loading immediately.