Skip to content

Commit 72e5a35

Browse files
committed
Add API reference documentation and response format examples
1 parent 9d62122 commit 72e5a35

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,40 @@ curl -X POST https://malware-detector-production.up.railway.app/api/scan \
7272
-F "file=@sample.exe"
7373
```
7474

75+
### Response Format
76+
77+
Successful scan returns:
78+
```json
79+
{
80+
"filename": "sample.exe",
81+
"malicious": true,
82+
"confidence": 0.97,
83+
"threat_score": 87,
84+
"explanation": {
85+
"top_features": [
86+
{"name": "suspicious_section_count", "value": 8, "contribution": 0.32},
87+
{"name": "high_entropy_sections", "value": 5, "contribution": 0.28}
88+
]
89+
},
90+
"sha256": "a1b2c3d4...",
91+
"timestamp": "2026-07-29T12:00:00Z"
92+
}
93+
```
94+
95+
### API Reference
96+
97+
| Endpoint | Method | Description | Query Params |
98+
|---|---|---|---|
99+
| `/api/health` | GET | Service health check ||
100+
| `/api/scan` | POST | Upload and scan a PE file | `file` (multipart) |
101+
| `/api/history` | GET | Paginated scan history | `page`, `limit` |
102+
| `/api/report/{id}` | GET | Detailed scan report by ID ||
103+
| `/api/dashboard` | GET | Aggregate statistics ||
104+
105+
**Authentication:** The API is publicly accessible. Rate limiting is applied per IP (100 req/min).
106+
107+
**Errors:** All endpoints return `{"detail": "error message"}` with appropriate HTTP status codes (400, 404, 422, 500).
108+
75109
## Running Tests
76110

77111
```bash

0 commit comments

Comments
 (0)