List Media Files API
Retrieve all uploaded media files with download URLs for use in WhatsApp messaging
End Point: https://wbiztool.com/api/v1/media/list/
Request Type: GET or POST
Required Parameters
-
client_id (Integer)
- Your Client Id (Given on API Keys page) -
api_key (String)
- Your API Key (Given on API Keys page)
Optional Parameters
-
page (Integer)
- Page number for pagination (default: 1) -
limit (Integer)
- Number of items per page (default: 20, max: 100) -
file_type (String)
- Filter by file type: 'image' or 'file' -
search (String)
- Search by filename
Response Fields
-
status (Integer)
- 1 for success, 0 for error -
message (String)
- Success or error message -
data (Object)
- Response data containing:total_count
- Total number of media filespage
- Current page numberlimit
- Items per pagetotal_pages
- Total number of pageshas_next
- Boolean indicating more pageshas_previous
- Boolean indicating previous pagesmedia_files
- Array of media file objects
Media File Object Fields
id
- Unique media file IDfile_name
- Internal file name on serveroriginal_file_name
- Original uploaded filenamefile_url
- Direct download URL (use this in WhatsApp messages!)file_type
- Type: 'image' or 'file'file_size
- File size in bytesfile_size_display
- Human-readable file size (e.g., "512 KB")mime_type
- MIME type (e.g., "image/jpeg")is_image
- Boolean indicating if file is an imagefile_extension
- File extension (e.g., "jpg")created_at
- ISO 8601 timestamp of uploaduploaded_by
- Username of uploader
Example Request (GET with Query Parameters)
https://wbiztool.com/api/v1/media/list/?client_id=12345&api_key=your-api-key&page=1&limit=20
Example Request (POST with JSON)
{
"client_id": 12345,
"api_key": "your-api-key",
"page": 1,
"limit": 20,
"file_type": "image"
}
Example Response (Success)
{
"status": 1,
"message": "Media files retrieved successfully",
"data": {
"total_count": 45,
"page": 1,
"limit": 20,
"total_pages": 3,
"has_next": true,
"has_previous": false,
"media_files": [
{
"id": 123,
"file_name": "media_5_1696406400_0.jpg",
"original_file_name": "product-photo.jpg",
"file_url": "https://wbiztool-static.s3.ap-southeast-1.amazonaws.com/media/org_5/media_5_1696406400_0.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",
"uploaded_by": "john.doe"
}
]
}
}
Example Response (Error)
{
"status": 0,
"message": "Invalid API key"
}
cURL Example
curl -X GET "https://wbiztool.com/api/v1/media/list/?client_id=12345&api_key=your-api-key&page=1&limit=20&file_type=image"
Python Example
import requests
url = "https://wbiztool.com/api/v1/media/list/"
params = {
"client_id": 12345,
"api_key": "your-api-key",
"page": 1,
"limit": 20,
"file_type": "image"
}
response = requests.get(url, params=params)
data = response.json()
if data['status'] == 1:
for file in data['data']['media_files']:
print(f"{file['original_file_name']}: {file['file_url']}")
print(f"Total files: {data['data']['total_count']}")
Use Case: Get Media URL for WhatsApp Message
import requests
# Step 1: Get media files
media_response = requests.get('https://wbiztool.com/api/v1/media/list/', params={
'client_id': 12345,
'api_key': 'your-api-key',
'search': 'product-image'
})
media_data = media_response.json()
if media_data['status'] == 1 and len(media_data['data']['media_files']) > 0:
# Get the file URL
file_url = media_data['data']['media_files'][0]['file_url']
# Step 2: Send via WhatsApp
requests.post('https://wbiztool.com/api/v1/send_msg/', data={
'client_id': 12345,
'api_key': 'your-api-key',
'phone': '919876543210',
'msg_type': 1, # Image
'img_url': file_url,
'msg': 'Check out our product!',
'whatsapp_client': 1
})
Important Notes
- Supports both GET and POST request methods
- Maximum pagination limit is 100 items per request
- Files are ordered by most recent first
- Only non-deleted media files are returned
- File URLs are permanent and can be used directly in WhatsApp messages
- All files are stored on AWS S3 with high availability
- Use the
file_url
field in your WhatsApp message API calls - Pagination helps manage large media libraries efficiently