Errors

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 indicates success, codes in the 4xx range indicates 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 indicates an error with Stax Bill's servers (these are rare). Basic codes below.

Error CodeDetail
200 - OKEverything worked as expected
400 - Bad RequestThe server could not understand the request 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 FoundThe requested resource could not be found. Verify the endpoint in use or the resource ID provided.
409 - ConflictThe format is valid, but the request fails business rules. For example, activating a subscription that is already active
429 - Too Many RequestsAPI Rate limit has been exceeded.
500 - Server ErrorSystem 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.

Example Error Response
{
   "ErrorId":0,
   "HttpStatusCode":400,
   "Errors":[
      {
         "Key":"Api Error",
         "Value":"Authorization key is not in the correct format."
      }
   ]
}

Handling Errors

Our API libraries throw exceptions for various reasons, such as failed charges, invalid parameters, authentication errors, and network unavailability. We recommend writing code that gracefully handles all possible API exceptions.