# API Errors

[Web version](https://docs.eis.it/en/api/errori)

When a body is present, the APIs normally return this format:

```json
{
  "status": "BAD_REQUEST",
  "message": "Descrizione dell'errore",
  "errors": "Dettagli dell'errore"
}
```

- `status` is the name of the HTTP status, for example `BAD_REQUEST` o `NOT_FOUND`.
- `message` contains a readable description of the error.
- `errors` contains details and can be a string, a list of validation errors or a structured object.

See the single reference operation for specific statuses and examples. Some content-free answers do not include a body.

## Status of error

| Status | General meaning | Indication |
| --- | --- | --- |
| `400` | Request or invalid parameters | Correct the sent data before retrying. |
| `401` | API credentials not valid | Verification `clientId` and `clientSecret`. |
| `403` | Non-allowed operation | Check user permissions. |
| `404` | Resource not found | Check identifiers and parameters. |
| `409` | Conflict with current state | Upgrade your data or resource status before retrying. |
| `500` | Internal error | Keep the technical context and contact assistance if it persists. |
| `502` | Error of an external service | Try again later or contact assistance. |
| `503` | Temporarily unavailable service | Wait and try again. |

## Example: already active number

`POST /v1/numbers/activate` Returns `400 Bad Request` when the number is already active or has been deleted:

```json
{
  "status": "BAD_REQUEST",
  "message": "Number already active or deleted",
  "errors": "Number already active or deleted"
}
```

## Diagnostics

When signaling a problem, include timestamps, environment, HTTP method, path and status received. Anonymizes the payload and not share API key, access tokens or personal data.

> Perform automatic retry only when you know the imperceptibility of the operation and you can exclude that a writing has already been applied.
