API Bad-Protect
Intégrez la réputation inter-serveurs Bad-Protect dans vos bots. Signalez des incidents, synchronisez vos bans et protégez votre communauté.
Base URL
https://bad-protect.fr/api/v1
Routes disponibles
https://bad-protect.fr/api/v1/ping
🌐 Public
https://bad-protect.fr/api/v1/
🌐 Public
https://bad-protect.fr/api/v1/reputation/:userId
reputation:read
🔒 Auth
https://bad-protect.fr/api/v1/incident
incident:write
🔒 Auth
https://bad-protect.fr/api/v1/stats
stats:read
🔒 Auth
Limites de taux
120
Par clé / min
300
Global IP / min
429 Too Many Requests
Headers X-RateLimit-Remaining et X-RateLimit-Reset sur chaque réponse.
Niveaux de confiance
/ping
🌐 Public
Réponse 200
{
"status": "ok",
"version": "v1",
"timestamp": "2026-03-22T12:00:00.000Z",
"message": "Bad-Protect API opérationnelle"
}
/reputation/:userId
🔒 Auth
Scope requis : reputation:read
Paramètres
| Champ | Type | Requis | Description |
|---|---|---|---|
userId |
string |
Oui | ID Discord (17-20 chiffres) |
Exemple Node.js
const res = await fetch('https://bad-protect.fr/api/v1/reputation/123456789012345678', {
headers: { 'x-api-key': 'bp_live_votre_cle' }
});
const data = await res.json();
console.log(data.reputation.trust_level); // "SUSPICIOUS"
Réponse 200
{
"source": "db",
"reputation": {
"user_id": "123456789012345678",
"username": null,
"global_score": 95,
"trust_level": "SUSPICIOUS",
"total_reports": 3,
"total_warns": 2,
"total_kicks": 1,
"total_bans": 0
},
"active_bans": [],
"recent_incidents": [...]
}
/incident
🔒 Auth
Scope requis : incident:write
Paramètres
| Champ | Type | Requis | Description |
|---|---|---|---|
user_id |
string |
Oui | ID Discord de l'utilisateur |
incident_type |
string |
Oui | SPAM, RAID, TOXIC, SCAM, THREAT, NSFW, IMPERSONATION, OTHER |
action_taken |
string |
Non | NONE, WARN, KICK, BAN (défaut: NONE) |
severity |
number |
Non | 1 à 5 (défaut: 2) |
description |
string |
Non | Description (max 1000 chars) |
guild_id |
string |
Non | ID Discord du serveur source |
guild_name |
string |
Non | Nom du serveur source |
Exemple Node.js
const res = await fetch('https://bad-protect.fr/api/v1/incident', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'bp_live_votre_cle'
},
body: JSON.stringify({
user_id: '123456789012345678',
incident_type: 'SPAM',
action_taken: 'KICK',
severity: 3,
guild_id: '987654321098765432'
})
});
Réponse 200
{
"success": true,
"user_id": "123456789012345678",
"new_score": 45,
"trust_level": "NEUTRAL",
"score_added": 30
}
/stats
🔒 Auth
Scope requis : stats:read
Réponse 200
{
"total_users": 15420,
"avg_score": 12,
"total_incidents": 8934,
"last_incident_at": "2026-03-22T12:00:00.000Z",
"active_global_bans": 234
}
Mesures de sécurité actives
Clés stockées chiffrées
10 échecs/min → blocage
Par clé ET par IP
Sanitisation complète
Permissions granulaires
Origines autorisées seulement
CSP, X-Frame-Options...
0 injection SQL possible
Codes d'erreur HTTP
| Code | Signification | Action |
|---|---|---|
200 |
Succès | — |
400 |
Paramètres invalides | Vérifiez le body |
401 |
Clé manquante ou invalide | Ajoutez x-api-key |
403 |
Clé révoquée ou scope insuffisant | Vérifiez vos permissions |
404 |
Route inconnue | Vérifiez l'URL |
429 |
Trop de requêtes | Attendez X-RateLimit-Reset |
500 |
Erreur interne | Contactez le support |
Test — Ping
Aucune clé requise. Vérifie que l'API répond.
Test — Réputation utilisateur
Testez /reputation/:userId avec votre clé API.