Error Structure

Learn about the structure of errors returned by the API.

The error structure

PropTypeDefault
errors
Array<object>
-
errors[].code?
string
-
errors[].message
string
-
errors[].path?
Array<string>
-
status
string
-
statusCode
number
-

Examples

Imagine you're trying to get a listing by its ID, but that listing doesn't exist. You will get the following error:

Example
{
  "errors": [
    {
      "message": "No listing with such ID"
    }
  ],
  "status": "Not Found",
  "statusCode": 404
}

In the above example, the errors property is an array of errors. In this case, there is only one error. The status property is the HTTP status, and the statusCode property is the HTTP status code number.

If the error is a validation error, we will return a more detailed error message. For example, if you try to delete an Auction House listing and the ID is not a valid listing ID (UUID), you will get the following error:

Validation Error Example
{
  "errors": [
    {
      "code": "invalid_string",
      "message": "ID must be a valid UUID",
      "path": ["id"]
    }
  ],
  "status": "Not Found",
  "statusCode": 404
}

In the above example, the code property is the error code, the message property is the error message, and the path property is the path to the property that caused the error. In this case, the id property caused the error.

As an example, you will receive the following error if you are not using the new Media model when adding images to the listing:

Validation Error Example
{
  "errors": [
    {
      "code": "invalid_type",
      "message": "Expected array, received string",
      "path": ["media"]
    }
  ],
  "status": "Bad Request",
  "statusCode": 400
}

Error Codes

For an explanation of the different response codes and what they mean, see HTTP Status Codes.