Theme

Technical guides

Error codes

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

CodeMeaning
SYS0001Invalid Token

Account Errors

CodeMeaning
ACC0001Request must contain at least one label
ACC0002No content found
ACC0003Invalid items in label update: {0}
ACC0004No invoice found
ACC0005Invoice number is mandatory

Order Errors

CodeMeaning
ORD0001dateFrom must be prior or equal to dateTo
ORD0002Sales orders creation disabled
ORD0003Doorstep Delivery access not granted
ORD0004Error during cart creation
ORD0005Delivery address is not valid
ORD0006ReturnAddressID is not valid
ORD0007Document language must be en or fr
ORD0008Product identifier cannot be resolved
ORD0009Product defined multiple times
ORD0010Not enough inventory available
ORD0011No content found
ORD0012Product not allowed for doorstep delivery
ORD0013Request must contain items
ORD0014Doorstep delivery payment preferences not set
ORD0015Call customer service to order product
ORD0016Items with missing quantities: {0}
ORD0017Order number is mandatory for tracking
ORD0018No tracking number found or not available yet
ORD0019Authorized dealers only for product {0}
ORD0020PO box addresses are not supported

Payment Errors

CodeMeaning
PMT0001Transaction declined – try a different card
PMT0002Billing address verification failed
PMT0003Transaction declined – try a different card
PMT0004Invalid expiration date
PMT0005Withdrawal limit reached
PMT0006Insufficient funds
PMT0007Invalid security code
PMT0008Invalid account number
PMT0009Error – contact customer service
PMT0010Transaction declined – contact card provider
PMT0011Request declined – try again

Catalog Errors

CodeMeaning
CAT0001Invalid product status
CAT0002No 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.'
  )
}

// Usage in error handling
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)
  // Display error.message to user
}
Previous
Testing