Errors

In this guide, we will talk about what happens when something goes wrong while you work with the DevRIFT API. Mistakes happen, and most of the time they will be yours, not ours. 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 (before contacting support).


Status codes

Here is a list of the different categories of status codes returned by the DevRIFT API. DevRIFT uses conventional HTTP response codes to indicate the success or failure of an API request. Use these to understand if a request was successful.

  • Name
    2xx
    Type
    Description

    Codes in the 2xx range generally indicate success.

  • Name
    4xx
    Type
    Description

    Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted or failure to send a magic link)

  • Name
    5xx
    Type
    Description

    Codes in the 5xx range indicate an error with DevRIFT's servers (these are rare).


Error types

Whenever a request is unsuccessful, the DevRIFT 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.

There are several types of errors supported by the DevRIFT API use these to understand what you have done wrong. Some are listed below.

  • Name
    api_error
    Type
    Description

    This means that something has gone wrong on our side. This error message is usually accompanied by a status code in the 5xx range.

  • Name
    invalid_request
    Type
    Description

    This means that your request wasn't valid, perhaps a parameter was omitted or invalid?

Error response

{
  "type": "api_error",
  "message": "No way this is happening!?",
  "documentation_url": "https://docs.devrift.co/errors"
}