Upload Media API
Upload images, documents, videos, and audio files to get instant download URLs for WhatsApp messaging
End Point: https://wbiztool.com/api/v1/media/upload/
Request Type: POST (multipart/form-data)
Supported File Types
Category | File Types | Extensions |
---|---|---|
Images | JPEG, PNG, GIF, BMP, WebP | .jpg, .jpeg, .png, .gif, .bmp, .webp |
Documents | PDF, Word, Excel, PowerPoint, Text, CSV | .pdf, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .txt, .csv |
Audio | MP3, M4A, WAV, AAC, OGG | .mp3, .m4a, .wav, .aac, .ogg |
Video | MP4, AVI, QuickTime | .mp4, .avi, .mov |
Archives | ZIP, RAR | .zip, .rar |
File Size Limit: Maximum file size is 64 MB per upload
Response Fields
-
status (Integer)
- 1 for success, 0 for error -
message (String)
- Success or error message -
data (Object)
- Uploaded file details containing:id
- Unique media file IDfile_name
- Internal file name on serveroriginal_file_name
- Original uploaded filenamefile_url
- Direct download URL (use this in messages!)file_type
- Type: 'image' or 'file'file_size
- File size in bytesfile_size_display
- Human-readable file sizemime_type
- MIME type (e.g., "image/jpeg")is_image
- Boolean indicating if file is an imagefile_extension
- File extensioncreated_at
- ISO 8601 timestamp of upload
Example Response (Success)
{
"status": 1,
"message": "File uploaded successfully",
"data": {
"id": 123,
"file_name": "media_5_1696406400.jpg",
"original_file_name": "product-photo.jpg",
"file_url": "https://wbiztool-static.s3.ap-southeast-1.amazonaws.com/media/org_5/media_5_1696406400.jpg",
"file_type": "image",
"file_size": 524288,
"file_size_display": "512.0 KB",
"mime_type": "image/jpeg",
"is_image": true,
"file_extension": "jpg",
"created_at": "2025-10-04T10:30:00+00:00"
}
}
Example Response (Error)
{
"status": 0,
"message": "File is too large. Maximum size is 64MB. Your file: 75.3MB"
}
cURL Example
curl -X POST https://wbiztool.com/api/v1/media/upload/ \
-F "client_id=12345" \
-F "api_key=your-api-key" \
-F "media_file=@/path/to/product-image.jpg"
Python Example
import requests
url = "https://wbiztool.com/api/v1/media/upload/"
# Upload a file
with open('/path/to/product-image.jpg', 'rb') as file:
response = requests.post(url,
data={
'client_id': 12345,
'api_key': 'your-api-key'
},
files={
'media_file': file
}
)
data = response.json()
if data['status'] == 1:
file_url = data['data']['file_url']
file_id = data['data']['id']
print(f"File uploaded successfully!")
print(f"File URL: {file_url}")
print(f"File ID: {file_id}")
else:
print(f"Upload failed: {data['message']}")
PHP Example
<?php
$file_path = '/path/to/product-image.jpg';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://wbiztool.com/api/v1/media/upload/');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'client_id' => 12345,
'api_key' => 'your-api-key',
'media_file' => new CURLFile($file_path)
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
if ($data['status'] == 1) {
echo "File URL: " . $data['data']['file_url'] . "\n";
echo "File ID: " . $data['data']['id'] . "\n";
}
?>
Use Case: Upload and Send via WhatsApp
import requests
# Step 1: Upload the image
with open('/path/to/product.jpg', 'rb') as file:
upload_response = requests.post('https://wbiztool.com/api/v1/media/upload/',
data={
'client_id': 12345,
'api_key': 'your-api-key'
},
files={'media_file': file}
)
upload_data = upload_response.json()
if upload_data['status'] == 1:
image_url = upload_data['data']['file_url']
# Step 2: Send the image via WhatsApp
message_response = requests.post('https://wbiztool.com/api/v1/send_msg/', data={
'client_id': 12345,
'api_key': 'your-api-key',
'phone': '919876543210',
'whatsapp_client': 1,
'msg_type': 1, # Image
'img_url': image_url,
'msg': 'Check out our new product!'
})
print("Message sent with uploaded image!")
Important Notes
- Maximum file size is 64 MB per upload
- Files are stored on AWS S3 with high availability
- File URLs are permanent and can be used immediately in WhatsApp messages
- Request must use
multipart/form-data
encoding - All uploaded files are automatically validated for type and size
- Use the returned
file_url
in your Send Message API calls - Files remain accessible even after deletion from dashboard (soft delete)
- Upload is synchronous - you get the URL immediately after upload
- For images, use
msg_type=1
and pass URL toimg_url
- For files (PDF, docs, etc.), use
msg_type=2
and pass URL tofile_url