Use our Application Programming Interface (API) to upload files programmatically without CAPTCHA. Perfect for developers and applications that need to upload files automatically.
One Month
Three Months
Full Year
After obtaining your API key, you can use it to upload files programmatically. Here are examples of how to use the API with different programming languages:
A simple API interface allows you to upload files with just one line of code.
API keys are secure and encrypted to ensure the protection of your data and files.
High-speed servers ensure fast file uploads and downloads.
Works with all programming languages that support HTTP requests.
The Ghostbyte API allows you to upload files programmatically to our secure storage service. This documentation provides examples in various programming languages to help you integrate with our platform.
POST https://www.gbe.lol/api/upload.php
All requests must include your API key in the X-API-KEY
header.
Parameter | Type | Required | Description |
---|---|---|---|
file |
File | Yes | The file to upload (multipart/form-data) |
All API responses are returned in JSON format with the following structure:
{
"success": true,
"message": "File uploaded successfully.",
"filename": "816424827e72553344cdc124ab574208_1744727544_example.jpg",
"original_name": "example.jpg",
"file_size": 27183,
"file_type": "image/jpeg",
"download_url": "https://www.gbe.lol/download.php?file=816424827e72553344cdc124ab574208_1744727544_example.jpg"
}
Select your preferred programming language to see implementation examples:
// Example of file upload using PHP
$apiKey = "YOUR_API_KEY_HERE"; // Replace with your API key
$filePath = "/path/to/your/file.zip"; // Path to the file you want to upload
// Create cURL request
$ch = curl_init();
// Prepare file for upload
$postFields = [
'file' => new CURLFile($filePath)
];
// Set up cURL request
curl_setopt_array($ch, [
CURLOPT_URL => "https://www.gbe.lol/api/upload.php",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $postFields,
CURLOPT_HTTPHEADER => [
"X-API-KEY: {$apiKey}"
]
]);
// Execute the request
$response = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
if ($error) {
echo "Error: " . $error;
} else {
// Convert response to JSON
$result = json_decode($response, true);
if ($result && isset($result['success']) && $result['success']) {
echo "File uploaded successfully!\n";
echo "Download link: " . $result['download_url'];
} else {
echo "File upload failed: " . ($result['message'] ?? 'Unknown error');
}
}
# Using API to upload a file with Python
import requests
api_key = 'YOUR_API_KEY_HERE' # Replace with your API key
file_path = 'path/to/your/file.zip' # Path to the file you want to upload
# Set up headers with API key
headers = {
'X-API-KEY': api_key
}
# Prepare file for upload
files = {
'file': open(file_path, 'rb')
}
try:
# Send POST request to upload the file
response = requests.post(
'https://www.gbe.lol/api/upload.php',
headers=headers,
files=files
)
# Convert response to JSON
result = response.json()
if result.get('success') == True:
print('File uploaded successfully!')
print(f'Download link: {result["download_url"]}')
else:
print(f'File upload failed: {result.get("message", "Unknown error")}')
except Exception as e:
print(f'An error occurred: {str(e)}')
finally:
# Close the file
files['file'].close()
// Using API to upload a file with JavaScript (Fetch API)
// Get file upload form elements
const fileInput = document.getElementById('fileInput');
const uploadButton = document.getElementById('uploadButton');
const resultDiv = document.getElementById('result');
// Your API key
const apiKey = 'YOUR_API_KEY_HERE';
// Add event listener to upload button
uploadButton.addEventListener('click', async () => {
// Check if a file is selected
if (!fileInput.files || fileInput.files.length === 0) {
resultDiv.innerHTML = 'Please select a file first';
return;
}
const file = fileInput.files[0];
// Create FormData object
const formData = new FormData();
formData.append('file', file);
// Show uploading message
resultDiv.innerHTML = 'Uploading file...';
try {
// Send upload request
const response = await fetch('https://www.gbe.lol/api/upload.php', {
method: 'POST',
headers: {
'X-API-KEY': apiKey
},
body: formData
});
// Convert response to JSON
const result = await response.json();
// Display upload result
if (result.success === true) {
resultDiv.innerHTML = `
File uploaded successfully!
Download link: ${result.download_url}
`;
} else {
resultDiv.innerHTML = `
File upload failed: ${result.message || 'Unknown error'}
`;
}
} catch (error) {
// Display error message
resultDiv.innerHTML = `
An error occurred: ${error.message}
`;
}
});
# Using API to upload a file with cURL (from command line)
# Replace the following variables with your values
API_KEY="YOUR_API_KEY_HERE"
FILE_PATH="/path/to/your/file.zip"
# Execute cURL request to upload the file
curl -X POST \
-H "X-API-KEY: $API_KEY" \
-F "file=@$FILE_PATH" \
https://www.gbe.lol/api/upload.php
// Using API to upload a file with C#
using System;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace GhostbyteApiExample
{
class Program
{
static async Task Main(string[] args)
{
// Replace with your API key
string apiKey = "YOUR_API_KEY_HERE";
// Path to the file you want to upload
string filePath = @"C:\path\to\your\file.zip";
// Check if file exists
if (!File.Exists(filePath))
{
Console.WriteLine("File not found");
return;
}
try
{
// Create HttpClient
using (HttpClient client = new HttpClient())
{
// Add API key to headers
client.DefaultRequestHeaders.Add("X-API-KEY", apiKey);
// Create multipart content
using (var content = new MultipartFormDataContent())
{
// Add file to content
var fileContent = new ByteArrayContent(File.ReadAllBytes(filePath));
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/octet-stream");
// Extract filename from path
string fileName = Path.GetFileName(filePath);
content.Add(fileContent, "file", fileName);
// Send request
Console.WriteLine("Uploading file...");
var response = await client.PostAsync("https://www.gbe.lol/api/upload.php", content);
// Read response
string responseContent = await response.Content.ReadAsStringAsync();
// Convert response to JSON object
dynamic result = JsonConvert.DeserializeObject(responseContent);
// Display upload result
if (result.success == true)
{
Console.WriteLine("File uploaded successfully!");
Console.WriteLine($"Download link: {result.download_url}");
}
else
{
Console.WriteLine($"File upload failed: {result.message ?? 'Unknown error'}");
}
}
}
}
catch (Exception ex)
{
Console.WriteLine($"An error occurred: {ex.Message}");
}
}
}
}
To get an API key or for technical support, please join our Discord server: