Recent Updates - v1.1.0
- ✓ WebP Support: Full support for WebP images (static and animated)
- ✓ WebM/GIF Videos: Improved handling for WebM and animated GIF uploads
- ✓ Better Error Messages: More descriptive error responses for upload failures
- ✓ File Type Documentation: Added comprehensive supported file types section
Authentication
All API endpoints require an API key passed via the X-API-Key header.
curl -H "X-API-Key: msk_your_api_key_here" \
https://storage.mobcraft.in/api/v1/files
Note: Keep your API keys secure. Never expose them in client-side code or public repositories.
/files/upload
Upload a file to storage.
Request Body (form-data)
| Field | Type | Required | Description |
|---|---|---|---|
file | File | Yes | The file to upload |
folder | string | No | Folder name (default: "default") |
metadata | JSON | No | Custom metadata object |
Example
curl -X POST https://storage.mobcraft.in/api/v1/files/upload \ -H "X-API-Key: msk_your_key" \ -F "file=@/path/to/image.jpg" \ -F "folder=photos"
Response
{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"fileName": "image.jpg",
"fileSize": 1024000,
"mimeType": "image/jpeg",
"folder": "photos",
"downloadUrl": "/api/v1/files/.../download",
"createdAt": "2024-01-15T10:30:00Z"
}
}
/files
Get a paginated list of your files.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
folder | string | - | Filter by folder name |
limit | number | 20 | Max items per page (max: 100) |
offset | number | 0 | Skip items for pagination |
sortBy | string | createdAt | Sort field: createdAt, fileName, fileSize |
sortOrder | string | desc | Sort order: asc or desc |
Example
curl -X GET "https://storage.mobcraft.in/api/v1/files?folder=photos&limit=10" \ -H "X-API-Key: msk_your_key"
Response
{
"success": true,
"data": {
"items": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"file_name": "image.jpg",
"file_size": 1024000,
"mime_type": "image/jpeg",
"folder": "photos",
"created_at": "2024-01-15T10:30:00Z"
}
],
"total": 50,
"limit": 10,
"offset": 0,
"hasMore": true
}
}
/files/:fileId
Get metadata for a specific file.
Example
curl -X GET "https://storage.mobcraft.in/api/v1/files/550e8400-..." \ -H "X-API-Key: msk_your_key"
Response
{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"fileName": "image.jpg",
"fileSize": 1024000,
"mimeType": "image/jpeg",
"folder": "photos",
"metadata": {"description": "My photo"},
"createdAt": "2024-01-15T10:30:00Z",
"expiresAt": null
}
}
/files/:fileId
Update file metadata (rename file or move to different folder).
Request Body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
fileName | string | No | New file name |
folder | string | No | Move to this folder |
metadata | object | No | Custom metadata object |
Example
curl -X PATCH "https://storage.mobcraft.in/api/v1/files/550e8400-..." \
-H "X-API-Key: msk_your_key" \
-H "Content-Type: application/json" \
-d '{"fileName": "renamed-image.jpg", "folder": "archived"}'
Response
{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"fileName": "renamed-image.jpg",
"fileSize": 1024000,
"mimeType": "image/jpeg",
"folder": "archived",
"metadata": {},
"createdAt": "2024-01-15T10:30:00Z",
"expiresAt": null
}
}
/files/:fileId/download
Download a file. Public endpoint - no authentication required. The file ID (UUID) acts as the access token.
Note: This endpoint is public to allow easy sharing. The UUID is cryptographically random and hard to guess. Use the download URL directly in your app or share it with others.
Example
# Download to file (no auth required) curl -X GET "https://storage.mobcraft.in/api/v1/files/550e8400-.../download" \ -o downloaded_file.jpg # Direct URL for browser/apps https://storage.mobcraft.in/api/v1/files/550e8400-.../download
Response
Returns 302 Redirect to download URL, or 200 OK with file content.
/files/:fileId
Delete a file (soft delete).
Example
curl -X DELETE "https://storage.mobcraft.in/api/v1/files/550e8400-..." \ -H "X-API-Key: msk_your_key"
Response
{
"success": true,
"message": "File deleted successfully"
}
/quota
Get your current storage quota and usage.
Example
curl -X GET "https://storage.mobcraft.in/api/v1/quota" \ -H "X-API-Key: msk_your_key"
Response
{
"success": true,
"data": {
"tier": "free",
"storageUsed": 524288000,
"storageLimit": 2147483648,
"storageUsedFormatted": "500 MB",
"storageLimitFormatted": "2 GB",
"storagePercentage": 24,
"filesCount": 15,
"fileSizeLimit": 52428800,
"fileSizeLimitFormatted": "50 MB"
}
}
/quota/usage
Get detailed usage statistics by folder and month.
Example
curl -X GET "https://storage.mobcraft.in/api/v1/quota/usage" \ -H "X-API-Key: msk_your_key"
Response
{
"success": true,
"data": {
"totalUsed": 524288000,
"totalUsedFormatted": "500 MB",
"filesCount": 15,
"byFolder": {
"photos": {"used": 300000000, "count": 10},
"documents": {"used": 224288000, "count": 5}
},
"byMonth": {
"2024-01": {"used": 524288000, "count": 15}
}
}
}
/auth/register
Create a new account.
Request Body
{
"email": "user@example.com",
"password": "securepassword123",
"name": "John Doe"
}
Response
{
"success": true,
"data": {
"user": {"id": "...", "email": "user@example.com", "name": "John Doe"},
"token": "abc123...",
"apiKey": "msk_abc123..."
}
}
/auth/login
Login with email and password.
Request Body
{
"email": "user@example.com",
"password": "securepassword123"
}
Response
{
"success": true,
"data": {
"user": {"id": "...", "email": "user@example.com", "name": "John Doe"},
"token": "abc123...",
"apiKey": "msk_abc123..."
}
}
/auth/me
Get the current authenticated user's information.
Headers
Authorization: Bearer {token}
Response
{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"email": "user@example.com",
"name": "John Doe",
"created_at": "2024-01-15T10:30:00Z"
}
}
/auth/logout
Logout and invalidate the current session token.
Headers
Authorization: Bearer {token}
Response
{
"success": true
}
/quota/tiers
Get available subscription tiers and their limits. Public endpoint - no authentication required.
Example
curl -X GET "https://storage.mobcraft.in/api/v1/quota/tiers"
Response
{
"success": true,
"data": [
{
"tier": "free",
"storageLimit": 2147483648,
"storageLimitFormatted": "2 GB",
"fileSizeLimit": 52428800,
"fileSizeLimitFormatted": "50 MB",
"priceMonthly": 0,
"features": ["2GB Storage", "50MB File Size", "Basic Support"]
},
{
"tier": "pro",
"storageLimit": 107374182400,
"storageLimitFormatted": "100 GB",
"fileSizeLimit": 2147483648,
"fileSizeLimitFormatted": "2 GB",
"priceMonthly": 199,
"features": ["100GB Storage", "2GB File Size", "Priority Support"]
}
]
}
/quota/subscription
Get the current user's subscription status.
Example
curl -X GET "https://storage.mobcraft.in/api/v1/quota/subscription" \ -H "X-API-Key: msk_your_key"
Response
{
"success": true,
"data": {
"tier": "pro",
"subscriptionId": "sub_abc123",
"status": "active",
"expiresAt": "2024-02-15T10:30:00Z",
"autoRenew": true
}
}
Supported File Types
Mobcraft Storage supports all file types. Files are stored on Telegram's infrastructure and handled based on their format.
Images
| Format | Extension | Notes |
|---|---|---|
| JPEG | .jpg, .jpeg | Full support |
| PNG | .png | Full support, preserves transparency |
| GIF | .gif | Animated GIFs supported |
| WebP | .webp | Full support (static & animated) |
| BMP | .bmp | Full support |
| TIFF | .tiff, .tif | Full support |
| SVG | .svg | Stored as document |
| ICO | .ico | Full support |
| HEIC/HEIF | .heic, .heif | Full support |
Videos
| Format | Extension | Notes |
|---|---|---|
| MP4 | .mp4 | Full support, streaming enabled |
| WebM | .webm | Full support |
| MOV | .mov | Full support |
| AVI | .avi | Full support |
| MKV | .mkv | Full support |
| FLV | .flv | Full support |
| 3GP | .3gp | Full support |
Audio
| Format | Extension | Notes |
|---|---|---|
| MP3 | .mp3 | Full support |
| WAV | .wav | Full support |
| OGG | .ogg | Full support |
| FLAC | .flac | Full support |
| AAC | .aac, .m4a | Full support |
| OPUS | .opus | Full support |
Documents
| Format | Extension | Notes |
|---|---|---|
| Full support | ||
| Microsoft Word | .doc, .docx | Full support |
| Microsoft Excel | .xls, .xlsx | Full support |
| Microsoft PowerPoint | .ppt, .pptx | Full support |
| Text | .txt, .csv, .json, .xml | Full support |
| Archives | .zip, .rar, .7z, .tar, .gz | Full support |
Any File Type: You can upload any file type not listed above. All files are stored securely and can be downloaded with their original format preserved.
Error Codes
All errors return a consistent format:
{
"error": "Error message description",
"code": "ERROR_CODE"
}
| Code | HTTP Status | Description |
|---|---|---|
NOT_AUTHENTICATED | 401 | Missing or invalid API key |
INVALID_CREDENTIALS | 401 | Wrong email/password |
FILE_NOT_FOUND | 404 | File doesn't exist or was deleted |
FILE_EXPIRED | 410 | File has expired and is no longer available |
QUOTA_EXCEEDED | 413 | Storage or file size limit exceeded |
RATE_LIMITED | 429 | Too many requests |
UPLOAD_ERROR | 500 | Upload failed |
DOWNLOAD_ERROR | 500 | Download failed |
Rate Limits
| Tier | Requests/Minute |
|---|---|
| Free | 60 |
| Pro | 120 |
| Business | 300 |
| Enterprise | Unlimited |
Rate limit headers are included in responses: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
File Size Limits
| Tier | Max File Size | Storage Method |
|---|---|---|
| Free | 50 MB | Bot API |
| Pro | 2 GB | Bot API (Local Server) |
| Business | 4 GB | MTProto |
| Enterprise | 4 GB | MTProto |