This document provides a comprehensive guide to the error handling system used in the HIFI API. Understanding these error codes will help you effectively handle exceptions and communicate issues to your users.
All error responses follow a consistent JSON structure:
{
"code": 100001,
"error": "FIELD_VALIDATION_ERROR",
"errorDetails": "Fields provided are either missing or invalid"
}
Error Code Reference
Generic Errors (10xxxx)
Code
Error
Description
100001
FIELD_VALIDATION_ERROR
Fields provided are either missing or invalid
100002
METHOD_NOT_ALLOWED
Method not allowed
100003
INVALID_VERSION
Invalid version
100004
DEPRECATED_RESOURCE
This resource has been deprecated
100005
RESOURCE_CONFLICT
Resource conflict, please try different request id
Authentication Errors (20xxxx)
Code
Error
Description
200301
BILLING_CONFIG_NOT_FOUND
Billing configuration not found
200001
INVALID_API_KEY
Invalid API key
200201
PRODUCTION_NOT_ENABLED
Production is not enabled for this profile
200202
USER_ROLE_NOT_ALLOWED
User role not allowed to perform this action
200203
UNAUTHORIZED
Unauthorized
200301
KEY_DOES_NOT_EXIST
Key does not exist
200204
PROFILE_FROZEN
Profile is not authorized to access this resource
User Management Errors (30xxxx)
Code
Error
Description
300301
USER_NOT_FOUND
User not found
300201
USER_ACTION_NOT_ALLOWED
User is not allowed to perform this action
300201
USER_COMPLIANCE_VERIFICATION_FAILED
User compliance information is not approved
300202
USER_COMPLIANCE_DATA_INVALID
User compliance data is invalid
300001
USER_ALREADY_EXISTS
User already exists
300202
USER_FROZEN
User is not authorized to access this resource
Transaction Errors (40xxxx)
Code
Error
Description
400401
INSUFFICIENT_BALANCE
Insufficient balance for transaction
400402
INSUFFICIENT_CREDIT_BALANCE
Insufficient credit balance for transaction fee
400001
INVALID_TRANSACTION_ROUTE
Invalid transaction route (combination of currency, crypto, and rail)
400403
TRANSACTION_INITIATION_FAILED
Transaction initiation failed
400002
INVALID_ACCOUNT_FOR_TRANSACTION
Invalid bank account for the transaction
400003
TRANSACTION_REQUEST_ALREADY_EXISTS
Transaction request already exists
400301
TRANSACTION_NOT_FOUND
Transaction not found
400302
QUOTE_NOT_FOUND
Quote not found
400005
QUOTE_NOT_READY
Quote is not ready yet
400006
INVALID_QUOTE
Expired or invalid quote
Account Management Errors (50xxxx)
Code
Error
Description
500301
ACCOUNT_NOT_FOUND
Bank account ID not found
500501
INACTIVE_ACCOUNT
Bank account is not active
500001
INVALID_ACCOUNT_DATA
Invalid bank account data provided
Wallet Management Errors (60xxxx)
Code
Error
Description
600301
WALLET_NOT_FOUND
Wallet not found for the user
600001
INVALID_WALLET_CONFIG
Invalid wallet configuration provided
600001
WALLET_ALREADY_EXISTS
Wallet already exists for this configuration
600501
INACTIVE_WALLET
Wallet is not active
System/Infrastructure Errors (70xxxx)
Code
Error
Description
700401
INTERNAL_SERVER_ERROR
Internal server error
Usage Example
JavaScript
try {
// API call
} catch (error) {
if (error.code === 300301) {
// Handle USER_NOT_FOUND error
console.log('User was not found in the system');
} else if (error.code === 400401) {
// Handle INSUFFICIENT_BALANCE error
console.log('Transaction failed due to insufficient balance');
}
}
HTTP Response Example
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"code": 400001,
"error": "INVALID_TRANSACTION_ROUTE",
"errorDetails": "Invalid transaction route with the provided transaction details"
}