Error Codes

Understanding API error responses and how to handle them.

Error Response Format

All errors follow a consistent JSON format:

{
  "success": false,
  "error": "ACCOUNT_NOT_FOUND",
  "message": "Account not found.",
  "message_ar": "الحساب غير موجود."
}

Validation errors include additional details:

{
  "success": false,
  "error": "VALIDATION_FAILED",
  "message": "Validation failed",
  "message_ar": "فشل التحقق",
  "errors": {
    "target_rip": ["The target rip field is required."],
    "amount": ["The amount field is required."]
  }
}

HTTP Status Codes

Code Status Description
200 OK Request successful
201 Created Resource created successfully
400 Bad Request Invalid request parameters
401 Unauthorized Invalid or missing API key
403 Forbidden Access denied to this resource
404 Not Found Resource not found
429 Too Many Requests Rate limit exceeded
500 Server Error Internal server error

Error Codes Reference

Authentication Errors

INVALID_API_KEY API key is invalid or revoked
MISSING_API_KEY No API key provided in X-API-Key header
SESSION_EXPIRED BaridiMob session has expired, login required
LOGIN_FAILED Invalid password or login failed

Account Errors

ACCOUNT_NOT_FOUND Account with this RIP does not exist
ACCOUNT_INACTIVE Account is deactivated
FETCH_FAILED Failed to fetch data from BaridiMob

Transfer Errors

PRIVATE_KEY_REQUIRED Account needs private key for transfers
TRANSFER_FAILED Transfer failed (insufficient balance, invalid RIP, etc.)
INVALID_OTP OTP code is incorrect or expired

Validation Errors

VALIDATION_FAILED Request validation failed (see errors field)