Get Media File API

Retrieve detailed information about a specific media file by its ID

End Point: https://wbiztool.com/api/v1/media/{media_id}/
Request Type: GET or POST
URL Parameters
  • media_id (Integer) - The ID of the media file to retrieve
Required Parameters
  • client_id (Integer) - Your Client Id (Given on API Keys page)
  • api_key (String) - Your API Key (Given on API Keys page)
Response Fields
  • status (Integer) - 1 for success, 0 for error
  • message (String) - Success or error message
  • data (Object) - Media file details containing:
    • id - Unique media file ID
    • file_name - Internal file name on server
    • original_file_name - Original uploaded filename
    • file_url - Direct download URL
    • file_type - Type: 'image' or 'file'
    • file_size - File size in bytes
    • file_size_display - Human-readable file size
    • mime_type - MIME type (e.g., "image/jpeg")
    • is_image - Boolean indicating if file is an image
    • file_extension - File extension
    • created_at - ISO 8601 timestamp of upload
    • modified_at - ISO 8601 timestamp of last modification
    • uploaded_by - Username of uploader
Example Request (GET)
https://wbiztool.com/api/v1/media/123/?client_id=12345&api_key=your-api-key
Example Response (Success)
{
  "status": 1,
  "message": "Media file retrieved successfully",
  "data": {
    "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",
    "modified_at": "2025-10-04T10:30:00+00:00",
    "uploaded_by": "john.doe"
  }
}
Example Response (Error)
{
  "status": 0,
  "message": "Media file not found"
}
cURL Example
curl -X GET "https://wbiztool.com/api/v1/media/123/?client_id=12345&api_key=your-api-key"
Python Example
import requests

url = "https://wbiztool.com/api/v1/media/123/"

params = {
    "client_id": 12345,
    "api_key": "your-api-key"
}

response = requests.get(url, params=params)
data = response.json()

if data['status'] == 1:
    file_info = data['data']
    print(f"File: {file_info['original_file_name']}")
    print(f"URL: {file_info['file_url']}")
    print(f"Size: {file_info['file_size_display']}")
    print(f"Type: {file_info['mime_type']}")
else:
    print(f"Error: {data['message']}")
PHP Example
<?php
$media_id = 123;
$params = http_build_query([
    'client_id' => 12345,
    'api_key' => 'your-api-key'
]);

$response = file_get_contents("https://wbiztool.com/api/v1/media/{$media_id}/?{$params}");
$data = json_decode($response, true);

if ($data['status'] == 1) {
    $file = $data['data'];
    echo "File: {$file['original_file_name']}\n";
    echo "URL: {$file['file_url']}\n";
}
?>
Use Case: Verify File Before Using
import requests

def get_media_url(media_id, client_id, api_key):
    """Get the download URL for a media file"""
    response = requests.get(
        f'https://wbiztool.com/api/v1/media/{media_id}/',
        params={
            'client_id': client_id,
            'api_key': api_key
        }
    )

    data = response.json()

    if data['status'] == 1:
        return data['data']['file_url']
    else:
        print(f"Error: {data['message']}")
        return None

# Usage
file_url = get_media_url(123, 12345, 'your-api-key')
if file_url:
    print(f"File is available at: {file_url}")
    # Now use this URL in WhatsApp message
    requests.post('https://wbiztool.com/api/v1/send_msg/', data={
        'client_id': 12345,
        'api_key': 'your-api-key',
        'phone': '919876543210',
        'msg_type': 1,
        'img_url': file_url,
        'msg': 'Here is the file',
        'whatsapp_client': 1
    })
Important Notes
  • Supports both GET and POST request methods
  • Media ID must belong to your organization
  • Only non-deleted media files can be retrieved
  • Returns 'Media file not found' if file doesn't exist or was deleted
  • File URL is permanent and can be used directly in WhatsApp messages
  • Use this endpoint to verify file existence before sending
  • All timestamps are in ISO 8601 format with timezone information
  • File metadata includes both upload and modification timestamps