Risk Detection API
High-performance API for detecting sellers, scammers, and buyers when users join Discord servers.
Features
- Ultra-fast lookups (<100ms average, <300ms worst-case)
- Secure API key authentication
- PostgreSQL database backend
- Redis caching layer
- Rate limiting per API key
- Horizontally scalable
API Endpoints
Health Check
GET /health
No authentication required. Returns API status and service connectivity.
Check User (Critical Path)
GET /v1/check/:discord_id
Authorization: Bearer <api_key>
Response:
{
"found": true,
"category": "SELLER",
"note": "Known Telegram seller",
"_cached": false,
"_response_time_ms": 45
}
Add/Update Entry
POST /v1/entry
Authorization: Bearer <api_key>
Content-Type: application/json
{
"discord_id": "123456789012345678",
"category": "SCAMMER",
"note": "Chargeback fraud"
}
Requires write or admin permission.
Remove Entry
DELETE /v1/entry/:discord_id
Authorization: Bearer <api_key>
Requires write or admin permission.
API Key Permissions
- read: Can check users only
- write: Can check, add, update, and remove users
- admin: Full access (same as write currently)
Performance
- Average response time: <100ms
- Worst-case response time: <300ms
- Cache hit rate: ~90%+ (after warm-up)
- Supports concurrent requests from multiple bots
Security
- API keys are hashed using bcrypt
- Rate limiting per API key
- Input validation on all endpoints
- No PII beyond Discord IDs
1