# File upload guide - Use a private upload link from the administrator, or send `Authorization: Bearer ` to the site root. Export the `UPLOAD_ID` environment variable to run the examples below with your ID. - To upload in a browser, open a private upload link with `&view=gui` appended and choose a file. ## HTTP upload Send one POST per file (up to 500000000 bytes) using either format. - With `application/octet-stream`, send the file as the request body with an accurate `Content-Length`. Set `X-File-Name` to the filename, percent-encoding non-ASCII characters and literal percent signs. - With `multipart/form-data`, send a single file in the `file` field. The curl and Python snippets are examples. Adapt them to your workflow or use any HTTP client that follows the request requirements above. ### curl ```sh curl --fail-with-body -sS -H "Authorization: Bearer $UPLOAD_ID" -H 'Content-Type: application/octet-stream' -H 'X-File-Name: YOUR_FILE_NAME' --data-binary '@/path/to/your/file' 'https://upload.mmdots.de/' ``` ### Python 3 This example uses the standard library and streams the file from disk. ```python import json import os from pathlib import Path from urllib.parse import quote from urllib.request import Request, urlopen file_path = Path('/path/to/your/file') with file_path.open('rb') as source: headers = { 'Authorization': 'Bearer ' + os.environ['UPLOAD_ID'], 'Content-Type': 'application/octet-stream', 'Content-Length': str(os.fstat(source.fileno()).st_size), 'X-File-Name': quote(file_path.name, safe=''), } request = Request('https://upload.mmdots.de/', data=source, headers=headers, method='POST') with urlopen(request, timeout=60) as response: print(json.load(response)['download_url']) ``` ## Responses HTTP 201 returns JSON with `file_id`, `filename`, `size` (in bytes), and `download_url`. Send a GET to `download_url` to download the file, or share it with the recipient. To safely retry an upload, set `Idempotency-Key` before the first attempt and reuse it with the same file. Use 1 to 128 ASCII letters, digits, periods, underscores, or hyphens. API errors contain `error` and `message`. Common statuses are 401 (invalid, expired, or revoked upload ID), 409 (upload limit or idempotency conflict), 413 (file too large), and 507 (storage unavailable).