Image Hosting API: Upload Images with One POST Request

The MyIMGs.org image hosting API uploads an image and returns a direct link in one request. Send a file or a base64 image with your API key and get JSON back, ready for apps, websites and forums. Every image is served from a CDN over HTTPS. API access is included in every Pro plan, from $3.29 a month.

How to get an image hosting API key

  1. Create a free MyIMGs.org account and verify your email.
  2. Choose a plan on the Pro plans and prices page. API access is part of every Pro plan.
  3. Open your account page and choose Create API key.
  4. Copy the key. It is shown once. If you lose it, make a new key and the old one stops working.

Upload an image with curl (quick start)

Replace YOUR_API_KEY with your key and run:

curl -X POST https://myimgs.org/api/v1/upload \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "image=@photo.jpg"

The reply is JSON. Use data.url as the direct image link and data.viewer_url for the page that shows the image:

{
  "success": true,
  "status": 201,
  "data": {
    "id": "AbC12xyz",
    "title": "photo",
    "name": "photo",
    "extension": "jpg",
    "size": 245891,
    "optimized": false,
    "url": "https://myimgs.org/storage/images/61178/photo.jpg",
    "viewer_url": "https://myimgs.org/image/AbC12xyz",
    "url_viewer": "https://myimgs.org/image/AbC12xyz",
    "display_url": "https://myimgs.org/storage/images/61178/photo.jpg",
    "width": 1600,
    "height": 1067,
    "time": 1762000000,
    "expiration": 0,
    "image": {
      "filename": "photo.jpg",
      "name": "photo",
      "mime": "image/jpeg",
      "extension": "jpg",
      "url": "https://myimgs.org/storage/images/61178/photo.jpg"
    }
  }
}

Image upload API reference

One endpoint: POST https://myimgs.org/api/v1/upload

Authentication

Send your key in the Authorization: Bearer YOUR_API_KEY header. For scripts written for ImgBB, a key form field works too. Use the header when you can, because form fields can end up in server logs.

Request fields

FieldRequiredDescription
imageYesThe image file (multipart form data), or a base64 string. A data URI such as data:image/png;base64,... is accepted.
nameNoFile name for the stored image. Only letters, numbers, dash and underscore are kept. Defaults to the uploaded file name.
optimizeNoSend 1 or true to convert JPG, PNG and WebP images to compressed WebP when that makes the file smaller. GIFs are never converted. The reply shows the final file in data.extension and data.url.
keyNoYour API key, if you do not use the Authorization header.

Response fields

FieldDescription
successtrue when the image was stored.
data.idShort ID of the image.
data.nameStored file name, without extension.
data.extensionjpg, png, gif or webp, taken from the real file content.
data.sizeStored size in bytes.
data.optimizedtrue when the image was converted to WebP because you sent optimize, otherwise false.
data.urlDirect image link. Use it in <img> tags, BBCode and apps.
data.viewer_urlLink to the page that displays the image. data.url_viewer holds the same link.
data.titleSame as data.name.
data.display_urlSame as data.url.
data.width, data.heightImage size in pixels.
data.timeUpload time as a Unix timestamp.
data.expirationAlways 0: images do not expire.
data.imageThe stored file: filename, name, mime, extension and url.
statusThe HTTP status code, 201 when the image was stored.

Image upload API examples in JavaScript, Python and PHP

JavaScript (Node.js 18 or newer)

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://myimgs.org/api/v1/upload", {
  method: "POST",
  headers: { Authorization: "Bearer YOUR_API_KEY" },
  body: form,
});
const json = await res.json();
console.log(json.data.url);

Python (requests)

import requests

r = requests.post(
    "https://myimgs.org/api/v1/upload",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    files={"image": open("photo.jpg", "rb")},
)
print(r.json()["data"]["url"])

PHP (cURL)

$ch = curl_init("https://myimgs.org/api/v1/upload");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer YOUR_API_KEY"],
    CURLOPT_POSTFIELDS => ["image" => new CURLFile("photo.jpg")],
    CURLOPT_RETURNTRANSFER => true,
]);
$data = json_decode(curl_exec($ch), true);
echo $data["data"]["url"];

Upload a base64 image

Useful when the image only exists in memory, for example a canvas or a screenshot:

curl -X POST https://myimgs.org/api/v1/upload \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "image=$(base64 -w0 photo.jpg)" \
  -F "name=photo"

Large photos upload faster when they are smaller. You can compress images in your browser with the free image compressor before you send them.

Image hosting API errors and status codes

Errors return JSON like {"success": false, "error": "message"} with one of these status codes:

StatusMeaning
201Image stored. The response holds the links.
401The API key is missing or wrong.
403The account has no active Pro plan, or the account is disabled.
413The image is larger than 96 MB.
422No image was sent, the base64 text is invalid, or the file is not a JPG, PNG, GIF or WebP image.
429More than 60 requests in one minute. Wait and retry.

Image hosting API limits

Image size96 MB per image
FormatsJPG, PNG, GIF (animation kept) and WebP
Rate limit60 requests per minute for each account
StorageUnlimited storage on Pro plans
DeliveryCDN over HTTPS, direct links work in forums, websites and apps
InputFile upload or base64

ImgBB API alternative

If you already upload with the ImgBB API, switching takes two changes: point the request at https://myimgs.org/api/v1/upload and use your MyIMGs.org key. The key and image fields work the same way, and the direct link comes back in data.url. The reply also uses ImgBB's names for url_viewer, display_url, title, width, height, time, expiration and image. It has no thumb, medium or delete_url, and it does not fetch an image from a URL or take an expiration setting. Pro plans add 96 MB images, no ads and unlimited storage.

Image hosting API pricing

The API is included in every Pro plan. Pick the billing period that suits you:

Monthly Plan

$11.49 a month

Annual Plan

$6.49 a month

billed $77.88

3-Year Plan

$3.29 a month

billed $118.44

See Pro plans and get your API key

Image hosting API FAQ

Is there a free image hosting API?

Uploading with the API needs a Pro plan, which starts at $3.29 a month. A free account hosts up to 20 images from the website and has no API key.

What is the maximum image size for the API?

96 MB per image. Larger files get a 413 error.

Which image formats does the image upload API accept?

JPG, PNG, GIF and WebP. The format is read from the file itself, so a file with the wrong extension is still checked by its real content, and anything that is not a real image is refused. Animated GIFs stay animated.

Can I upload an image from a URL?

No. Send the file as multipart form data, or send the image as a base64 string. Fetching URLs is left out on purpose for security.

Can I delete images with the API?

Not yet. Upload is the only API call for now. Delete images from your dashboard.

How do I change or revoke my API key?

Use Make a new key on your account page. The old key stops working immediately, and the new key is shown once.

What is the API rate limit?

60 requests per minute for each account. Above that the API answers with status 429 until the minute is over.

Do images uploaded with the API expire?

No. There is no expiry setting. Images uploaded with your key stay on your account.

Does the API work with scripts written for ImgBB?

Yes for the upload call. Send the same key and image fields to the MyIMGs.org URL. The reply uses the same names for url, url_viewer, display_url, title, width, height, time, expiration and image. It has no thumb, medium or delete_url, and it does not take an image URL or an expiration setting.

MyIMGs.org is a free image hosting service. Upload an image on the home page without an account.