# Errors

Eshopbox uses standard HTTP status codes to indicate the success or failure of an API request.&#x20;

Code in the range of&#x20;

`2xx` indicates success,

`4xx` indicates there was a problem with the request provided (e.g., a required field was missing)

`5xx` indicates an error occurred with Eshopbox API.

## Example Errors

Here are some example error responses from the Eshopbox API.

### Forbidden

You'll receive a `401: Unauthorized` response when you provide an invalid access token

```
{
    "error": {
        "errors": [
            {
                "domain": "global",
                "reason": "conditionNotMet",
                "message": "401:Authentication failed: com.google.api.auth.UnauthenticatedException: No auth token is contained in the HTTP request"
            }
        ],
        "code": 412,
        "message": "401:Authentication failed: com.google.api.auth.UnauthenticatedException: No auth token is contained in the HTTP request"
    }
}
```

### Bad Request

You'll get a `400: Bad Request` when you fail validation.

```javascript
{
    "error": {
        "errors": [
            {
                "domain": "global",
                "reason": "badRequest",
                "message": "null value for parameter 'type' not allowed"
            }
        ],
        "code": 400,
        "message": "null value for parameter 'type' not allowed"
    }
}
```

### Not Found

When a resource is not found you will get a `404: Not Found` response

```javascript
Not Found
```

### Internal Server Error

You'll receive a `503: Internal Server Error` response when something goes wrong on our side. We're automatically notified of these errors, and work to resolve them as quickly as possible.

```javascript
{
    "error": {
        "errors": [
            {
                "domain": "global",
                "reason": "backendError",
                "message": "backend error"
            }
        ],
        "code": 503,
        "message": "backend error"
    }
}
```

**Unauthorized Error**

You'll receive a `401Unauthorized Error` response code when access Token has been expired. To resolve this error you have to regenerate the access token.

```javascript
{
    "message": "Expired token"
}
```

**Unprocessable Entity**

You'll receive a `422 unprocessbale` entity error response code, when something missing or any validation fails in the request. To resolve this error please re-check the request and do the changes as per the error message.&#x20;

```javascript
{
  "customerOrderNumber": [
    "The customerOrderNumber has already been taken."
  ],
  "items.0.itemID": [
    "The items.0.itemID field is required."
  ],
  "items.1.itemID": [
    "The items.1.itemID field is required."
  ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://eshop.gitbook.io/eshopbox-developers/basics/errors.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
