# Errors

## HTTP Status Codes

**Referd** uses [HTTP response status codes](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) to indicate the success or failure of your API requests. If your request fails, **Referd** returns an error using the appropriate status code.

* `2XX` codes indicate success and that the request worked as intended
* `4XX` codes indicate errors due to some mistakes in the request.
* `5XX` codes indicate an error with **Referd's** servers.

## Error Object

When an error occurs and the response code is `4XX`, **Referd's** servers send an **Error Object** that has two parameters, `code`and `message`.

### Example

```javascript
{
    "code": 14,
    "message": "Name Already Exists"
}
```

## Error Codes

**Referd** sends an error code in the body of the response, each code has a corresponding error message that is descriptive of what went wrong, below are the codes along with their description.

| Code | Message                    | Description                                                     |
| ---- | -------------------------- | --------------------------------------------------------------- |
| 4    | Missing Arguments          | Missing parameter in the argument                               |
| 5    | Null Arguments             | The format is invalid or not compatible                         |
| 7    | Invalid Value              | Value is in the wrong format.                                   |
| 12   | Name Length Invalid        | The provided name does not meet the required character limit    |
| 13   | Something Wrong            | An unexpected error occurred while processing your request.     |
| 14   | Name Already Exists        | The name provided is already registered in our system           |
| 15   | Email Already Exists       | The email address provided is already registered in our system. |
| 16   | Inactive                   | Inactive element like a user or program that are inactive       |
| 50   | Referd Is Disabled         | **Referd** is disabled                                          |
| 101  | User External ID Not Found | User does not exist                                             |
| 102  | User Already Exists        | The user you are trying to create already exists                |
| 351  | Event Not Found            | This event is not configured in the dashboard                   |
