Upload API reference
Send a file or a remote URL and get a compact, shareable link back. No SDK and no API key, just standard HTTP.
https://imagify-host.pages.dev
Quick start
Upload a local file with one command. The response contains a short link in src.
curl -X POST https://imagify-host.pages.dev/upload -F "file=@photo.jpg"
If upload protection is on, add your code in the x-upload-code header. See Upload code.
Upload a file
/uploadmultipart/form-dataSend the file in the file field. The endpoint returns an array with one result per file.
curl -X POST https://imagify-host.pages.dev/upload \
-H "x-upload-code: YOUR_CODE" \
-F "file=@photo.jpg"const form = new FormData();
form.append("file", fileInput.files[0]);
const res = await fetch("https://imagify-host.pages.dev/upload", {
method: "POST",
headers: { "x-upload-code": "YOUR_CODE" }, // only if an upload code is enabled
body: form,
});
const [file] = await res.json();
console.log("https://imagify-host.pages.dev" + file.src);import requests
r = requests.post(
"https://imagify-host.pages.dev/upload",
headers={"x-upload-code": "YOUR_CODE"}, # only if an upload code is enabled
files={"file": open("photo.jpg", "rb")},
)
print("https://imagify-host.pages.dev" + r.json()[0]["src"])
Upload from a URL
/uploadapplication/jsonLet the server fetch remote files for you. Send one url or an array of urls.
curl -X POST https://imagify-host.pages.dev/upload \
-H "content-type: application/json" \
-d '{"url":"https://example.com/photo.jpg"}'const res = await fetch("https://imagify-host.pages.dev/upload", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ urls: ["https://example.com/a.jpg", "https://example.com/b.png"] }),
});
console.log(await res.json());import requests
r = requests.post(
"https://imagify-host.pages.dev/upload",
json={"urls": ["https://example.com/a.jpg", "https://example.com/b.png"]},
)
print(r.json())
Upload code
When the owner sets an upload code, uploads need it. Send it in any one of these places:
- the
x-upload-codeheader (recommended) - an
Authorization: Bearer YOUR_CODEheader - the
?authCode=YOUR_CODEquery parameter
Cross-origin requests are allowed, so you can call /upload from a browser app too.
Response
A successful upload returns an array of file objects. Use src for the short link.
[
{
"src": "/s/Ab3xK9.jpg",
"long": "/file/<id>.jpg",
"id": "<id>",
"name": "photo.jpg",
"size": 123456,
"type": "image/jpeg"
}
]| Field | Meaning |
|---|---|
src | Short link, such as /s/Ab3xK9.jpg |
long | Direct link that includes the file id |
id | File id, used by the admin endpoints |
name, size, type | Stored file name, size in bytes and detected MIME type |
Query options
| Parameter | Effect |
|---|---|
?returnFormat=full | Return absolute URLs instead of relative paths |
?channel=r2 or ?channel=telegram | Choose a storage channel that is configured on the server |
Errors
Errors return JSON with an error message.
| Status | When it happens |
|---|---|
400 | No file or URL was sent, the file type is not allowed, or the channel is not available |
401 | An upload code is required and was missing or wrong |
500 | The server is not fully set up. The message says what is missing |
Admin endpoints
These need a signed-in admin session, or an Authorization: Bearer header with the admin password.
/uploadUpload a file or remote URLs/api/sessionSession and setup status/api/files?cursor=List uploaded files/api/filesDelete files by idcurl -X DELETE "https://imagify-host.pages.dev/api/files" \
-H "content-type: application/json" \
-H "Authorization: Bearer YOUR_ADMIN_PASSWORD" \
-d '{"ids":["FILE_ID"]}'