# Error codes

## Common response body

Most API endpoints return a common response body when an errors occurs. These responses can contain useful hints while developing or debugging, but is not designed to be directly shown to the user.

```json
{
  "reason": "invalid space",
  "status": "bad request",
  "traceID": "123wedt",
  "validations": {
    "user.email": "required"
  }
}
```

<table><thead><tr><th width="163.33333333333331">Field</th><th width="122">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>reason</code></td><td><code>string</code></td><td>A summary of what when wrong.</td></tr><tr><td><code>status</code></td><td><code>string</code></td><td>Text version of the response code.</td></tr><tr><td><code>traceID</code></td><td><code>string</code></td><td>An id that may be supplied to support for internal debugging.</td></tr><tr><td><code>validations</code></td><td><code>object</code></td><td>Hints of fields that failed validating.</td></tr></tbody></table>

## 400 - Bad Request <a href="#id-400" id="id-400"></a>

This is most likely due to an invalid argument as a part of a path, query parameter, or request body. Please see the error message for more information.

## 401 - Unauthorized <a href="#id-401" id="id-401"></a>

The user or the Service Account can not be authenticated towards our API.

### Access Tokens

If you are using an Access Token received from our OAuth2 endpoint, please note that these are only valid for *one hour*. For uninterrupted operations using Access Tokens, make sure to get a new one before the previous one expires.

See our [Authentication guide](https://developers.neowit.io/rest-api/authentication) for more details.

## 403 - Forbidden <a href="#id-403" id="id-403"></a>

The user or service account does not have access to this resource.

## 404 - Not found <a href="#id-404" id="id-404"></a>

The requested resource could not be found. Make sure the URL is correct. Note that the resource may have been removed after it was discovered.

## 409 - Conflict <a href="#id-409" id="id-409"></a>

The resource you're trying to create already exists. This can happen for certain resources which have unique constraints (for example named tags).

## 500 - Internal server error <a href="#id-500" id="id-500"></a>

An internal error occurred in our services.

These may be intermittent, and in general we recommend re-trying with an exponential backoff with a minimum of 1-second delay. If your integration sends many requests our way, we also recommend adding jitter to this retry mechanism to stop thundering herds.

If these errors persist over a longer period, check our [Status page](https://neowit.statuspage.io/). If nothing is showing up there, get in touch with [Support](https://support.neowit.io/). Please include the `traceID` from the response body if this is present, as it can help support and our engineering team figure out what when wrong quicker.

## 503 - Service Unavailable <a href="#id-503" id="id-503"></a>

See [500 - Internal server error](#500)

## 504 - Gateway timeout <a href="#id-504" id="id-504"></a>

See [500 - Internal server error](#500)
