D
DGuardAPI Documentation

Error Codes

All DGuard API errors follow a consistent format with specific error codes per module. Use these codes to handle errors gracefully in your application.

Error Response Format

All error responses include the following structure:

{
  "error_code": "FRAUD_001",
  "message": "Transaction not found",
  "details": {
    "transaction_id": "txn_123"
  },
  "timestamp": "2025-01-14T18:00:00Z",
  "request_id": "req_abc123"
}

HTTP Status Codes

CodeMeaning
200Success
201Created
400Bad Request - Invalid parameters
401Unauthorized - Invalid or expired token
403Forbidden - Insufficient permissions
404Not Found
409Conflict - Duplicate resource
422Unprocessable Entity - Validation error
429Too Many Requests - Rate limited
500Internal Server Error
503Service Unavailable
504Gateway Timeout

Authentication Errors (AUTH_)

CodeHTTPDescription
AUTH_001401Invalid credentials
AUTH_002401Token expired
AUTH_003403Insufficient scope
AUTH_004429Too many login attempts

Fraud Detection Errors (FRAUD_)

CodeHTTPDescription
FRAUD_001400Invalid transaction data
FRAUD_002400Too many transactions in batch (max 100)
FRAUD_003404Transaction not found
FRAUD_004422Unsupported transaction type
FRAUD_005429Rate limit exceeded
FRAUD_006500ML model error

Refund Errors (REFUND_)

CodeHTTPDescription
REFUND_001400Invalid refund request
REFUND_002404Original transaction not found
REFUND_003404Refund not found
REFUND_004409Duplicate refund (idempotency key)
REFUND_005409Transaction already refunded
REFUND_006400Cannot cancel (already processed)
REFUND_007422Amount exceeds original transaction
REFUND_008503Payment provider unavailable

Email Protection Errors (EMAIL_)

CodeHTTPDescription
EMAIL_001400Invalid email content
EMAIL_002400Missing required fields
EMAIL_003404Account not found
EMAIL_004409Account already connected
EMAIL_005401OAuth authorization failed
EMAIL_006429Rate limit exceeded
EMAIL_007500ML analysis error

URL Scanning Errors (URL_)

CodeHTTPDescription
URL_001400Invalid URL format
URL_002400Too many URLs in batch (max 100)
URL_003422URL not accessible
URL_004429Rate limit exceeded
URL_005504Scan timeout

SMS Protection Errors (SMS_)

CodeHTTPDescription
SMS_001400Empty or invalid message
SMS_002400Too many messages in batch (max 100)
SMS_003404Analysis not found
SMS_004422Unsupported platform
SMS_005429Rate limit exceeded
SMS_006500ML analysis error

VPN Service Errors (VPN_)

CodeHTTPDescription
VPN_001429Device limit reached (max 2)
VPN_002503No slots available in pool
VPN_003503Server under maintenance
VPN_004404Server not found
VPN_005404Session not found
VPN_006400Device already connected
VPN_007408Heartbeat timeout
VPN_008500OpenVPN configuration error

Dark Web Monitoring Errors (DARKWEB_)

CodeHTTPDescription
DARKWEB_001400Invalid email format
DARKWEB_002404Monitor not found
DARKWEB_003409Email already being monitored
DARKWEB_004429Too many queries
DARKWEB_005503Verification service unavailable

Notification Errors (NOTIF_)

CodeHTTPDescription
NOTIF_001400Invalid push token
NOTIF_002404Device not registered
NOTIF_003404Notification not found
NOTIF_004404User not found
NOTIF_005422Unsupported platform
NOTIF_006422Invalid category
NOTIF_007429Rate limit exceeded
NOTIF_008503Push service unavailable

Best Practices

  • Always check the error_code field in error responses for precise error handling.
  • Use the request_id from error responses when contacting support for faster resolution.
  • Implement exponential backoff for 429 (Rate Limited) and 503 (Service Unavailable) errors.
  • Log all error responses with their request_id for debugging and monitoring.