# Invite Account user

`POST https://api.parklio.com/v2/account-users`

Invite an account user to Parklio™ system under specific account user role

**Auth:** `Authorization: Bearer <token>`

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `account_user_role_id` | number | yes |  |
| `email` | string | yes |  |
| `name` | string | yes |  |
| `phone` | string | no |  |
| `target_lots` | string[] | no | An optional array of lot IDs to assign to the invited user. Each ID must correspond to a lot that belongs to the same account as the inviter. If any ID does not belong to the account, the request will be rejected. |

```json
{
  "account_user_role_id": 1,
  "email": "john.doe@example.com",
  "name": "John Doe",
  "phone": "12345678",
  "target_lots": "[1]"
}
```

## Responses

### 200 — Account user successfully invited.

```json
{
  "success": true,
  "message": "Account user successfully invited."
}
```

### 401 — Account user is not logged in and they should log in again.

```json
{
  "success": false,
  "errors": [
    {
      "code": 1,
      "message": "Unauthorized access."
    }
  ]
}
```

### 403 — User does not have permission to access requested resource.

```json
{
  "success": false,
  "errors": [
    {
      "code": 4,
      "message": "No permission."
    }
  ]
}
```

### 404 — Resource that has been requested does not exist. User should not try to repeat this request.

```json
{
  "success": false,
  "errors": [
    {
      "code": 6,
      "message": "Resource not found."
    }
  ]
}
```

### 422 — Some of the provided request parameters are missing or are invalid. User should add/change them according to response message.

```json
{
  "success": false,
  "errors": [
    {
      "code": 23,
      "message": "Validation error",
      "field": "field"
    }
  ]
}
```

