Upload dan serve files dengan permanent URL. Simple, fast, dan developer-friendly.
https://daffafile.ayiem.workers.dev/api
Semua endpoint admin memerlukan header X-Admin-Key dengan API key yang valid.
Health check untuk monitoring.
curl https://daffafile.ayiem.workers.dev/api/health
Response:
{
"success": true,
"service": "daffa-file",
"timestamp": "2026-08-21T20:00:00.000Z"
}
Upload file baru (max 100MB). Untuk file lebih besar, gunakan chunked upload.
| Parameter | Type | Description |
|---|---|---|
file | File | File to upload (multipart/form-data) |
curl -X POST https://daffafile.ayiem.workers.dev/api/upload \
-F "file=@image.png"
Response:
{
"success": true,
"url": "https://daffafile.ayiem.workers.dev/api/aZ3kq9",
"id": "aZ3kq9",
"contentType": "image/png",
"size": 245678
}
Initialize chunked upload session untuk file besar (>100MB, max 2GB).
| Parameter | Type | Description |
|---|---|---|
filename | string | Original filename |
contentType | string | MIME type (optional) |
totalSize | number | Total file size in bytes |
totalChunks | number | Number of 20MB chunks |
curl -X POST https://daffafile.ayiem.workers.dev/api/upload/chunked/init \
-H "Content-Type: application/json" \
-d '{"filename":"video.mp4","totalSize":524288000,"totalChunks":25}'
Response:
{
"success": true,
"uploadId": "abc123xyz",
"id": "fileId123"
}
Upload chunk ke-n (0-indexed). Setiap chunk max 20MB.
| Parameter | Type | Description |
|---|---|---|
chunk | File | Chunk data (multipart/form-data) |
curl -X POST https://daffafile.ayiem.workers.dev/api/upload/chunked/abc123xyz/0 \
-F "chunk=@chunk0.bin"
Complete chunked upload dan dapatkan permanent URL.
curl -X POST https://daffafile.ayiem.workers.dev/api/upload/chunked/abc123xyz/complete
Response:
{
"success": true,
"url": "https://daffafile.ayiem.workers.dev/api/aZ3kq9",
"id": "aZ3kq9",
"contentType": "video/mp4",
"size": 524288000
}
Retrieve file dengan permanent URL. Redirect ke storage backend.
curl https://daffafile.ayiem.workers.dev/api/aZ3kq9
Response: File binary dengan headers yang sesuai.
Get file metadata (non-sensitive).
curl https://daffafile.ayiem.workers.dev/api/aZ3kq9/info
Response:
{
"success": true,
"id": "aZ3kq9",
"contentType": "image/png",
"size": 245678,
"createdAt": "2026-08-21T20:00:00.000Z"
}
Soft delete file (memerlukan admin key).
| Header | Value |
|---|---|
X-Admin-Key | Your admin API key |
curl -X DELETE https://daffafile.ayiem.workers.dev/api/admin/aZ3kq9 \
-H "X-Admin-Key: your-admin-key"
| Category | Formats |
|---|---|
| Images | PNG, JPEG, GIF, WEBP, BMP, ICO, SVG |
| Documents | PDF, DOC, DOCX, XLS, XLSX, PPT, PPTX, RTF, TXT, MD |
| Archives | ZIP, RAR, 7Z, GZIP, BZIP2 |
| Audio | MP3, OGG, WAV, FLAC |
| Video | MP4, WEBM, AVI |
| Fonts | TTF, OTF, WOFF, WOFF2 |
| Data | JSON, XML, HTML, CSS, JS, YAML, SQLite |
| Limit | Value |
|---|---|
| Max file size (regular) | 100 MB |
| Max file size (chunked) | 2 GB |
| Chunk size | 20 MB |
| Upload session TTL | 1 hour |
| Cache TTL | 30 days |
| Code | Description |
|---|---|
| 400 | Bad request (missing file, invalid parameters) |
| 401 | Unauthorized (invalid admin key) |
| 404 | File not found |
| 413 | File too large |
| 415 | Unsupported file type |
| 500 | Server error |
| 502 | Storage backend error |