Uploading files
POST /upload to store a file under your Hep.gg account, with size and MIME limits, response shape, and error codes.
Uploading files
POST
https://hep.gg/uploadAuth requiredUpload a file (multipart) to your account and get back its public URL.
Send a multipart form with one file part. The field name does not matter, the first file in the request is used. On success you get JSON with the upload's ID and public URL.
curl -X POST https://hep.gg/upload \
-H "Authorization: hyd-up-xxxxxxxxxxxx" \
-F "file=@screenshot.png"import { readFileSync } from "node:fs";
const form = new FormData();
form.append(
"upload", // any field name works; the first file wins
new Blob([readFileSync("screenshot.png")]),
"screenshot.png",
);
const res = await fetch("https://hep.gg/upload", {
method: "POST",
headers: { Authorization: "hyd-up-xxxxxxxxxxxx" },
body: form,
});
if (!res.ok) {
throw new Error(`upload failed: ${res.status}`);
}
const { ID, url } = await res.json();
console.log(ID, url);Request
Form fields
(file)filerequired
One file part in a
multipart/form-data body. The field name is ignored; the first file in the request is uploaded. The file's MIME type must satisfy your account's allowed-types list (see Limits).To shorten a URL or store text instead of a file, send a link field rather than a file part. That path is documented separately in URL shortener.
Response
A successful file upload returns 200 with both an ID and a url:
{
"ID": "abc123.png",
"url": "https://i.hep.gg/abc123.png"
}Response fields
IDstringoptional
The content ID, including the canonical file extension where the type warrants one (for example
.png, .gif, .mp4). This is the slug portion of the URL.urlstringoptional
The full public URL on your serve host. Use this value directly, do not assume the file is at
hep.gg/<ID>.Limits
Two gates apply to every upload, both sourced from your account settings (adjust them on the uploader Settings subpage):
Per-account limits
Max file sizenumberoptionaldefault:
25Maximum upload size in megabytes. Enforced against the request's
Content-Length, so it covers the whole request body. A request is rejected when its size in MB is greater than or equal to your ceiling. Default is 25 MB.Allowed MIME typesstring[]optionaldefault:
image/*A list of MIME patterns the upload must match. Patterns support a glob wildcard, so
image/* accepts any image type, */* accepts anything. The default behaves as image/* (images only).Errors
All error bodies use the standard error envelope. Status codes are exact:
| Status | When |
|---|---|
401 | Token missing, empty, or revoked. See Authentication. |
403 | Hep.gg is in a maintenance window (message references maintenance). Retry after a few minutes. |
403 | The request size is at or above your max file size ceiling (message: You may only upload files that are smaller than <N> MB). |
403 | Uploader access is suspended or not allowed (Forbidden / ACCESS_REQUIRED). |
400 | The file's MIME type is not in your allowed-types list, or no known file extension maps to it (Not allowed to upload files with the supplied Content-Type). |
400 | Multipart parse error, or a non-multipart request with no link property. |
500 | Storage write failed. |