Error Messages
Stax Bill uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the 2xx
range indicate success, codes in the 4xx
range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a charge failed, etc.), and codes in the 5xx
range indicate an error with Stax Bill's servers (these are rare). Basic codes below.
Error Code | Detail |
---|---|
200 - OK | Everything worked as expected |
400 - Bad Request | The request could not be understood by the server due to malformed syntax. The client should not repeat the request without making appropriate changes |
401 - Unauthorized | Missing or invalid authorization. Check your API Key and which environment the call is being made against. |
404 - Not Found | The requested resource could not be found. Verify the endpoint in use, or the resource ID provided. |
409 - Conflict | The format is valid but the request fails business rules. For example - activating a subscription that is already active |
429 - Too Many Requests | API Rate limit has been exceeded. |
500 - Server Error | System error with Stax Bill API |
Note
Not all errors map cleanly onto HTTP response codes, however, when a request is valid but does not complete successfully (e.g., a creating a customer), we return a
4xx
error code.
{
"ErrorId":0,
"HttpStatusCode":400,
"Errors":[
{
"Key":"Api Error",
"Value":"Authorization key is not in the correct format."
}
]
}
Handling Errors
Our API libraries raise exceptions for many reasons, such as a failed charge, invalid parameters, authentication errors, and network unavailability. We recommend writing code that gracefully handles all possible API exceptions