# Employees, Payroll And Teams

The Veend Expense Product is designed for Companies to manage employees, teams and payroll on VeendHQ.

{% hint style="info" %}
**ORG\_BASE\_URL**

The BASE\_URL for all Team and Employee request on **Test Environment** is [**https://stipendstagingapi.veendhq.com**](https://stipendstagingapi.veendhq.com)  and on **Live Environment** - [**https://api.stipend.co**](https://api.stipend.co)
{% endhint %}

## Employees

Create and employees on Veend Platform with the Employees API.

### Add Employee

To add an employee to your Veend Business Account, the employee must have a user account registered as an **employee** type.

## Registers a new user as an Employee

<mark style="color:green;">`POST`</mark> `{{BASE_URL}}/register`

#### Request Body

| Name                                   | Type     | Description                       |
| -------------------------------------- | -------- | --------------------------------- |
| type<mark style="color:red;">\*</mark> | employee | Sets the account type to employee |

If you already have the employee user account, you can add the employee to your business.&#x20;

<mark style="color:green;">`POST`</mark> `{{ORG_BASE_URL}}/register`

#### Request Body

| Name                                       | Type     | Description                                                    |
| ------------------------------------------ | -------- | -------------------------------------------------------------- |
| \_id<mark style="color:red;">\*</mark>     | String   | Employee Id return in the response data above                  |
| employer<mark style="color:red;">\*</mark> | String   | Veend Business User Id                                         |
| role<mark style="color:red;">\*</mark>     | employee | one of these values **approver, disburser, employee or admin** |
| roles                                      | employee | must be same value as the **role** field                       |
| type<mark style="color:red;">\*</mark>     | employee | Sets the account type to employee                              |

### Get All Employees

## Get all employees

<mark style="color:blue;">`GET`</mark> `{{ORG_BASE_URL}}/myEmployees/users?populate=addressBooks`

#### Query Parameters

| Name     | Type         | Description |
| -------- | ------------ | ----------- |
| populate | addressBooks |             |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "status": "success",
    "data": [
        {
            "payrollSettings": {
                "basic": 60,
                "housing": 24.6,
                "transport": 9,
                "leave": 3,
                "meal": 1.2,
                "utility": 2.2
            },
            "employeeDetails": {
                "banking": {
                    "bankName": "wema",
                    "bankCode": "",
                    "nuban": "2012099330"
                },
                "contractType": "fulltime",
                "staffNo": "0124",
                "grossSalary": 1000000
            },
            "twoFactor": false,
            "accounts": [
                "63c12da4c60bbf0013ff396a"
            ],
            "addressBooks": [
                {
                    "validated": false,
                    "tags": [
                        "phonenumber",
                        "0988999008",
                        "63c12da4c60bbf0013ff3960"
                    ],
                    "_id": "63c12da4c60bbf0013ff3962",
                    "type": "phonenumber",
                    "value": "0988999008",
                    "user": "63c12da4c60bbf0013ff3960",
                    "validationCode": 882286,
                    "createdAt": "2023-01-13T10:08:36.305Z",
                    "model": "Addressbooks",
                    "__v": 0,
                    "updatedAt": "2023-01-13T10:08:36.317Z"
                },
                {
                    "validated": false,
                    "tags": [
                        "email",
                        "adewaleonamader7898949@gmail.com",
                        "63c12da4c60bbf0013ff3960"
                    ],
                    "_id": "63c12da4c60bbf0013ff3966",
                    "type": "email",
                    "value": "adewaleonamader7898949@gmail.com",
                    "user": "63c12da4c60bbf0013ff3960",
                    "validationCode": 689774,
                    "createdAt": "2023-01-13T10:08:36.312Z",
                    "model": "Addressbooks",
                    "__v": 0,
                    "updatedAt": "2023-01-13T10:08:36.328Z"
                }
            ],
            "authentications": [
                "63c12da4c60bbf0013ff3a4b"
            ],
            "kycVerificationStatus": "not_verified",
            "isBlocked": false,
            "roles": [
                "63c12da4c60bbf0013ff396f",
                "623b45b9463b7a0013d29738"
            ],
            "cards": [],
            "emailVerify": true,
            "completeProfile": true,
            "type": "employee",
            "approver": [],
            "disburser": [],
            "expenses": [],
            "bulkExpenses": [],
            "tags": [],
            "_id": "63c12da4c60bbf0013ff3960",
            "firstName": "jordan",
            "lastName": "Elumelu",
            "referralCode": "DWuoJZxY0a",
            "validationCode": "709896",
            "createdAt": "2023-01-13T10:08:36.299Z",
            "model": "Users",
            "__v": 3,
            "clientId": "426",
            "updatedAt": "2023-01-13T10:10:04.904Z",
            "createdBy": "62bffdf5270d0600135de473",
            "owner": "62bffdf5270d0600135de473",
            "stipendBearerToken": "++oT2WV+hgn4Xr0FReIy/WdZV1Fg8utxKjTPeYVZGM0=",
            "auth": "63c12dfcecd88200134a4fb6",
            "employer": "63bfcc902f650e001389f3ec",
            "role": "63a59d92bf77970014e32d51"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

### Get Employee

## Get an employee detail

<mark style="color:blue;">`GET`</mark> `{{ORG_BASE_URL}}/users/{{USER_ID}}?populate=addressBooks`

#### Query Parameters

| Name     | Type         | Description |
| -------- | ------------ | ----------- |
| populate | addressBooks |             |

### Update Employee Detail

## Update an Employee Detail

<mark style="color:purple;">`PATCH`</mark> `{{ORG_BASE_URL}}/updateProfile/users/{{employeeId}}`

#### Request Body

| Name            | Type   | Description |
| --------------- | ------ | ----------- |
| firstName       | String |             |
| lastName        | String |             |
| phoneNumber     | String |             |
| employeeDetails |        |             |
| dateOfBirth     | String |             |
| address         | String |             |
| addressState    | String |             |
| picture         | String |             |
| email           | String |             |

{% hint style="info" %}
**Employee Details on Payload**

```json
{
   "banking":{
    "bankName":"ACCESS BANK NIGERIA",
    "bankCode":"044",
    "nuban":"0690000010"
   },
   "staffNo": "003",
   "grossSalary": 1500000,
   "contractType": "fulltime",
   "netSalary": 200000
}
```

{% endhint %}

## Payroll

Create and manage payrolls to schedule and disburse salary

### Create Payroll

## Create Payroll

<mark style="color:green;">`POST`</mark> `{{ORG_BASE_URL}}/payrolls`

### Get Payrolls

<mark style="color:blue;">`GET`</mark> `{{ORG_BASE_URL}}/payrolls`

### Disburse Payroll

<mark style="color:purple;">`PATCH`</mark> `{{BASE_URL}}/payrolls/{{PAYROLL_ID}}`

### Deduct Salary

Deduct amount from salary for a list of employees.

<mark style="color:purple;">`PATCH`</mark> `{{BASE_URL}}/deduct/payrolls/{{PAYROLL_ID}}`

## Teams

Create teams, assign your employees to teams on Veend Platform with the Teams API.

### Create a Team

## Create a Team

<mark style="color:green;">`POST`</mark> `{{ORG_BASE_URL}}/teams?accountId={{ACCOUNT_ID}}`

#### Request Body

| Name                                   | Type   | Description      |
| -------------------------------------- | ------ | ---------------- |
| name<mark style="color:red;">\*</mark> | Design | Name of the team |

{% tabs %}
{% tab title="200: OK Success Response for created team" %}

```json
{
    "status": "success",
    "data": {
        "team": {
            "tags": [],
            "_id": "63c3de9184279a0017155d3f",
            "name": "Design",
            "companyId": "63c3ba986d30f000147aad51",
            "createdAt": "2023-01-15T11:08:01.816Z",
            "model": "Teams",
            "__v": 0
        }
    }
}
```

{% endtab %}

{% tab title="400: Bad Request Error response for already existing team name" %}

```json
{
    "status": "error",
    "data": {
        "statusCode": 400,
        "message": "team with the name 'Design' already exists"
    },
    "message": "team with the name 'Design' already exists"
}
```

{% endtab %}
{% endtabs %}

### Delete a Team

## Delete a Team

<mark style="color:red;">`DELETE`</mark> `{{ORG_BASE_URL}}/teams/{{TEAM_ID}}?accountId={{ACCOUNT_ID}}`

#### Request Body

| Name                                   | Type   | Description                    |
| -------------------------------------- | ------ | ------------------------------ |
| name<mark style="color:red;">\*</mark> | Design | The name of the team to delete |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

### Assign Employee to a Team

## Assign an employee to a team

<mark style="color:green;">`POST`</mark> `{{BASE_URL}}/teams/{{TEAM_ID}}/assignEmployeeToTeam?accountId={{ACCOUNT_ID}}`

#### Request Body

| Name                                         | Type   | Description   |
| -------------------------------------------- | ------ | ------------- |
| teamId<mark style="color:red;">\*</mark>     |        | Team \_id     |
| employeeId<mark style="color:red;">\*</mark> | String | Employee \_id |

{% tabs %}
{% tab title="200: OK " %}

```json

{
    "status": "success",
    "data": {
        "user": "Lola Asa",
        "team": "Design",
        "message": "Employee assigned to team successfully"
    }
}
```

{% endtab %}
{% endtabs %}
