DogBox API v1

Base URL: https://dogbox.my.id

Deployment ini pakai Vercel Blob. Upload lewat browser (halaman utama) langsung ke Blob storage, tanpa batas ukuran selain MAX_FILE_SIZE/MAX_MP4_FILE_SIZE. Upload lewat API (/api/v1/upload) dibatasi ~4.4 MB karena lewat Vercel Function — untuk file API lebih besar, pakai paket deployment VPS.

Authentication

Kirim API key lewat header Authorization: Bearer <key> (atau X-API-Key: <key>). Minta admin membuatkan key lewat bot Telegram (/createkey) atau endpoint admin di bawah.

Endpoints

MethodPathKeterangan
POST/api/v1/uploadUpload file (auth wajib)
GET/api/v1/filesList file milikmu (admin: semua file)
GET/api/v1/info/:slugDetail satu file
DELETE/api/v1/file/:slugHapus file (pemilik/admin)
GET/api/v1/meInfo key yang sedang dipakai
GET/POST/DELETE/api/v1/admin/keysKelola API key (admin only)

Upload

File dikirim sebagai raw body (bukan multipart/form-data) — nama file dan content-type dikirim lewat query string / header.

curl
curl -X POST "https://dogbox.my.id/api/v1/upload?filename=photo.jpg" \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: image/jpeg" \
  --data-binary @photo.jpg
Node.js
import fs from "node:fs";

const res = await fetch("https://dogbox.my.id/api/v1/upload?filename=photo.jpg", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_KEY",
    "Content-Type": "image/jpeg"
  },
  body: fs.readFileSync("photo.jpg")
});

const data = await res.json();
console.log(data);
Python
import requests

with open("photo.jpg", "rb") as f:
    data = f.read()

response = requests.post(
    "https://dogbox.my.id/api/v1/upload",
    params={"filename": "photo.jpg"},
    headers={
        "Authorization": "Bearer YOUR_KEY",
        "Content-Type": "image/jpeg",
    },
    data=data,
)
print(response.json())

Response:

{ "success": true, "slug": "a1b2c3d4e5f6.jpg", "url": "https://files.dogbox.my.id/a1b2c3d4e5f6.jpg", "size": 123456, "mimetype": "image/jpeg" }

List files

curl
curl "https://dogbox.my.id/api/v1/files?limit=20" \
  -H "Authorization: Bearer YOUR_KEY"
Node.js
const res = await fetch("https://dogbox.my.id/api/v1/files?limit=20", {
  headers: { "Authorization": "Bearer YOUR_KEY" }
});
console.log(await res.json());
Python
import requests

response = requests.get(
    "https://dogbox.my.id/api/v1/files",
    params={"limit": 20},
    headers={"Authorization": "Bearer YOUR_KEY"},
)
print(response.json())

File info

curl
curl "https://dogbox.my.id/api/v1/info/a1b2c3d4e5f6.jpg" \
  -H "Authorization: Bearer YOUR_KEY"
Node.js
const res = await fetch("https://dogbox.my.id/api/v1/info/a1b2c3d4e5f6.jpg", {
  headers: { "Authorization": "Bearer YOUR_KEY" }
});
console.log(await res.json());
Python
import requests

response = requests.get(
    "https://dogbox.my.id/api/v1/info/a1b2c3d4e5f6.jpg",
    headers={"Authorization": "Bearer YOUR_KEY"},
)
print(response.json())

Delete a file

curl
curl -X DELETE "https://dogbox.my.id/api/v1/file/a1b2c3d4e5f6.jpg" \
  -H "Authorization: Bearer YOUR_KEY"
Node.js
const res = await fetch("https://dogbox.my.id/api/v1/file/a1b2c3d4e5f6.jpg", {
  method: "DELETE",
  headers: { "Authorization": "Bearer YOUR_KEY" }
});
console.log(await res.json());
Python
import requests

response = requests.delete(
    "https://dogbox.my.id/api/v1/file/a1b2c3d4e5f6.jpg",
    headers={"Authorization": "Bearer YOUR_KEY"},
)
print(response.json())

Me

Cek nama dan role dari key yang sedang dipakai.

curl
curl "https://dogbox.my.id/api/v1/me" -H "Authorization: Bearer YOUR_KEY"
Node.js
const res = await fetch("https://dogbox.my.id/api/v1/me", {
  headers: { "Authorization": "Bearer YOUR_KEY" }
});
console.log(await res.json());
Python
import requests

response = requests.get(
    "https://dogbox.my.id/api/v1/me",
    headers={"Authorization": "Bearer YOUR_KEY"},
)
print(response.json())

Admin: manage keys

Butuh ADMIN_API_KEY, bukan API key biasa. Lihat README untuk cara set nilainya.

Buat key baru

curl
curl -X POST "https://dogbox.my.id/api/v1/admin/keys" \
  -H "Authorization: Bearer ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"my integration","role":"user"}'
Node.js
const res = await fetch("https://dogbox.my.id/api/v1/admin/keys", {
  method: "POST",
  headers: {
    "Authorization": "Bearer ADMIN_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ name: "my integration", role: "user" })
});
console.log(await res.json());
Python
import requests

response = requests.post(
    "https://dogbox.my.id/api/v1/admin/keys",
    headers={"Authorization": "Bearer ADMIN_KEY"},
    json={"name": "my integration", "role": "user"},
)
print(response.json())

Simpan key dari response ini sekarang — tidak akan ditampilkan lagi setelahnya (cuma hash-nya yang disimpan di server).

List semua key

curl
curl "https://dogbox.my.id/api/v1/admin/keys" -H "Authorization: Bearer ADMIN_KEY"
Node.js
const res = await fetch("https://dogbox.my.id/api/v1/admin/keys", {
  headers: { "Authorization": "Bearer ADMIN_KEY" }
});
console.log(await res.json());
Python
import requests

response = requests.get(
    "https://dogbox.my.id/api/v1/admin/keys",
    headers={"Authorization": "Bearer ADMIN_KEY"},
)
print(response.json())

Hapus key

curl
curl -X DELETE "https://dogbox.my.id/api/v1/admin/keys?keyHash=..." \
  -H "Authorization: Bearer ADMIN_KEY"
Node.js
const res = await fetch("https://dogbox.my.id/api/v1/admin/keys?keyHash=...", {
  method: "DELETE",
  headers: { "Authorization": "Bearer ADMIN_KEY" }
});
console.log(await res.json());
Python
import requests

response = requests.delete(
    "https://dogbox.my.id/api/v1/admin/keys",
    params={"keyHash": "..."},
    headers={"Authorization": "Bearer ADMIN_KEY"},
)
print(response.json())

Errors

Semua error dikembalikan sebagai { "success": false, "error": "..." } dengan HTTP status yang sesuai (400, 401, 403, 404, 413, 429, 500).