Errors

In this guide, we will talk about what happens when something goes wrong while you work with the PureGPU API. Mistakes happen, and mostly 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 PureGPU API. Use these to understand if a request was successful.

  • Name
    2xx
    Type
    Description

    A 2xx status code indicates a successful response. However, if there is a user error, the status will still be 200 but the response will contain an error result.

  • Name
    401
    Type
    Description

    A 401 status code indicates an unauthorized request — this means you need to check your authentication.

  • Name
    500
    Type
    Description

    A 500 status code indicates an internal server error — this means something went wrong on our end.

Error response structure

For user errors, even with a 200 status code, the response will indicate an error. Here is an example of what an error response might look like:

{
  "result": "error",
  "message": "Amount is required"
}

Use the result and message fields to understand what went wrong and how to correct it.