Skip to main content

Get Blocked IPs

Retrieves a list of blocked IP addresses. Requires CanPurge authorization.
GET /security/blocked-ips

Query Parameters

activeOnly
boolean
default:"true"
Filter to show only active blocks (excludes expired blocks)

Authorization

Authorization
string
required
Bearer token with CanPurge permission

Response

Returns an array of blocked IP entries.
id
integer
Unique identifier for the blacklist entry
ipAddress
string
The blocked IP address
reason
string
Human-readable reason for the block
isActive
boolean
Whether the block is currently active
expiryDate
datetime
When the block will expire (null for permanent blocks)
createdAt
datetime
When the block was created

Example Request

curl -X GET "https://api.example.com/security/blocked-ips?activeOnly=true" \
  -H "Authorization: Bearer YOUR_TOKEN"

Example Response

[
  {
    "id": 1,
    "ipAddress": "192.168.1.50",
    "reason": "Too many failed login attempts",
    "isActive": true,
    "expiryDate": "2024-03-16T10:30:00Z",
    "createdAt": "2024-03-15T10:30:00Z"
  },
  {
    "id": 2,
    "ipAddress": "10.0.0.15",
    "reason": "Suspicious activity detected",
    "isActive": true,
    "expiryDate": null,
    "createdAt": "2024-03-14T15:20:00Z"
  }
]

Block IP Address

Adds an IP address to the blacklist. Requires CanPurge authorization.
POST /security/block-ip

Authorization

Authorization
string
required
Bearer token with CanPurge permission

Request Body

ipAddress
string
required
The IP address to block
reason
string
required
Human-readable reason for blocking the IP
blackListReason
enum
default:"ManualBlock"
Category of the block reason:
  • ManualBlock - Manually blocked by administrator
  • TooManyAttempts - Automatically blocked due to failed attempts
  • SuspiciousActivity - Blocked due to suspicious behavior
  • ReportedAbuse - Blocked due to abuse reports
expiryDate
datetime
When the block should expire (null for permanent block)
notes
string
Additional notes about the block

Response

Returns a result object indicating success or failure.
succeeded
boolean
Whether the operation succeeded
errors
array
Array of error messages if the operation failed

Example Request

curl -X POST "https://api.example.com/security/block-ip" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "ipAddress": "192.168.1.75",
    "reason": "Multiple failed authentication attempts",
    "blackListReason": "TooManyAttempts",
    "expiryDate": "2024-03-20T00:00:00Z",
    "notes": "Temporary block for 5 days"
  }'

Example Response

{
  "succeeded": true,
  "errors": []
}

Unblock IP Address

Removes an IP address from the blacklist. Requires CanPurge authorization.
POST /security/unblock-ip

Authorization

Authorization
string
required
Bearer token with CanPurge permission

Request Body

ipAddress
string
required
The IP address to unblock

Response

Returns a result object indicating success or failure.
succeeded
boolean
Whether the operation succeeded
errors
array
Array of error messages if the operation failed

Example Request

curl -X POST "https://api.example.com/security/unblock-ip" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "ipAddress": "192.168.1.75"
  }'

Example Response

{
  "succeeded": true,
  "errors": []
}

Unlock User Account

Unlocks a user account that has been locked due to security reasons. Requires CanPurge authorization.
POST /security/unlock-account

Authorization

Authorization
string
required
Bearer token with CanPurge permission

Request Body

userId
string
required
The unique identifier of the user account to unlock

Response

Returns a result object indicating success or failure.
succeeded
boolean
Whether the operation succeeded
errors
array
Array of error messages if the operation failed

Example Request

curl -X POST "https://api.example.com/security/unlock-account" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "userId": "user123"
  }'

Example Response

{
  "succeeded": true,
  "errors": []
}

Blacklist Reasons

The system supports the following blacklist reason categories:
  • ManualBlock - IP manually blocked by an administrator
  • TooManyAttempts - Automatically blocked after exceeding failed login attempts
  • SuspiciousActivity - Blocked due to suspicious or anomalous behavior
  • ReportedAbuse - Blocked following abuse reports or security incidents

Error Responses

{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Authentication required"
}

Build docs developers (and LLMs) love