API V1.0

Developer API

Integrasikan pengunggahan gambar langsung ke dalam aplikasi atau skrip Anda menggunakan RESTful API kami yang cepat dan terstandarisasi.

1. Autentikasi

Semua permintaan API memerlukan API Key. Anda dapat membuat API Key melalui menu Dashboard → API Keys.

Kirimkan kunci API Anda melalui salah satu header HTTP berikut:

Authorization: Bearer YOUR_API_KEY
# atau
X-API-KEY: YOUR_API_KEY

2. Endpoint Upload

POST https://imgly.sbs/api/upload.php

Parameter Form-Data

Parameter Tipe Wajib Deskripsi
image File Binary Wajib File gambar biner (JPG, PNG, WEBP, GIF). Maksimal 10 MB.
album_id Integer Opsional ID Album pengguna tempat menyimpan gambar ini.

Format Respon Sukses (HTTP 200)

{
    "success": true,
    "image": {
        "id": 142,
        "url": "https://imgly.sbs/uploads/2026/09/8f92ab34d9128f72.webp",
        "thumbnail_url": "https://imgly.sbs/uploads/thumbs/thumb_8f92ab34d9128f72.webp",
        "page_url": "https://imgly.sbs/image.php?id=142",
        "delete_url": "https://imgly.sbs/delete.php?token=4f9c81a2e...",
        "width": 1920,
        "height": 1080,
        "size": 245678,
        "mime": "image/webp"
    }
}

3. Contoh Implementasi Kode

cURL (Terminal / Bash)

curl -X POST \
  -F "image=@/path/to/screenshot.png" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  https://imgly.sbs/api/upload.php

JavaScript (Fetch API)

const formData = new FormData();
formData.append('image', fileInput.files[0]);

const response = await fetch('https://imgly.sbs/api/upload.php', {
    method: 'POST',
    headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: formData
});

const data = await response.json();
console.log('Direct image URL:', data.image.url);

PHP (cURL)

$ch = curl_init('https://imgly.sbs/api/upload.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_KEY'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
    'image' => new CURLFile('/path/to/image.jpg')
]);
$result = curl_exec($ch);
curl_close($ch);
$json = json_decode($result, true);