Storage API
Upload and manage files.
Base URL
https://api.moontraze.com/apiUpload File
POST /api/storage/:projectId/upload
Authorization: Bearer <token>
Content-Type: multipart/form-data
file: <binary>
folderId: <optional>List Files
GET /api/storage/:projectId/files
Authorization: Bearer <token>
X-Project-Id: YOUR_PROJECT_ID
X-API-Key: YOUR_API_KEYList Files in Folder
GET /api/storage/:projectId/files?folderId=FOLDER_ID
Authorization: Bearer <token>
X-Project-Id: YOUR_PROJECT_ID
X-API-Key: YOUR_API_KEYGet Presigned URL
GET /api/storage/:projectId/files/:fileId/presign?download=true
Authorization: Bearer <token>
X-Project-Id: YOUR_PROJECT_ID
X-API-Key: YOUR_API_KEYDelete File
DELETE /api/storage/:projectId/files/:fileId
Authorization: Bearer <token>
X-Project-Id: YOUR_PROJECT_ID
X-API-Key: YOUR_API_KEYCreate Folder
POST /api/storage/:projectId/folders
Authorization: Bearer <token>
Content-Type: application/json
X-Project-Id: YOUR_PROJECT_ID
X-API-Key: YOUR_API_KEY
{
"name": "My Folder",
"parentId": null
}List Folders
GET /api/storage/:projectId/folders
Authorization: Bearer <token>
X-Project-Id: YOUR_PROJECT_ID
X-API-Key: YOUR_API_KEYDelete Folder
DELETE /api/storage/:projectId/folders/:folderId
Authorization: Bearer <token>
X-Project-Id: YOUR_PROJECT_ID
X-API-Key: YOUR_API_KEYGet Storage Quota
GET /api/storage/:projectId/quota
Authorization: Bearer <token>
X-Project-Id: YOUR_PROJECT_ID
X-API-Key: YOUR_API_KEYPublic File URL
https://api.moontraze.com/storage/:projectId/path/to/file.webp
https://api.moontraze.com/storage/:projectId/path/to/file.webp?download=trueSDK Example
const file = document.getElementById('file').files[0];
const result = await moon.storage.upload(file);
console.log(result.publicUrl);
const files = await moon.storage.list();
const folders = await moon.storage.listFolders();
await moon.storage.createFolder('My Folder');
const url = await moon.storage.getDownloadUrl(fileId);
await moon.storage.delete(fileId);
await moon.storage.deleteFolder(folderId);
const quota = await moon.storage.getQuota();