Errors

In this guide, we will talk about what happens when something goes wrong while you work with the API.


Status codes

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

  • Name
    2xx
    Description

    A 2xx status code indicates a successful response.

  • Name
    4xx
    Description

    A 4xx status code indicates a client error. This means it's a you problem.

  • Name
    5xx
    Description

    A 5xx status code indicates a server error. This means it's a us problem.


Error types

Whenever a request is unsuccessful, the Swayware API will return an error response with an error type 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 the two error types supported by the Swayware API — use these to understand what you have done wrong.

  • Name
    api_error
    Description

    This means that we made an error, which is highly speculative and unlikely.

  • Name
    invalid_request
    Description

    This means that you made an error, which is much more likely.

Error response

{
  "type": "api_error",
  "message": "No way this is happening!?"
}

Was this page helpful?