# Teams API

The Teams API allows you to manage and retrieve information about teams within your organization. This document provides an overview of the team object and available endpoints.

## Team Object

A team object represents a group of employees within your organization. Here's an overview of the team object properties:

| Property | Type | Description |
|  --- | --- | --- |
| _id | string | Unique identifier for the team |
| name | string | Name of the team |
| status | string | Current status of the team (e.g., "ACTIVE") |
| reviewers | array of objects | List of reviewers for the team |
| code | string | Unique code for the team |
| createdAt | string (ISO 8601 date-time) | Date and time when the team was created |
| updatedAt | string (ISO 8601 date-time) | Date and time when the team was last updated |
| __v | number | Version number (internal use) |
| updated_by | string | Identifier of the user who last updated the team |
| employee_count | number | Number of employees in the team |
| employees | array of objects | List of employees in the team |
| balance | number | Current balance of the team |


### Reviewer Object

Each reviewer in the team has the following properties:

| Property | Type | Description |
|  --- | --- | --- |
| employee_id | string | Unique identifier for the reviewer |
| name | string | Name of the reviewer |
| read_only | boolean | Indicates if the reviewer has read-only access |
| _id | string | Unique identifier for the reviewer entry |
| added_on | string (ISO 8601 date-time) | Date and time when the reviewer was added |


### Employee Object

Each employee in the team has the following properties:

| Property | Type | Description |
|  --- | --- | --- |
| name | string | Full name of the employee |
| phone | string | Phone number of the employee |
| organization_email | string | Work email address of the employee |
| employee_id | string | Unique identifier for the employee |
| role | string | Role of the employee (e.g., "CARD USER", "REVIEWER", "APPROVER") |
| team_code | string | Code of the team the employee belongs to |
| key | string | Unique key for the employee (same as employee_id) |
| balance | number | Current balance of the employee |


## API Endpoints

The following endpoints are available for managing teams:

### Get All Teams [API](/teams)

Retrieves a list of all teams in the organization.

```
GET /v1/teams
```

### Get a Specific Team

Retrieves details of a specific team by its ID.

```
GET /v1/teams/{teamId}
```

### Create a New Team

Creates a new team in the organization.

```
POST /v1/teams
```

### Update a Team

Updates the details of an existing team.

```
PUT /v1/teams/{teamId}
```

### Delete a Team

Deletes a team from the organization.

```
DELETE /v1/teams/{teamId}
```

### Add a Reviewer to a Team

Adds a new reviewer to a specific team.

```
POST /v1/teams/{teamId}/reviewers
```

### Remove a Reviewer from a Team

Removes a reviewer from a specific team.

```
DELETE /v1/teams/{teamId}/reviewers/{reviewerId}
```

For detailed information on request and response formats, please refer to the Teams API specification (teams.yaml).