Storage Endpoints
Direct HTTP endpoint specifications for presigned S3/R2 uploads, full File CRUD, Virtual Folder CRUD, and directory browsing.
/api/storage/presign
Generates a time-limited S3 presigned PUT URL and human-readable r2Key allowing clients to stream directly to Cloudflare R2 storage.
curl -X POST https://api-cloudizero.wismannur.pro/api/storage/presign \
-H "Authorization: Bearer cz_live_..." \
-H "Content-Type: application/json" \
-d '{
"projectId": "ca2454ff-7f1e-421b-b134-4c800f6d58de",
"fileName": "avatar.png",
"mimeType": "image/png",
"fileSize": 1048576,
"folderId": null
}'{
"uploadUrl": "https://<account-id>.r2.cloudflarestorage.com/<bucket>/<r2Key>?X-Amz-...",
"r2Key": "wisman-nur/project-slug/avatar.png",
"fileId": "f29b8214-7e8c-4a12-9b30-1c8e7d6f5a4b",
"finalFileName": "avatar.png"
}/api/storage/complete
Registers the uploaded asset into the relational Neon Postgres database after the client finishes streaming to R2.
curl -X POST https://api-cloudizero.wismannur.pro/api/storage/complete \
-H "Authorization: Bearer cz_live_..." \
-H "Content-Type: application/json" \
-d '{
"fileId": "f29b8214-7e8c-4a12-9b30-1c8e7d6f5a4b",
"projectId": "ca2454ff-7f1e-421b-b134-4c800f6d58de",
"folderId": null,
"name": "avatar.png",
"mimeType": "image/png",
"size": 1048576,
"r2Key": "wisman-nur/project-slug/avatar.png"
}'/api/storage/contents
Fetches all files, virtual folders, and navigation breadcrumbs for a given projectId and folderId.
curl -X GET "https://api-cloudizero.wismannur.pro/api/storage/contents?projectId=ca2454ff-7f1e-421b-b134-4c800f6d58de&folderId=root" \
-H "Authorization: Bearer cz_live_..."/api/storage/files
Read file metadata & presigned download URL, update file metadata (rename/move in R2 or request a presigned replacement PUT URL), or permanently delete an asset.
# 1. Ambil Metadata File & URL Unduhan Presigned
curl -X GET "https://api-cloudizero.wismannur.pro/api/storage/files?fileId=f29b8214-7e8c-..." \
-H "Authorization: Bearer cz_live_..."
# 2. Update Metadata File (Ubah Nama / Pindah Folder / Minta URL Timpa Biner)
curl -X PATCH https://api-cloudizero.wismannur.pro/api/storage/files \
-H "Authorization: Bearer cz_live_..." \
-H "Content-Type: application/json" \
-d '{
"fileId": "f29b8214-7e8c-...",
"name": "avatar-v2.png",
"folderId": "3b9c1e2a-...",
"requestReplaceUploadUrl": false
}'
# 3. Hapus File Permanen (R2 + Neon DB)
curl -X DELETE "https://api-cloudizero.wismannur.pro/api/storage/files?fileId=f29b8214-7e8c-..." \
-H "Authorization: Bearer cz_live_..."/api/storage/folders
Full CRUD for virtual folders, including recursive path & R2 key synchronization on rename/move and recursive R2 object cleanup on deletion.
# 1. Buat Folder Virtual
curl -X POST https://api-cloudizero.wismannur.pro/api/storage/folders \
-H "Authorization: Bearer cz_live_..." \
-H "Content-Type: application/json" \
-d '{
"projectId": "ca2454ff-7f1e-421b-b134-4c800f6d58de",
"name": "Banner Pemasaran",
"parentId": null
}'
# 2. Ambil Folder Tunggal atau Daftar Folder Proyek
curl -X GET "https://api-cloudizero.wismannur.pro/api/storage/folders?projectId=ca2454ff-7f1e-421b-b134-4c800f6d58de&parentId=root" \
-H "Authorization: Bearer cz_live_..."
# 3. Ubah Nama atau Pindahkan Folder (Otomatis Sinkronisasi Path Subfolder & Key R2)
curl -X PATCH https://api-cloudizero.wismannur.pro/api/storage/folders \
-H "Authorization: Bearer cz_live_..." \
-H "Content-Type: application/json" \
-d '{
"folderId": "3b9c1e2a-...",
"name": "Aset Brand",
"parentId": null
}'
# 4. Hapus Folder Rekursif (Menghapus Subfolder & Objek R2 di dalamnya)
curl -X DELETE "https://api-cloudizero.wismannur.pro/api/storage/folders?folderId=3b9c1e2a-..." \
-H "Authorization: Bearer cz_live_..."