API reference
Upload and download files from scripts and apps over plain HTTP. No API key is needed.
Quick start
This uploads a file and prints its link:
curl -F "files[]=@report.pdf" "https://fileshare.mad-gamer.com/?api=1"
The response body is only the share link, so it's easy to use in a shell script.
Upload files
POST /?api=1 with the content type multipart/form-data.
- Send each file as a part named
files[], up to 1,000 per request. Further files are ignored. - Two or more files are stored as one uncompressed
files.zipwith one link. api=1must be in the query string. Without it you get an HTML page.
Upload fields
All are optional form fields.
| Field | Value | Default |
|---|---|---|
expiration | When the link expires. See Setting the expiry. | 24 hours |
expires_hours | Whole hours until the link expires. | None |
no_expiration | A true value removes the expiry. | False |
permanent | A true value keeps the file after downloads. Otherwise it is deleted after the first completed download. | False |
response | json returns a JSON object instead of plain text. format is an alias, and either can also go in the query string. | Plain text |
True values are 1, true, yes and on. False values are 0, false, no and off.
Setting the expiry
expiration accepts:
- A number of seconds, such as
3600. - A number and a unit, such as
30m,24h,7dor2w. Units are seconds, minutes, hours, days and weeks, written likes,min,hr,dayorweeks. neverfor no expiry.0,none,no,off,false,disabledandno_expirationmean the same.custom, together withcustom_expiration_hoursset to a whole number of hours.
Aliases and precedence
The first of these that has a value wins:
no_expiration, when true.expiration,expires,expire_after.expires_in,expires_in_seconds,expiration_seconds.expires_hours,expires_in_hours,expiration_hours.
With expiration=custom, the hours can come from any of custom_expiration_hours, expires_hours, expires_in_hours or expiration_hours.
Upload responses
Default success
HTTP 200, text/plain. The body is the share link.
JSON success
With response=json: HTTP 200, application/json.
{
"link": "https://fileshare.mad-gamer.com/0123456789abcdef0123456789abcdef",
"token": "0123456789abcdef0123456789abcdef",
"expires": "2026-11-02T17:00:00-05:00",
"expires_timestamp": 1793664000,
"permanent": false
}
expires and expires_timestamp are null when the link never expires.
Errors
Check the body, not only the status. Upload errors return HTTP 200 with an error key, even when you didn't ask for JSON.
{"error": "Expiration must be seconds, a duration like 24h or 7d, or never."}
Fast, resumable uploads
For large files, use the chunked API. Chunks can be sent in any order and at the same time, and each one goes straight into place, so a failed chunk is the only thing you resend. Unlike the upload above, these routes use normal HTTP status codes for errors, with an error key in the JSON body.
POST /api/v2/uploadswith a JSON body listing the files, plus any of the upload fields. The response gives anidand achunk_size. Treat the ID as a secret.PUT /api/v2/uploads/<id>/files/<n>/<offset>for each chunk, wherenis the file's position in the list, counting from 0, andoffsetis a multiple ofchunk_size. Every chunk is exactlychunk_sizebytes, except the last chunk of a file.POST /api/v2/uploads/<id>/complete. The response has the same JSON as a normal upload. It returns 409 if chunks are missing.
curl -H "Content-Type: application/json" \
-d '{"files":[{"name":"movie.mkv","size":1073741824}],"expiration":"7d"}' \
"https://fileshare.mad-gamer.com/api/v2/uploads"
To resume, GET /api/v2/uploads/<id> lists the offsets already received for each file. DELETE /api/v2/uploads/<id> cancels. Unfinished uploads are deleted after 24 hours.
Limits
Each address can make up to 120 uploads an hour and upload up to 200 GB a day, and uploads stop if the server runs low on space. Multipart uploads report these as an error key. The chunked API uses status 429, or 507 for low space.
Download a file
The token is the last part of a share link. GET /<token> returns the HTML download page and never touches the file. To fetch the file itself:
POST /<token> with the form field download_token set to the token.
curl -OJ -d "download_token=0123456789abcdef0123456789abcdef" "https://fileshare.mad-gamer.com/0123456789abcdef0123456789abcdef"
A one-time file is deleted once the server has sent its last byte, which can be slightly before your client has received it. A download that stops earlier leaves the file in place. Responses:
| Status | Meaning |
|---|---|
| 200 | The file, as application/octet-stream, with its name in Content-Disposition. |
| 206 | Part of the file, for a request with a Range header. |
| 400 | The token isn't valid. The body is an HTML page. |
| 404 | The file doesn't exist or was already removed. The body is an HTML page. |
| 410 | The link has expired. The body is an HTML page. |
| 416 | The requested range is outside the file. |
To resume a download, send a Range header with the same POST request. With curl, add -C -.
More examples
Several files, kept for 7 days, with a JSON response
curl -F "files[]=@one.txt" -F "files[]=@two.txt" \
-F "expiration=7d" -F "permanent=1" -F "response=json" \
"https://fileshare.mad-gamer.com/?api=1"
Python
import requests
with open("report.pdf", "rb") as f:
r = requests.post(
"https://fileshare.mad-gamer.com/?api=1",
files={"files[]": f},
data={"expiration": "24h", "response": "json"},
)
result = r.json()
if "error" in result:
raise RuntimeError(result["error"])
print(result["link"])
JavaScript
const form = new FormData();
form.append("files[]", file);
form.append("expiration", "7d");
form.append("response", "json");
const response = await fetch("https://fileshare.mad-gamer.com/?api=1", { method: "POST", body: form });
const result = await response.json();
if (result.error) throw new Error(result.error);
console.log(result.link);
PowerShell 7
$form = @{ "files[]" = Get-Item "report.pdf"; response = "json" }
$result = Invoke-RestMethod -Uri "https://fileshare.mad-gamer.com/?api=1" -Method Post -Form $form
if ($result.error) { throw $result.error }
$result.link