Working with Error Strings

The Phone.com API offers a robust error code system, with links to detailed exception explanations included in our JSON response objects.

Our error code ranges are divided into logical layers, which represent their respective areas of concern in the Phone.com API—either REST related and general (1xxxx, 3xxxx), or those belonging to a specific API service (301xx - 306xx).

Error Code Ranges in the Phone.com API

  • 1xxxx REST Layer
  • 3xxxx General Service
  • 301xx Menus
  • 302xx Queues
  • 303xx Routes (Call Handling Rules)
  • 304xx Media
  • 305xx Voice
  • 306xx SMS
  • 4xxxx Schema

Example General Error Response

Issuing an HTTP request against any service without basic authorization enabled will result in the following error response from our API:



{
  "response" : {
     "error" : {
        "info" : "No authentication specified. Please use Basic authentication.",
        "url" : "https://docs.phone.com/refguides/errorref/generalerrors.html#error-code-10001",
        "code" : 10001
     }
  }
}

Example Detailed Service Error Response

Issuing an HTTP GET against, say, the /sms service with unknown query parameters like in this URI: https://v1.api.phone.com/sms?bad_param=1



{
  "response" : {
     "error" : {
        "info" : "Unknown arguments provided to SMS service.",
        "url" : "https://docs.phone.com/refguides/errorref/serviceerrors.html#error-code-30006",
        "code" : 30006
     }
  }
}

All responses generated by the Phone.com API are valid JSON, and error responses always take the basic form shown above. There is a response key that contains a single error element. This element will always have the three following fields: info, url and code.

Error Deconstruction

To summarize, a response will refer to a specific error (using the info, url and code fields). The extended-error code URL will take you to a detailed, clear explanation of the error, and provide a solution where possible.

Also, you can always find information on a particular error by constructing a URL that matches the following format:

https://docs.phone.com/refguides/errorref/serviceerrors.html#error-code-<code>

Learn More: