TUS Resumable Upload Service
Last updated: January 2024
1. Service Overview
The TUS (Tus Resumable Upload) service enables reliable, resumable file uploads for Blood Message Guide community content. This service implements the TUS protocol v1.0.0 for handling large file uploads with automatic resume capability.
1.1 Key Features
- Resumable uploads for interrupted transfers
- Support for large files up to 2GB
- Chunked upload with progress tracking
- Automatic retry mechanism
- Cross-origin resource sharing (CORS) support
- Secure upload with authentication
2. Supported File Types
2.1 Images
- JPEG (.jpg, .jpeg) - up to 50MB
- PNG (.png) - up to 50MB
- WebP (.webp) - up to 50MB
- GIF (.gif) - up to 20MB
2.2 Videos
- MP4 (.mp4) - up to 500MB
- WebM (.webm) - up to 500MB
- MOV (.mov) - up to 500MB
2.3 Documents
- PDF (.pdf) - up to 100MB
- Text files (.txt) - up to 10MB
- Markdown (.md) - up to 10MB
3. API Endpoints
3.1 Base URL
https://api.bloodmessage.org/tus/
3.2 Core Endpoints
Method | Endpoint | Description |
---|---|---|
POST | /files/ | Create new upload |
HEAD | /files/{id} | Get upload status |
PATCH | /files/{id} | Upload file chunk |
DELETE | /files/{id} | Cancel upload |
4. Authentication
4.1 API Key Authentication
Include your API key in the request headers:
Authorization: Bearer YOUR_API_KEY
4.2 User Authentication
For user-specific uploads, include user token:
X-User-Token: USER_SESSION_TOKEN
5. Upload Process
5.1 Step 1: Create Upload
POST /files/
Content-Type: application/json
{
"filename": "screenshot.jpg",
"filesize": 1048576,
"filetype": "image/jpeg",
"metadata": {
"description": "Boss battle screenshot",
"category": "gameplay"
}
}
5.2 Step 2: Upload Chunks
PATCH /files/{upload-id}
Content-Type: application/offset+octet-stream
Upload-Offset: 0
Content-Length: 262144
[binary data chunk]
5.3 Step 3: Verify Completion
HEAD /files/{upload-id}
Response:
Upload-Offset: 1048576
Upload-Length: 1048576
6. Error Handling
6.1 Common Error Codes
Code | Status | Description |
---|---|---|
400 | Bad Request | Invalid request format |
401 | Unauthorized | Invalid or missing authentication |
413 | Payload Too Large | File exceeds size limit |
415 | Unsupported Media Type | File type not allowed |
460 | Checksum Mismatch | File integrity check failed |
7. Rate Limits
7.1 Upload Limits
- Maximum 10 concurrent uploads per user
- Maximum 100 uploads per hour per user
- Maximum 5GB total upload per day per user
- Chunk size: 256KB - 10MB
7.2 API Request Limits
- 1000 requests per hour per API key
- 100 requests per minute per IP address
- Rate limit headers included in responses
8. Security Features
8.1 File Validation
- MIME type verification
- File signature validation
- Malware scanning
- Content policy enforcement
8.2 Data Protection
- TLS 1.3 encryption in transit
- AES-256 encryption at rest
- Automatic virus scanning
- Secure file storage with access controls
9. Client Libraries
9.1 Official Libraries
- JavaScript: @bloodmessage/tus-js-client
- Python: bloodmessage-tus-py
- PHP: bloodmessage/tus-php
- Java: org.bloodmessage.tus-java
9.2 Example Implementation
// JavaScript example
import { Upload } from '@bloodmessage/tus-js-client';
const upload = new Upload(file, {
endpoint: 'https://api.bloodmessage.org/tus/files/',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
},
metadata: {
filename: file.name,
filetype: file.type
},
onSuccess: () => console.log('Upload completed!'),
onError: (error) => console.error('Upload failed:', error)
});
upload.start();
10. Service Level Agreement
10.1 Availability
- 99.9% uptime guarantee
- 24/7 monitoring and alerting
- Automatic failover and recovery
- Regular maintenance windows (announced)
10.2 Performance
- Average response time: <200ms
- Upload throughput: Up to 100MB/s
- Global CDN for optimal performance
- Auto-scaling based on demand
11. Support and Contact
For TUS service support and technical questions:
Technical Support: [email protected]
API Documentation: docs.bloodmessage.org/tus
Status Page: status.bloodmessage.org
Response Time: Technical issues resolved within 4 hours