API Documentation

Complete guide for HostZilla media hosting API

Endpoints

POST /api/upload.php - Direct file upload
GET /api/hosturl.php?url=[media_url] - Upload from URL

Base URLs

POST:
GET:

POST Method

Upload files directly using multipart/form-data.

Headers

Content-Type: multipart/form-data (Required)

Parameters

Parameter Type Required Description
file file Yes Media file to upload (max 20MB)

Usage Example (cURL)

curl -X POST \ -F "file=@path/to/file.jpg"

Usage Example (JavaScript)

const formData = new FormData(); formData.append('file', fileInput.files[0]); fetch('', { method: 'POST', body: formData }) .then(res => res.json()) .then(data => console.log(data));

GET Method

Upload media from a URL.

Parameters

Parameter Type Required Description
url string Yes URL of media file (max 20MB)

Usage Example

Response (Success)

{ "data": "https://yourdomain.com/uploads/1732377600_file-abc.png", "url": "https://yourdomain.com/uploads/1732377600_file-abc.png", "shareable_url": "https://yourdomain.com/Ab3xY9/file-abc", "short_code": "Ab3xY9", "file_id": "file-abc", "filename": "image.png", "size": 83638, "uploaded_on": "2025-11-23T14:11:52.833Z", "media_type": "image/png" }

Response (Error)

{ "error": "Failed to download file from URL" }