The HLC API returns structured error codes with descriptive messages to facilitate debugging and error handling. Use these codes to implement user-friendly error messages and automated retry logic.
Error Code Categories
Error codes are prefixed by category:
- SYS: System and authentication errors
- ACC: Account and user management errors
- ORD: Order processing and fulfillment errors
- PMT: Payment and transaction errors
- CAT: Catalog and product errors
Error Code Reference
System Errors
| Code | Meaning |
|---|
| SYS0001 | Invalid Token |
Account Errors
| Code | Meaning |
|---|
| ACC0001 | Request must contain at least one label |
| ACC0002 | No content found |
| ACC0003 | Invalid items in label update: {0} |
| ACC0004 | No invoice found |
| ACC0005 | Invoice number is mandatory |
Order Errors
| Code | Meaning |
|---|
| ORD0001 | dateFrom must be prior or equal to dateTo |
| ORD0002 | Sales orders creation disabled |
| ORD0003 | Doorstep Delivery access not granted |
| ORD0004 | Error during cart creation |
| ORD0005 | Delivery address is not valid |
| ORD0006 | ReturnAddressID is not valid |
| ORD0007 | Document language must be en or fr |
| ORD0008 | Product identifier cannot be resolved |
| ORD0009 | Product defined multiple times |
| ORD0010 | Not enough inventory available |
| ORD0011 | No content found |
| ORD0012 | Product not allowed for doorstep delivery |
| ORD0013 | Request must contain items |
| ORD0014 | Doorstep delivery payment preferences not set |
| ORD0015 | Call customer service to order product |
| ORD0016 | Items with missing quantities: {0} |
| ORD0017 | Order number is mandatory for tracking |
| ORD0018 | No tracking number found or not available yet |
| ORD0019 | Authorized dealers only for product {0} |
| ORD0020 | PO box addresses are not supported |
Payment Errors
| Code | Meaning |
|---|
| PMT0001 | Transaction declined – try a different card |
| PMT0002 | Billing address verification failed |
| PMT0003 | Transaction declined – try a different card |
| PMT0004 | Invalid expiration date |
| PMT0005 | Withdrawal limit reached |
| PMT0006 | Insufficient funds |
| PMT0007 | Invalid security code |
| PMT0008 | Invalid account number |
| PMT0009 | Error – contact customer service |
| PMT0010 | Transaction declined – contact card provider |
| PMT0011 | Request declined – try again |
Catalog Errors
| Code | Meaning |
|---|
| CAT0001 | Invalid product status |
| CAT0002 | No content found |
Implementation Example
Client-Side Error Mapping
const errorMessages = {
SYS0001:
'Your API key is invalid or has expired. Please check your credentials.',
ORD0010:
'Insufficient inventory available. Please reduce quantity or try again later.',
PMT0001: 'Payment declined. Please try a different payment method.',
PMT0006: 'Insufficient funds. Please use a different payment method.',
ORD0003: 'Doorstep delivery is not available for your account.',
}
function getUserMessage(errorCode) {
return (
errorMessages[errorCode] ??
'An unexpected error occurred. Please try again or contact support.'
)
}
try {
const response = await fetch(`${apiUrl}/Orders/Create/Fulfillment`, {
method: 'POST',
headers: {
ApiKey: apiKey,
'Content-Type': 'application/json',
},
body: JSON.stringify(orderData),
})
if (!response.ok) {
const error = await response.json()
throw new Error(getUserMessage(error.code))
}
const order = await response.json()
} catch (error) {
console.error('Order creation failed:', error.message)
}