Errors

In this guide, we will talk about what happens when something goes wrong while you work with the API. Mistakes happen, and we're here to help you fix them as fast as possible. Let's look at some status codes and error types you might encounter.

You can tell if your request was successful by checking the status code when receiving an API response. If a response comes back unsuccessful, you can use the error type and error message to figure out what has gone wrong and do some rudimentary debugging. Additionally, all errors come with the documentation_url field, which you can use to find more information about the error.


Status codes

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

  • Name
    2xx
    Description

    A 2xx status code indicates a successful response. We love to see these.

  • Name
    4xx
    Description

    A 4xx status code indicates a client error — this means that the problem likely lies in how you are calling to the api.

  • Name
    5xx
    Description

    A 5xx status code indicates a server error — if you see these, please immediately let us know.


Error types

Whenever a request is unsuccessful, the Sonder 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. We try to make all of our error messages as helpful as possible, so you can get back to building your app as fast as possible.

Here is a list of the two error types supported by the Sonder API — use these to understand what you have done wrong.

  • Name
    api_error
    Description

    This means that the server has made an error. While this is rare, sometimes things do slip through the cracks. Please let us know on the slack if you see this.

  • Name
    invalid_request
    Description

    This means that there is an error in the request fields. This is likely to hapen as you explore your use case, and we're here to help you fix it.

Error response

{
  "type": "api_error",
  "message": "No way this is happening!?",
  "documentation_url": "https://dev.sonderlabs.io/support"
}

Was this page helpful?