> For the complete documentation index, see [llms.txt](https://qbits-organization.gitbook.io/buildwise-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://qbits-organization.gitbook.io/buildwise-doc/project-management./project-team.md).

# Project Team

### Add Team Members

Adds multiple team members to a project.

**Endpoint:** `POST /api/v1/projects/{projectId}/team`

**Path Parameters:**

* `projectId` (UUID) - The project identifier

**Request Body:**

```json
[
  {
    "memberIds": [
      "111e1111-e11b-11d1-a111-111111111111",
      "222e2222-e22b-22d2-a222-222222222222"
    ],
    "role": "PROJECT_MANAGER"
  },
  {
    "memberIds": [
      "333e3333-e33b-33d3-a333-333333333333"
    ],
    "role": "DEVELOPER"
  }
]
```

**Success Response:**

```json
{
  "success": true,
  "httpStatus": "OK",
  "message": "Successfully added 3 team members",
  "action_time": "2025-06-02T15:25:30.123456",
  "data": [
    {
      "memberId": "111e1111-e11b-11d1-a111-111111111111",
      "memberName": "Jane Smith",
      "memberEmail": "janesmith@example.com",
      "role": "PROJECT_MANAGER",
      "roleDisplayName": "Project Manager",
      "organisationRole": "MEMBER",
      "status": "ACTIVE",
      "joinedAt": "2025-05-15T09:30:00.000000"
    }
  ]
}
```

### Remove Team Members

Removes multiple team members from a project.

**Endpoint:** `DELETE /api/v1/projects/{projectId}/team`

**Path Parameters:**

* `projectId` (UUID) - The project identifier

**Request Body:**

```json
[
  "111e1111-e11b-11d1-a111-111111111111",
  "222e2222-e22b-22d2-a222-222222222222"
]
```

**Success Response:**

```json
{
  "success": true,
  "httpStatus": "OK",
  "message": "Successfully removed 2 team members",
  "action_time": "2025-06-02T15:30:45.789012",
  "data": {
    "removedMembers": [
      {
        "memberId": "111e1111-e11b-11d1-a111-111111111111",
        "memberName": "Jane Smith",
        "memberEmail": "janesmith@example.com",
        "role": "PROJECT_MANAGER",
        "roleDisplayName": "Project Manager",
        "organisationRole": "MEMBER",
        "status": "ACTIVE",
        "joinedAt": "2025-05-15T09:30:00.000000"
      }
    ],
    "skippedMemberIds": [],
    "protectedOwnerIds": [],
    "totalRequested": 2,
    "totalRemoved": 1,
    "totalSkipped": 0,
    "totalProtected": 0,
    "message": null
  }
}
```

### Get Project Team Members

Retrieves all team members for a specific project.

**Endpoint:** `GET /api/v1/projects/{projectId}/team`

**Path Parameters:**

* `projectId` (UUID) - The project identifier

**Success Response:**

```json
{
  "success": true,
  "httpStatus": "OK",
  "message": "Retrieved 3 team members",
  "action_time": "2025-06-02T15:35:20.345678",
  "data": [
    {
      "memberId": "111e1111-e11b-11d1-a111-111111111111",
      "memberName": "Jane Smith",
      "memberEmail": "janesmith@example.com",
      "role": "PROJECT_MANAGER",
      "roleDisplayName": "Project Manager",
      "organisationRole": "MEMBER",
      "status": "ACTIVE",
      "joinedAt": "2025-05-15T09:30:00.000000"
    }
  ]
}
```

### Update Team Member Role

Updates the role of a specific team member.

**Endpoint:** `PUT /api/v1/projects/{projectId}/team/member/{memberId}/role`

**Path Parameters:**

* `projectId` (UUID) - The project identifier
* `memberId` (UUID) - The member identifier

**Request Body:**

```json
{
  "newRole": "DEVELOPER"
}
```

**Success Response:**

```json
{
  "success": true,
  "httpStatus": "OK",
  "message": "Team member role updated successfully",
  "action_time": "2025-06-02T15:40:15.456789",
  "data": {
    "memberId": "111e1111-e11b-11d1-a111-111111111111",
    "memberName": "Jane Smith",
    "memberEmail": "janesmith@example.com",
    "role": "DEVELOPER",
    "roleDisplayName": "Developer",
    "organisationRole": "MEMBER",
    "status": "ACTIVE",
    "joinedAt": "2025-05-15T09:30:00.000000"
  }
}
```

### Check Team Membership

Checks if a specific member is part of a project team.

**Endpoint:** `GET /api/v1/projects/{projectId}/team/check?memberEmail={email}`

**Path Parameters:**

* `Email` (email) - The project identifier

**Success Response:**

```json
{
  "success": true,
  "httpStatus": "OK",
  "message": "Member 111e1111-e11b-11d1-a111-111111111111 is part of the project team",
  "action_time": "2025-06-02T15:45:30.789012",
  "data": {
    "memberId": "111e1111-e11b-11d1-a111-111111111111",
    "projectId": "123e4567-e89b-12d3-a456-426614174000",
    "isTeamMember": true
  }
}
```

### Authorization Rules

* Only `OWNER` or `ADMIN` Organization members can add/remove team members and update roles
* All organization members can view team members and check their membership
* All team members must be active organization members
* Organization owners cannot be removed from projects (they are protected)

### Team Member Roles

* `PROJECT_MANAGER` - Project Manager
* `MEMBER` - Team Member
* `ARCHITECT` - Architect
* `ENGINEER` - Engineer
* `LEAD CONSULTANT`- Lead consultant

### Error Responses

* `400` - Bad Request (Invalid request data)
* `401` - Unauthorized (Not authenticated)
* `404` - Not Found (Project not found, member not found, or insufficient permissions)

### Data Models

#### BulkAddTeamMemberRequest

```json
{
  "memberIds": ["uuid1", "uuid2"],
  "role": "PROJECT_MANAGER"
}
```

#### UpdateTeamMemberRoleRequest

```json
{
  "newRole": "DEVELOPER"
}
```

#### ProjectTeamMemberResponse

```json
{
  "memberId": "uuid",
  "memberName": "string",
  "memberEmail": "string", 
  "role": "PROJECT_MANAGER",
  "roleDisplayName": "Project Manager",
  "organisationRole": "MEMBER",
  "status": "ACTIVE",
  "joinedAt": "2025-05-15T09:30:00.000000"
}
```

#### ProjectTeamRemovalResponse

```json
{
  "removedMembers": [ProjectTeamMemberResponse],
  "skippedMemberIds": ["uuid"],
  "protectedOwnerIds": ["uuid"],
  "totalRequested": 0,
  "totalRemoved": 0,
  "totalSkipped": 0, 
  "totalProtected": 0,
  "message": "string"
}
```
