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.

Upload fields

All are optional form fields.

FieldValueDefault
expirationWhen the link expires. See Setting the expiry.24 hours
expires_hoursWhole hours until the link expires.None
no_expirationA true value removes the expiry.False
permanentA true value keeps the file after downloads. Otherwise it is deleted after the first completed download.False
responsejson 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:

Aliases and precedence

The first of these that has a value wins:

  1. no_expiration, when true.
  2. expiration, expires, expire_after.
  3. expires_in, expires_in_seconds, expiration_seconds.
  4. 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.

  1. POST /api/v2/uploads with a JSON body listing the files, plus any of the upload fields. The response gives an id and a chunk_size. Treat the ID as a secret.
  2. PUT /api/v2/uploads/<id>/files/<n>/<offset> for each chunk, where n is the file's position in the list, counting from 0, and offset is a multiple of chunk_size. Every chunk is exactly chunk_size bytes, except the last chunk of a file.
  3. 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:

StatusMeaning
200The file, as application/octet-stream, with its name in Content-Disposition.
206Part of the file, for a request with a Range header.
400The token isn't valid. The body is an HTML page.
404The file doesn't exist or was already removed. The body is an HTML page.
410The link has expired. The body is an HTML page.
416The 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