Errors

In this guide, we will talk about what happens when something goes wrong while you work with the API. Mistakes happen, and mostly they will be yours, not ours. Let's look at some status codes and error codes you might encounter.

You can tell if your request was successful by checking the status code when receiving an API response. We stand to the standard HTTP status codes, so you can use the same logic you would use with any other API. If a response comes back unsuccessful, it will always be >=400 and <=500, you can use the error code and error message to figure out what has gone wrong and do some rudimentary debugging before contacting our support.


Status codes

Here is a list of the different categories of status codes returned by the Chatness API. Use these to understand if a request was successful.

  • Name
    200
    Type
    Description

    A 200 status code indicates a successful response, which means that the requested resource was either retrieved or updated successfully.

  • Name
    201
    Type
    Description

    A 201 status code indicates a successful response, which means that the requested resource was created successfully.

  • Name
    204
    Type
    Description

    A 204 status code indicates a successful response, which means that the requested resource was deleted successfully.


Error codes

Whenever a request is unsuccessful, the Chatness API will return an error object with a code and message. You can use this information to understand better what has gone wrong and how to fix it. Most of the error messages are pretty helpful and actionable.

Here is a list of errors — use these to understand what you have done wrong.

  • Name
    400
    Type
    Description

    A field is invalid.

  • Name
    401
    Type
    Description

    The access is unauthorized.

  • Name
    404
    Type
    Description

    A resource was not found.

  • Name
    428
    Type
    Description

    A field is required.

  • Name
    429
    Type
    Description

    You have exceeded the rate limit.

  • Name
    500
    Type
    Description

    An internal server error occurred.

Error response

{
  "error": {
    "code": 400,
    "message": "The phone is invalid."
  }
}