API Response Codes

There are two set of response codes that one will see when one makes an API call. One is the HTTP Response code and the other is an error response code returned as part of the response message detailing the exact error that occurred. We discuss both of them below.

 HTTP Response Codes

200 Ok
201 Ok - Created
400 Bad Request
403 Forbidden
404 Wrong endpoint
414 Request URI too long
500 Internal Server Error
502 Bad Gateway
503 Service Unavailable/ API maintenance
504 Gateway Timeout

 

 

 

 

 

 

 

 

Structure of a typical error response

<?xml version="1.0" encoding="UTF-8"?>
<errors>
<error>
<code>{Http Code}</code>
<message>{Descriptive Error String}</message>
</error>
</errors>

In some cases, we return special error codes (error code value differ s from HTTP response value) which are discussed next.

Special Error Response Codes

We have a message for each error (which is not parseable) and a separate code which is parseable to differentiate between same http response codes.

Error HTTP Response Code JSON response XML Response
Invalid Request 400
{"errors":[{"message":"Invalid request","code":4001}]}
<?xml version="1.0" encoding="UTF-8"?>
<errors><error><code>4001</code><message>Invalid request</message></error>
</errors>
Invalid item Id 400
{"errors":[{"message":"Invalid itemId","code":4002}]}
<?xml version="1.0" encoding="UTF-8"?>
<errors><error><code>4002</code><message>Invalid itemId</message></error>
</errors>
Invalid category id 400
{"errors":[{"message":"Invalid category Id","code":4003}]}
<?xml version="1.0" encoding="UTF-8"?>
<errors><error><code>4003</code><message>Invalid category id</message></error>
</errors>
Invalid start param 400
{"errors":[{"message":"Invalid start parameter","code":4005}]}
<?xml version="1.0" encoding="UTF-8"?>
<errors><error><code>4005</code><message>Invalid start parameter</message></error>
</errors>
Invalid response format 400
{"errors":[{"message":"Invalid response format","code":4007}]}
<?xml version="1.0" encoding="UTF-8"?>
<errors><error><code>4007</code><message>Invalid response format</message></error>
</errors>
Missing item id 400
{"errors":[{"message":"Missing item id","code":4008}]}
<?xml version="1.0" encoding="UTF-8"?>
<errors><error><code>4008</code><message>Missing item id</message></error>
</errors>
Missing search query 400
{"errors":[{"message":"Missing search query","code":4009}]}
<?xml version="1.0" encoding="UTF-8"?>
<errors><error><code>4009</code><message>Missing search query</message></error>
</errors>
Start index out of bounds 400
{"errors":[{"message":"Start should be less than 100","code":4010}]}
<?xml version="1.0" encoding="UTF-8"?>
<errors><error><code>4010</code><message>Start should be less than 100</message></error>
</errors>
Internal Server Error 500
{"errors":[{"message":"Internal Server Error","code":5000}]}
<?xml version="1.0" encoding="UTF-8"?>
<errors><error><code>5000</code><message>Internal Server Error</message></error>
</errors>