Errors

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

  • Name
    2xx
    Type
    Description

    A 2xx status code indicates a successful response.

  • Name
    4xx
    Type
    Description

    A 4xx status code indicates a client error — a problem with the request you sent. Inspect the error message in the response body for more info.

  • Name
    5xx
    Type
    Description

    A 5xx status code indicates an internal server error. These are rare, and indicate that you should contact support.


Error codes

Whenever a request is unsuccessful, the Apize API will return an error response. You can use this information to understand better what has gone wrong and how to fix it.

Below are some common values for the error.code value. Also note that some APIs may return other error codes specific to their case.

  • Name
    unknown_error
    Type
    Description

    This means that something went wrong, and it doesn't fit into a known error category.

  • Name
    api_not_found
    Type
    Description

    This means that the URL of your request doesn't match an available API.

  • Name
    missing_token
    Type
    Description

    This means that no API token was provided in the request.

  • Name
    invalid_token
    Type
    Description

    This means that the provided API token is invalid.

  • Name
    missing_scopes
    Type
    Description

    This means that the provided API token lacks one or more scopes (permissions) required by the API being called.

  • Name
    rate_limited
    Type
    Description

    This means that your account has exceeded its rate limit.

  • Name
    invalid_request
    Type
    Description

    This means that the request body could not be parsed, or did not match the expected format.

Error response

{
  "error": {
    "code": "error_code",
    "message": "Description of the error in English"
    "docs_url": "https://docs.apize.dev/errors"
  }
}