🚀 LayoodStorage API
Complete S3-Native Cloud Storage Platform API
World's First S3-Powered Consumer Storage with WhatsApp Authentication
http://localhost:5050/api
https://api.layoodstorage.com/api
🔐 Authentication Endpoints
WhatsApp OTP-based authentication system with dual role support (Admin/Client)
3. Resend OTP
POST /api/resend-otp
Resend OTP if not received
4. Check Session
GET /api/session/check
Validate current session
5. Extend Session
POST /api/session/extend
Extend session validity
6. Logout
POST /api/logout
Clear session & logout
📊 Dashboard Endpoints
Role-based dashboard access with statistics and analytics
🔐 Admin Dashboard
GET /api/dashboard/admin
Headers: Authorization: Bearer {token}
Access: Admin only
Returns: System stats, user management, file analytics
👤 Client Dashboard
GET /api/dashboard/client
Headers: Authorization: Bearer {token}
Access: Client only
Returns: Personal stats, storage usage, recent files
📁 File Management Endpoints
S3-native file operations with Zata.ai integration and real-time progress tracking
📂 List Files
GET /api/files/list
Get all user files with metadata
⬇️ Download File
GET /api/files/{id}/download
Stream file from S3 storage
🗑️ Delete File
DELETE /api/files/{id}/delete
Remove from S3 and update storage
🔍 Search Files
GET /api/search?q=query
Search files by name or type
🔗 Share File
POST /api/files/{id}/share
Generate public share link
📊 File Info
GET /api/files/{id}/info
Get detailed file metadata
📂 Folder Management
Organize files with hierarchical folder structure
📁 Create Folder
POST /api/folders/create
Create new folder with optional parent
📋 List Folders
GET /api/folders/list
Get folder tree structure
🗑️ Delete Folder
DELETE /api/folders/{id}/delete
Delete folder and all contents
📱 Auto-Backup System
Mobile device backup with session tracking and progress monitoring
📱 Register Device
POST /api/devices/register
Register device for auto-backup
🚀 Start Backup
POST /api/backup/start
Initiate backup session with progress tracking
⬆️ Upload to Session
POST /api/backup/upload
Upload files with session tracking
👥 Backup Contacts
POST /api/backup/contacts
Special endpoint for contacts backup
📊 Backup Analytics
GET /api/backup/analytics
Get backup statistics and progress
📋 Session Logs
GET /api/backup/session/{id}/logs
Detailed logs for backup session
✅ Complete Session
POST /api/backup/complete
Mark backup session as completed
⚙️ Device Settings
PUT /api/devices/{id}/settings
Update backup preferences
🎬 File Preview System
Auto-generated thumbnails for videos, images, and documents
🎯 Generate Preview
POST /api/files/{id}/generate-preview
Generate thumbnail for specific file
🖼️ Get Preview
GET /api/files/{id}/preview/{type}
Download preview image
📊 Preview Info
GET /api/files/{id}/preview-info
Get preview metadata
⚡ Batch Generate
POST /api/files/batch-generate-previews
Generate previews for multiple files
📋 Supported File Types for Previews
🎥 Videos
🖼️ Images
📄 Documents
💻 Bulk Upload System
PC/Web folder upload with progress tracking
🚀 Start Session
POST /api/bulk-upload/start
Initialize bulk upload session
📁 Upload File
POST /api/bulk-upload/file
Upload with folder structure
✅ Complete
POST /api/bulk-upload/complete
Finalize bulk upload session
💳 Payment System
Razorpay integration for subscription management
💰 Storage Plans
GET /api/storage-plans
Get available subscription plans
🛒 Create Order
POST /api/create-order
Create Razorpay payment order
✅ Verify Payment
POST /api/verify-payment
Verify and activate subscription
📜 Payment History
GET /api/payments/history
Get user payment transactions
📊 Subscription Status
GET /api/subscription/status
Current subscription details
🔔 Webhook
POST /api/razorpay/webhook
Handle payment status updates
📈 Analytics Endpoints
Usage analytics and statistics for users and admins
📊 Usage Analytics
GET /api/analytics/usage
Storage usage and file statistics
📈 User Storage Stats
GET /api/user/storage-stats
Detailed storage statistics
👤 User Folder Info
GET /api/user/folder-info
User's Zata.ai folder information
🔐 Admin-Only Endpoints
Administrative functions for system management
👥 List All Users
GET /api/admin/users
Get all users with details
💾 Update Storage
PUT /api/admin/users/{id}/storage
Modify user storage quotas
📊 System Stats
GET /api/admin/system/stats
Overall system health and stats
📈 Storage Analytics
GET /api/admin/storage-analytics
System-wide storage analytics
🔄 Backup Overview
GET /api/admin/backup/overview
System backup statistics
🎬 Preview Analytics
GET /api/admin/preview-analytics
Thumbnail generation statistics
💳 Create Plan
POST /api/admin/plans/create
Add new subscription plans
🚀 Frontend Integration Guide
🔐 Authentication Flow
-
1
Call
/api/login
with phone number - 2 User receives WhatsApp OTP via AiSensy
-
3
Call
/api/verify-otp
with OTP - 4 Store JWT token for authenticated requests
-
5
Use
Authorization: Bearer <token>
header
📁 File Upload Process
- 1 Check user storage quota first
-
2
Upload to
/api/files/upload
- 3 Show real-time progress if supported
- 4 Handle success/error responses
- 5 Update UI with new file data
📱 Auto-Backup Flow
-
1
Register device with
/api/devices/register
- 2 Start backup session
- 3 Upload files with session tracking
- 4 Show real-time progress
- 5 Complete session when done
💳 Payment Integration
-
1
Show plans from
/api/storage-plans
- 2 Create Razorpay order
- 3 Handle Razorpay payment UI
- 4 Verify payment on backend
- 5 Update user subscription status
🌟 Zata.ai S3 Advantages
⚠️ Important Implementation Notes
- • JWT Tokens expire in 24 hours - Handle token refresh gracefully
- • File uploads support progress tracking - Show real-time feedback to users
- • WhatsApp OTP is unique advantage - Highlight this feature prominently
- • Razorpay supports all Indian payments - UPI, Cards, NetBanking, Wallets
- • Auto-backup requires device registration - Guide users through setup process
- • Thumbnails auto-generate - Handle loading states for previews
⚠️ Error Codes & Responses
🔐 Authentication Errors
401
- NO_TOKEN: Authentication required401
- INVALID_TOKEN: Token expired/invalid403
- INSUFFICIENT_ROLE: Access denied404
- USER_INACTIVE: User not found/inactive📁 File Operation Errors
413
- Storage quota exceeded413
- File too large (>100MB)404
- File not found500
- S3 upload/download failed💳 Payment Errors
400
- Invalid payment request400
- Payment verification failed503
- Payment service unavailable404
- Plan not found📱 Backup Errors
404
- Device not found403
- Backup disabled404
- Session not found/expired429
- Too many attempts⏱️ Rate Limits & Constraints
🔐 Authentication
📁 File Operations
📱 Auto-Backup
🛠️ SDKs & Integration Libraries
📱 Mobile SDKs
npm install layood-storage-rn
pod 'LayoodStorage'
implementation 'com.layood:storage:1.0.0'
🌐 Web SDKs
npm install layood-storage-js
npm install @layood/react-components
npm install @layood/vue-storage