API Documentation
Upload files programmatically using our simple REST API. Perfect for scripts, ShareX, and custom integrations.
Quick Start
Upload a file with a single cURL command:
curl https://mbr.pub/api/upload -F "[email protected]"That's it! The API will return a JSON response with your file URL.
Upload Endpoint
POST
/api/uploadSimple FormData upload endpoint for scripts and API integrations. No authentication required for anonymous uploads up to 100MB.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
filerequired | file | — | The file to upload (max 100MB for anonymous) |
expiryDays | number | 365 | Days until file expires (1-3650) |
maxDownloads | number | 0 | Max downloads before expiry (0 = unlimited) |
randomizeName | boolean | false | Randomize filename for privacy |
urlType | string | "short" | "uuid" or "short" URL format |
Examples
Basic Upload
curl https://mbr.pub/api/upload -F "[email protected]"Upload with Expiry & Download Limit
curl https://mbr.pub/api/upload -F "expiryDays=7" -F "maxDownloads=10" -F "[email protected]"Private Upload with Randomized Name
curl https://mbr.pub/api/upload -F "randomizeName=true" -F "expiryDays=1" -F "[email protected]"Authenticated Upload (Unlimited Size)
Use your API key from Settings for unlimited file sizes and file management.
curl https://mbr.pub/api/files -H "X-API-Key: your-api-key-here" -F "[email protected]"PowerShell (Windows)
$file = Get-Item "file.png"
$form = @{ file = $file }
Invoke-RestMethod -Uri "https://mbr.pub/api/upload" -Method Post -Form $formPython
1import requests
2
3with open('image.png', 'rb') as f:
4 response = requests.post(
5 'https://mbr.pub/api/upload',
6 files={'file': f},
7 data={'expiryDays': 7}
8 )
9 print(response.json())JavaScript (Node.js)
1const fs = require('fs');
2const FormData = require('form-data');
3
4const form = new FormData();
5form.append('file', fs.createReadStream('image.png'));
6form.append('expiryDays', '30');
7
8fetch('https://mbr.pub/api/upload', {
9 method: 'POST',
10 body: form
11})
12.then(res => res.json())
13.then(data => console.log(data));PHP
1<?php
2$file = new CURLFile('image.png');
3
4$ch = curl_init('https://mbr.pub/api/upload');
5curl_setopt_array($ch, [
6 CURLOPT_POST => true,
7 CURLOPT_RETURNTRANSFER => true,
8 CURLOPT_POSTFIELDS => [
9 'file' => $file,
10 'expiryDays' => 30
11 ]
12]);
13
14$response = curl_exec($ch);
15curl_close($ch);
16
17$data = json_decode($response, true);
18print_r($data);Go
1package main
2
3import (
4 "bytes"
5 "fmt"
6 "io"
7 "mime/multipart"
8 "net/http"
9 "os"
10)
11
12func main() {
13 file, _ := os.Open("image.png")
14 defer file.Close()
15
16 body := &bytes.Buffer{}
17 writer := multipart.NewWriter(body)
18 part, _ := writer.CreateFormFile("file", "image.png")
19 io.Copy(part, file)
20 writer.WriteField("expiryDays", "30")
21 writer.Close()
22
23 req, _ := http.NewRequest("POST", "https://mbr.pub/api/upload", body)
24 req.Header.Set("Content-Type", writer.FormDataContentType())
25
26 resp, _ := http.DefaultClient.Do(req)
27 defer resp.Body.Close()
28
29 result, _ := io.ReadAll(resp.Body)
30 fmt.Println(string(result))
31}Ruby
1require 'net/http'
2require 'uri'
3require 'json'
4
5uri = URI('https://mbr.pub/api/upload')
6form_data = [
7 ['file', File.open('image.png')],
8 ['expiryDays', '30']
9]
10
11response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
12 request = Net::HTTP::Post.new(uri)
13 request.set_form(form_data, 'multipart/form-data')
14 http.request(request)
15end
16
17puts JSON.parse(response.body)C#
1using var client = new HttpClient();
2using var form = new MultipartFormDataContent();
3
4var fileContent = new ByteArrayContent(File.ReadAllBytes("image.png"));
5form.Add(fileContent, "file", "image.png");
6form.Add(new StringContent("30"), "expiryDays");
7
8var response = await client.PostAsync("https://mbr.pub/api/upload", form);
9var json = await response.Content.ReadAsStringAsync();
10Console.WriteLine(json);Response
Success Response
1{
2 "success": true,
3 "fileId": "abc123xyz",
4 "fileUrl": "/file/abc123xyz",
5 "fileName": "image.png",
6 "deleteKey": "del_xxxxxxxxxxxxx",
7 "expiresAt": "2026-01-01T00:00:00.000Z"
8}Save the deleteKey to delete the file later. The full URL is https://mbr.pub{fileUrl}.
Error Response
{
"error": "File too large. Maximum size is 100MB for the legacy API."
}Delete File
DELETE
/api/files/{fileId}Delete a file using the deleteKey returned from upload.
curl https://mbr.pub/api/files/abc123xyz -X DELETE -H "Authorization: Bearer a1b2c3d4e5f6"ShareX Configuration
Copy the configuration below to use mbr.pub with ShareX:
1{
2 "Version": "14.0.0",
3 "Name": "mbr.pub",
4 "DestinationType": "ImageUploader, FileUploader",
5 "RequestMethod": "POST",
6 "RequestURL": "https://mbr.pub/api/upload",
7 "Body": "MultipartFormData",
8 "FileFormName": "file",
9 "URL": "https://mbr.pub{json:fileUrl}",
10 "DeletionURL": "https://mbr.pub/api/files/{json:fileId}",
11 "ErrorMessage": "{json:error}"
12}Save this as mbr.pub.sxcu and double-click to import into ShareX.
Limits
| Feature | Anonymous | Authenticated |
|---|---|---|
| Max file size | 100 MB | Unlimited* |
| File expiry range | 1-3650 days | 1-3650 days |
| File management | Delete key only | Full dashboard |
*Subject to your account's storage limit.