imgHost.cc - API Documentation

This page documents how to upload images to imgHost.cc via HTTP requests. Both form uploads and raw byte uploads are supported. Any requests without a User-Agent header set will be rejected.

1. Multipart Form Upload

Endpoint:

POST https://imghost.cc/upload

The request must include a form field named file.

📦 curl

curl -F "[email protected]" https://imghost.cc/upload

💻 JavaScript (Browser)

const formData = new FormData();
formData.append("file", fileInput.files[0]);

fetch("https://imghost.cc/upload", {
  method: "POST",
  body: formData
})
  .then(res => res.json())
  .then(console.log)
  .catch(console.error);

🐍 Python (requests)

import requests

with open("image.png", "rb") as f:
    files = {"file": f}
    response = requests.post("https://imghost.cc/upload", files=files)

print(response.json())

2. Raw Bytes Upload

Endpoint:

POST https://imghost.cc/api/upload

Send the raw image bytes as the body, and set the Content-Type header to the appropriate image MIME type.

📦 curl

curl -X POST https://imghost.cc/api/upload \
  -H "Content-Type: image/png" \
  --data-binary "@image.png"

💻 JavaScript (Browser)

const file = fileInput.files[0];

fetch("https://imghost.cc/api/upload", {
  method: "POST",
  headers: {
    "Content-Type": file.type
  },
  body: file
})
  .then(res => res.json())
  .then(console.log)
  .catch(console.error);

🐍 Python (requests)

import requests

with open("image.png", "rb") as f:
    headers = {"Content-Type": "image/png"}
    response = requests.post("https://imghost.cc/api/upload", headers=headers, data=f)

print(response.json())

Responses

Success Response (200 OK):

{
  "filename": "imghost.cc__example.jpeg",
  "error": null
}

Error Response (400 Bad Request):

{
  "filename": null,
  "error": "File too large"
}

CORS Policy

Good news: There are no CORS restrictions on imghost.cc right now.
You can upload directly from web apps or scripts hosted on other origins/domains without needing a proxy.

← Back to Home