Use our robust API to upload and manage your images
curl -F "[email protected]" https://img.mrbean.dev/api/upload.php
curl -F "api_paste_code=Hello World" https://img.mrbean.dev/api/pastebin.php
Upload files directly to the server.
| Name | Description | Required |
|---|---|---|
file |
The file to upload | Required |
curl -F "[email protected]" https://img.mrbean.dev/api/upload.php
{
"status": "ok",
"hash": "y1b6hr.jpg",
"url": "https://img.mrbean.dev/y1b6hr.jpg",
"delete_code": "z0e1mdo8szxnauspxp2f080e4wd4ycf2",
"delete_url": "https://img.mrbean.dev/delete_z0e1mdo8szxnauspxp2f080e4wd4ycf2/y1b6hr.jpg"
}
{
"status": "err",
"reason": "Unsupported filetype"
}
Upload content by providing a link to the content. If the URL is a webpage, it will save the HTML content as a text file.
| Name | Description | Required |
|---|---|---|
url |
URL of the content to upload | Required |
curl -s "https://img.mrbean.dev/api/geturl.php?url=https://xkcd.com"
{
"status": "ok",
"hash": "2mr2va.txt",
"url": "https://img.mrbean.dev/2mr2va.txt",
"filetype": "text",
"delete_code": "aqxqlv3kqokxd15xpkqp8zjljpqerveu",
"delete_url": "https://img.mrbean.dev/delete_aqxqlv3kqokxd15xpkqp8zjljpqerveu/2mr2va.txt"
}
curl "https://img.mrbean.dev/api/geturl.php?url=https://i.imgur.com/qQstLQt.mp4"
{
"status": "ok",
"hash": "u0ni1m.mp4",
"url": "https://img.mrbean.dev/u0ni1m.mp4",
"filetype": "mp4",
"delete_code": "aqxqlv3kqokxd15xpkqp8zjljpqerveu",
"delete_url": "https://img.mrbean.dev/delete_aqxqlv3kqokxd15xpkqp8zjljpqerveu/u0ni1m.mp4"
}
{
"status": "err",
"reason": "Unsupported filetype"
}
This API can be used to directly post text. Server responds with the URL to the bin or with an error message.
| Name | Description | Required |
|---|---|---|
api_paste_code |
The text content to paste | Required |
curl -F "api_paste_code=Hello World" https://img.mrbean.dev/api/pastebin.php
https://img.mrbean.dev/vekjy4e5rr.txt
This API will get information about any given hash.
| Name | Description | Required |
|---|---|---|
hash |
Hash of the file to get information about | Required |
curl "https://img.mrbean.dev/api/info.php?hash=9k3rbw.mp4"
{
"status": "ok",
"hash": "9k3rbw.mp4",
"size_bytes": 2513225,
"size_interpreted": "2.4 MB",
"type": "video/mp4",
"type_interpreted": "mp4"
}
Upload base64 encoded images to the server.
| Name | Description | Required |
|---|---|---|
base64 |
The base64 encoded image data | Required |
(echo -n "base64="; echo -n "data:image/jpeg;base64,$(base64 -w 0 test.jpg)") | \
curl --data @- https://img.mrbean.dev/api/base64.php
{
"status": "ok",
"hash": "lpl119.jpg",
"url": "https://img.mrbean.dev/lpl119.jpg",
"filetype": "jpeg",
"delete_code": "z0e1mdo8szxnauspxp2f080e4wd4ycf2",
"delete_url": "https://img.mrbean.dev/delete_z0e1mdo8szxnauspxp2f080e4wd4ycf2/lpl119.jpg"
}
function uploadImage($imagePath) {
if (!file_exists($imagePath)) return false;
$ch = curl_init('https://img.mrbean.dev/api/upload.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'file' => curl_file_create($imagePath)
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
$result = uploadImage('test.jpg');
echo $result['url']; // Outputs: https://img.mrbean.dev/y1b6hr.jpg
function createTextPaste($text) {
$ch = curl_init('https://img.mrbean.dev/api/pastebin.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'api_paste_code' => $text
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
$pasteUrl = createTextPaste('Hello World from PHP!');
echo $pasteUrl; // Outputs: https://img.mrbean.dev/vekjy4e5rr.txt
function uploadFromUrl($url) {
$encodedUrl = urlencode($url);
$requestUrl = "https://img.mrbean.dev/api/geturl.php?url={$encodedUrl}";
$ch = curl_init($requestUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
$result = uploadFromUrl('https://i.imgur.com/qQstLQt.mp4');
echo $result['url']; // Outputs: https://img.mrbean.dev/u0ni1m.mp4