API Reference
Base URL: https://audit-otomatis-phi.vercel.app
RequestBudget di lib/rate-limit.ts). Cooldown per domain: 5 menit di production, 10 detik saat NODE_ENV=development. Cooldown scan pasif dan QC dihitung terpisah (prefix Redis beda)./api/scanBelum tersedia sebagai REST endpoint publik. Memulai scan saat ini dilakukan lewat Next.js Server Action (startScanAction di lib/actions.ts), dipanggil langsung dari form di halaman Overview — bukan lewat fetch ke /api/scan. Ditulis di sini supaya konsisten dengan rencana API, tapi cURL di bawah TIDAK akan berhasil sampai endpoint-nya benar-benar dibuat.
| Field | Type | Req. | Note |
|---|---|---|---|
| domain | string | yes | URL atau hostname target, mis. "example.com" |
{
"ok": true,
"scanId": "aB3xQ9kLmZ"
}# BELUM BERFUNGSI — lihat catatan di atas
curl -X POST 'https://audit-otomatis-phi.vercel.app/api/scan' \
-H 'Content-Type: application/json' \
-d '{"domain":"example.com"}'/api/scan/[id]/streamServer-Sent Events. Tiap event berupa JSON ScanLogEvent ({type, message?, status?, finding?, endpoints?, timestamp}). type bisa log | status | finding | done | error | blocked | endpoints. Mendukung resume via header Last-Event-ID kalau koneksi putus.
id: 12
data: {"type":"finding","finding":{...},"timestamp":1785457624177}
id: 13
data: {"type":"done","status":"done","timestamp":1785457630001}curl -N 'https://audit-otomatis-phi.vercel.app/api/scan/aB3xQ9kLmZ/stream'/api/scan/[id]Snapshot status scan saat ini (bukan realtime — pakai /stream untuk itu).
{
"id": "aB3xQ9kLmZ",
"domain": "example.com",
"status": "done",
"createdAt": 1785457624177,
"requestsMade": 87,
"endpointsDiscovered": 14,
"pagesCrawled": 12,
"jsFilesScanned": 6,
"findingsCount": 3,
"blockedReason": null
}curl 'https://audit-otomatis-phi.vercel.app/api/scan/aB3xQ9kLmZ'/api/qc/scanMembuat QC run baru lalu langsung menjalankannya di background. Field body sebenarnya domain (bukan url seperti di rencana awal) — nama field ini yang divalidasi oleh validateDomainInput().
| Field | Type | Req. | Note |
|---|---|---|---|
| domain | string | yes | URL atau hostname target |
| modules.seo | boolean | no | default true |
| modules.perf | boolean | no | default true |
| modules.content | boolean | no | default true |
{ "ok": true, "id": "qC7nR2wXpL" }curl -X POST 'https://audit-otomatis-phi.vercel.app/api/qc/scan' \
-H 'Content-Type: application/json' \
-d '{"domain":"example.com","modules":{"seo":true,"perf":true,"content":false}}'/api/qc/[id]/streamSama seperti scan stream tapi payload QcLogEvent: {type, message?, status?, module?, timestamp}. type: log | status | module_done | done | error.
id: 4
data: {"type":"module_done","module":"seo","timestamp":1785457901234}curl -N 'https://audit-otomatis-phi.vercel.app/api/qc/qC7nR2wXpL/stream'/api/qc/[id]Snapshot QC state termasuk result per modul (skor 0–100 masing-masing).
{
"id": "qC7nR2wXpL",
"domain": "example.com",
"status": "done",
"modules": { "seo": true, "perf": true, "content": false },
"result": {
"seo": { "score": 82, "issues": [...] },
"perf": { "score": 91, "metrics": { "source": "pagespeed", ... } }
},
"requestsMade": 41
}curl 'https://audit-otomatis-phi.vercel.app/api/qc/qC7nR2wXpL'/api/requestsList semua scan (Passive + QC berbagi store yang sama), terbaru dulu, maks 50.
{
"scans": [
{
"id": "aB3xQ9kLmZ",
"domain": "example.com",
"origin": "https://example.com",
"createdAt": 1785457624177,
"status": "done",
"pagesCount": 12,
"findingsCount": 3,
"severityCounts": { "CRITICAL": 0, "HIGH": 1, "MEDIUM": 2, "LOW": 0, "INFO": 0 }
}
]
}curl 'https://audit-otomatis-phi.vercel.app/api/requests'/api/requests/[id]Semua halaman yang di-crawl untuk satu scan, lengkap dengan header, content-type, ukuran, dan preview HTML — plus deteksi tech stack sederhana. 404 kalau scan tidak ada / sudah kedaluwarsa.
{
"meta": { "id": "aB3xQ9kLmZ", "hostname": "example.com", "url": "https://example.com", "createdAt": 1785457624177, "status": "done" },
"pages": [
{ "url": "https://example.com", "status": 200, "contentType": "text/html", "size": 15342, "headers": {...} }
],
"techStack": ["Next.js", "Vercel"]
}curl 'https://audit-otomatis-phi.vercel.app/api/requests/aB3xQ9kLmZ'