← Back to Home

API Documentation

Complete reference for the Mobcraft Storage API

Base URL: https://storage.mobcraft.in/api/v1
NEW

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.

POST /files/upload

Upload a file to storage.

Request Body (form-data)

Field Type Required Description
fileFileYesThe file to upload
folderstringNoFolder name (default: "default")
metadataJSONNoCustom 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"
  }
}
GET /files

Get a paginated list of your files.

Query Parameters

Parameter Type Default Description
folderstring-Filter by folder name
limitnumber20Max items per page (max: 100)
offsetnumber0Skip items for pagination
sortBystringcreatedAtSort field: createdAt, fileName, fileSize
sortOrderstringdescSort 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
  }
}
GET /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
  }
}
PATCH /files/:fileId

Update file metadata (rename file or move to different folder).

Request Body (JSON)

Field Type Required Description
fileNamestringNoNew file name
folderstringNoMove to this folder
metadataobjectNoCustom 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
  }
}
GET /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.

DELETE /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"
}
GET /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"
  }
}
GET /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}
    }
  }
}
POST /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..."
  }
}
POST /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..."
  }
}
GET /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"
  }
}
POST /auth/logout

Logout and invalidate the current session token.

Headers

Authorization: Bearer {token}

Response

{
  "success": true
}
GET /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"]
    }
  ]
}
GET /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, .jpegFull support
PNG.pngFull support, preserves transparency
GIF.gifAnimated GIFs supported
WebP.webpFull support (static & animated)
BMP.bmpFull support
TIFF.tiff, .tifFull support
SVG.svgStored as document
ICO.icoFull support
HEIC/HEIF.heic, .heifFull support

Videos

Format Extension Notes
MP4.mp4Full support, streaming enabled
WebM.webmFull support
MOV.movFull support
AVI.aviFull support
MKV.mkvFull support
FLV.flvFull support
3GP.3gpFull support

Audio

Format Extension Notes
MP3.mp3Full support
WAV.wavFull support
OGG.oggFull support
FLAC.flacFull support
AAC.aac, .m4aFull support
OPUS.opusFull support

Documents

Format Extension Notes
PDF.pdfFull support
Microsoft Word.doc, .docxFull support
Microsoft Excel.xls, .xlsxFull support
Microsoft PowerPoint.ppt, .pptxFull support
Text.txt, .csv, .json, .xmlFull support
Archives.zip, .rar, .7z, .tar, .gzFull 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_AUTHENTICATED401Missing or invalid API key
INVALID_CREDENTIALS401Wrong email/password
FILE_NOT_FOUND404File doesn't exist or was deleted
FILE_EXPIRED410File has expired and is no longer available
QUOTA_EXCEEDED413Storage or file size limit exceeded
RATE_LIMITED429Too many requests
UPLOAD_ERROR500Upload failed
DOWNLOAD_ERROR500Download failed

Rate Limits

Tier Requests/Minute
Free60
Pro120
Business300
EnterpriseUnlimited

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
Free50 MBBot API
Pro2 GBBot API (Local Server)
Business4 GBMTProto
Enterprise4 GBMTProto