API Examples
One endpoint, two ways to upload. All file types allowed, max
200 MB.
Responses are always JSON with status
and url fields.
Endpoint
- URL
POST https://upload.wolfhub.io/upload.php- File upload
multipart/form-data— field namefile- URL import
application/json— body{"url": "…"}- Storage
- Cloudflare R2
1 · Upload a file — cURL
bash
# Upload a file (multipart/form-data)
curl -X POST https://upload.wolfhub.io/upload.php \
-F "file=@/path/to/video.mp4"
# Response
# {"status":"success","url":"https://upload.wolfhub.io/uploads/abc123xyz.mp4"}2 · Import from URL — cURL
The server downloads the file and stores it (R2 or local) — no need to download it yourself first.
bash
# Import a file from a remote URL
curl -X POST https://upload.wolfhub.io/upload.php \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/video.mp4"}'
# Response
# {"status":"success","url":"https://pub-xxxx.r2.dev/share/abc123xyz.mp4"}3 · Upload a file — PHP
php
<?php
// Upload a file from PHP
$ch = curl_init('https://upload.wolfhub.io/upload.php');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => [
'file' => new CURLFile('/path/to/video.mp4'),
],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
echo $response['url']; // public URL of the uploaded file4 · Import from URL — PHP
php
<?php
// Import a file from a remote URL, straight to storage
$payload = json_encode(['url' => 'https://example.com/video.mp4']);
$ch = curl_init('https://upload.wolfhub.io/upload.php');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
echo $response['url'];5 · JavaScript (fetch)
javascript
// Browser fetch — import from URL
const res = await fetch('https://upload.wolfhub.io/upload.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ url: 'https://example.com/video.mp4' })
});
const data = await res.json();
console.log(data.url);
// Browser fetch — upload a picked file
const form = new FormData();
form.append('file', fileInput.files[0]);
const res2 = await fetch('https://upload.wolfhub.io/upload.php', { method: 'POST', body: form });
console.log((await res2.json()).url);Response & status codes
| Code | Meaning |
|---|---|
| 200 | Success — {"status":"success","url":"…"} |
| 400 | No file / upload error |
| 401 | Invalid or missing API key (URL import) |
| 405 | Method not allowed (only POST) |
| 413 | File too large |
| 422 | Invalid URL / empty file / unreachable remote |
| 500/502 | Server or storage error |
Files may be removed after 7 days.