API Documentation
Semua yang kamu butuhin buat integrasi InStorage ke aplikasi kamu
Overview
InStorage punya REST API simpel buat upload, retrieve, dan kelola file. Sistem ini pakai content-addressed storage, jadi setiap file diidentifikasi dari hash kontennya, bukan nama file
Semua endpoint bisa diakses tanpa API key, upload langsung dan dapat link langsung
Base URL
https://instorage.zone.id
| Operasi | Method | Endpoint | Kegunaan |
|---|---|---|---|
| Upload | POST | /api/upload | Upload file baru |
| Retrieve | GET | /f/{hash} | Unduh/tampilkan file |
| Check | GET | /api/check/{hash} | Cek keberadaan file |
| Metadata | GET | /api/metadata/{hash} | Info detail file |
POST Upload File
Upload file baru ke storage, server bakal balikin hash unik dan URL publik buat akses file tersebut
POST /api/upload
Request
- Content-Type:
multipart/form-data - Body: Form data dengan field
file - Limit: Maksimal 50MB per file
Contoh Request
const formData = new FormData()
formData.append('file', fileInput)
const response = await fetch('https://instorage.zone.id/api/upload', {
method: 'POST',
body: formData
})
const data = await response.json()
console.log(data.url) // https://instorage.zone.id/f/abc123...
curl -X POST https://instorage.zone.id/api/upload \
-F "file=@/path/to/your/file.png"
Response
{
"id": "a1b2c3d4e5f6...",
"url": "https://instorage.zone.id/f/a1b2c3d4e5f6...",
"hash": "a1b2c3d4e5f6...",
"size": 102456,
"contentType": "image/png"
}
GET Retrieve File
Unduh atau tampilkan file berdasarkan hash-nya, endpoint ini publik dan siapa aja bisa akses
GET /f/{hash}
Contoh
https://instorage.zone.id/f/a1b2c3d4e5f6
File bakal langsung ditampilin atau diunduh browser tergantung tipe kontennya (gambar ditampilin, file lain diunduh)
GET Cek Eksistensi
Cek apakah file dengan hash tertentu masih ada di storage tanpa ngunduh isinya
GET /api/check/{hash}
Response
{
"exists": true,
"hash": "a1b2c3d4e5f6..."
}
GET Metadata
Ambil info detail tentang file tanpa ngunduhnya, kayak ukuran, tipe konten, dan tanggal upload
GET /api/metadata/{hash}
Response
{
"hash": "a1b2c3d4e5f6...",
"contentType": "image/png",
"size": 102456,
"uploadedAt": "2026-06-06T00:00:00Z"
}
Error Codes
| Kode | Status | Deskripsi |
|---|---|---|
| 400 | Bad Request | Request gak valid atau field file gak ditemukan |
| 404 | Not Found | File gak ditemukan, hash gak valid atau file udah kadaluwarsa |
| 413 | Payload Too Large | Ukuran file melebihi batas maksimum 50MB |
| 500 | Server Error | Ada error internal, coba lagi nanti |
Catatan Penting
Retensi 30 Hari
File otomatis dihapus setelah 30 hari gak aktif, upload ulang file yang sama buat reset masa berlakunya
Content-Addressed
Hash dihasilkan dari konten file, upload file yang sama (walau beda nama) bakal menghasilkan hash yang identik
Batas 50MB
Setiap file yang diupload gak boleh lebih dari 50MB, yang lebih gede bakal ditolak dengan error 413