2. Ban Management Module

2.1 Apply to Add Ban

Add new ban records (support both online/offline modes).

Endpoint: POST /bans/add

Request Parameters:

JSON
{ "token": "aBcD1234EfGh5678IjKlMnOpQrSt", "player_id": "player123", "ip": "192.168.1.1", "ipv6": "2001:db8::1", "online": true, "mcuuid": "550e8400-e29b-41d4-a716-446655440000" }
ParameterTypeRequiredDescription
tokenstringYesAuthentication Token (requires upload permission)
player_idstringConditionalPlayer identifier (at least one with ip must be provided)
ipstringConditionalIPv4 address (at least one with player_id must be provided)
ipv6stringNoIPv6 address
onlinebooleanNoData storage mode (true=online, default false=offline)
mcuuidstringNoMinecraft UUID (optional in online mode)

Request Examples:

cURL - Offline Mode:

Bash
curl -X POST https://api.ndpreforged.com/bans/add \ -H "Content-Type: application/json" \ -d '{ "token": "aBcD1234EfGh5678IjKlMnOpQrSt", "player_id": "player123", "ip": "192.168.1.1", "online": false }'

cURL - Online Mode:

Bash
curl -X POST https://api.ndpreforged.com/bans/add \ -H "Content-Type: application/json" \ -d '{ "token": "aBcD1234EfGh5678IjKlMnOpQrSt", "player_id": "player123", "ip": "192.168.1.1", "ipv6": "2001:db8::1", "online": true, "mcuuid": "550e8400-e29b-41d4-a716-446655440000" }'

Python:

Python
import requests response = requests.post( "https://api.ndpreforged.com/bans/add", json={ "token": "aBcD1234EfGh5678IjKlMnOpQrSt", "player_id": "player123", "ip": "192.168.1.1", "online": False } )

Response Examples:

Success (200 OK):

JSON
{ "message": "Added" }

Error Responses:

Status CodeError MessageDescription
400Missing tokenMissing authentication token
400Invalid token formatInvalid token format
400Token not foundToken does not exist
403No permissionNo upload permission
400Missing player_id or ipMissing required identifier parameters
400Invalid IP formatInvalid IPv4 format
400Invalid IPv6 formatInvalid IPv6 format
400Invalid MCUUID formatInvalid MCUUID format
400Already bannedOffline mode: record already exists
400Already existsOnline mode: record already exists
500Server errorServer internal error

Navigation