Error Handling

Error Handling Examples

This guide provides specific examples of how the Advanced Dialer API returns error details within the standard response envelope. Each error includes a statusCode and a message to help you identify the root cause programmatically.


Authentication Error (Code 3)

This error occurs when the Ocp-Apim-Subscription-Key is missing from the headers or is not valid for the requested environment.

{
  "statusCode": 3,
  "message": "API key is invalid or missing",
  "payload": null
}

Validation Error (Code 5)

A validation error is triggered when the request body is syntactically correct but fails business logic or schema requirements (e.g., a missing required field).

{
  "statusCode": 5,
  "message": "Required field 'Company Name' is missing",
  "payload": {
    "field": "Company Name",
    "code": "REQUIRED_FIELD_MISSING"
  }
}

Not Found Error (Code 6)

This error indicates that the specific resource (Customer, Agent, or Campaign) does not exist within the provided prefix or account.

{
  "statusCode": 6,
  "message": "Customer with ID 'CUST_999' not found",
  "payload": {
    "prefix": "SALES",
    "customerId": "CUST_999"
  }
}

💡

Integration Tip

When your application receives a Code 5, use the payload object to highlight the specific field that requires user attention in your UI.