Upload Methods
Simple PUT Upload
Upload a file directly to a specific path:Destination path for the file
Size of the file in bytes
Authentication password (alternative to
?pw= parameter)Multipart POST Upload
Upload files using standard HTML form multipart encoding:File to upload. Multiple files can be included with multiple
f parametersUpload Modifiers
Both PUT and POST uploads support these modifiers:URL Parameters
Return JSON response with upload metadata
Checksum algorithm. Options:
no (disable), md5, sha1, sha256, b2 (blake2b), b2s (blake2s)Overwrite existing files (requires delete permission)
Append to existing file instead of overwriting
Compress with gzip. Optional compression level 0-9 (default: 9)
Compress with xz/lzma. Optional compression level 0-9 (default: 1)
Generate random filename with specified number of characters
Auto-delete file after specified seconds (requires volume lifetime setting)
HTTP Headers
Response format:
url (just URL), json (full metadata)Same as
?rand= parameter - generate random filenameSame as
?life= parameter - file lifetime in secondsSame as
?replace parameter - overwrite existing filesSame as
?ck= parameter - checksum algorithmup2k Resumable Upload Protocol
The up2k protocol provides resumable, chunked uploads with integrity verification. It’s the most reliable method for large files.How up2k Works
- Client splits file into chunks (1-32 MiB each, max 256-4096 chunks)
- Client hashes each chunk with SHA-512
- Handshake: Client sends hashlist to server
- Server creates wark (upload identifier) and sparse file
- Client uploads chunks (can be parallel, non-sequential)
- Server validates each chunk hash
- Final handshake: Server confirms all chunks received
Chunk Size Calculation
Chunk sizes are automatically determined by file size:| File Size | Chunk Size | Max Chunks |
|---|---|---|
| ≤ 256 MiB | 1.0 MiB | 256 |
| ≤ 384 MiB | 1.5 MiB | 256 |
| ≤ 512 MiB | 2.0 MiB | 256 |
| ≤ 1 GiB | 4.0 MiB | 256 |
| ≤ 4 GiB | 16 MiB | 256 |
| ≤ 128 GiB | 32 MiB | 4096 |
| ≤ 1 TiB | 256 MiB | 4096 |
| > 1 TiB | up to 8 GiB | 4096 |
Step 1: Handshake (Initial)
Send file metadata and chunk hashes:Upload identifier - unique ID for this upload session
URL where file will be accessible after upload
List of chunk hashes that need to be uploaded (empty if file already exists)
Step 2: Upload Chunks
Upload each required chunk:Comma-separated list of chunk hashes being uploaded. Can upload multiple consecutive chunks in one request
The wark identifier from the initial handshake
For partial chunk uploads - byte offset within the chunk (resumable even within a chunk)
Step 3: Final Handshake
Confirm upload completion:need: []if all chunks receivedneed: ["hash1", "hash2"]if chunks are missing (re-upload them)
Response Examples
Successful Upload (JSON)
up2k Handshake Response
Upload Features
Deduplication
up2k automatically detects duplicate files:- If file with same content exists, returns existing file URL
- Can create symlinks to duplicates (if enabled with
--dedup) - Content-based matching via SHA-512 hashes
Resume Support
- up2k uploads resume automatically if interrupted
- Re-upload same file - server skips already-received chunks
- Works even after browser/client restart
- Subchunk resume supported with
X-Up2k-Subcheader
Parallel Uploads
- up2k chunks can be uploaded in parallel
- Non-sequential upload order supported
- Improves performance on fast connections
Write-Only Folders
Withg or G permission:
- Users can upload but not browse
g: Cannot see file URLsG: Receive file URL/key after upload
Error Handling
Bad request - invalid parameters, missing headers, or chunk mismatch
Authentication required - missing or invalid credentials
Insufficient permissions - user lacks write access
File too large - exceeds volume size limits
Server error - disk full, permissions issue, or corruption detected