> ## Documentation Index
> Fetch the complete documentation index at: https://learn.nexudus.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Team Attendance

> Updates per-member weekly attendance preferences for a team.

# Update Team Attendance

Updates the weekly attendance preferences for one or more team members. Each entry specifies a member and their day-of-week attendance status (office, home, abroad, not working). Only team administrators can update attendance.

## Authentication

Requires a valid customer bearer token. The customer must be a team administrator of the specified team.

## Path Parameters

<ParamField path="teamId" type="number" required>
  Numeric identifier of the team. Returned as `Id` from [`GET /api/public/teams/my`](/api/endpoints/teams/list-teams).
</ParamField>

## Request Body

The request body is an **array** of attendance update objects. Each object specifies a member and one or more day-of-week attendance values.

<ParamField body="[].CoworkerId" type="number" required>
  Numeric identifier of the team member whose attendance is being updated.
</ParamField>

<ParamField body="[].MondayAttendance" type="number">
  Monday attendance status: `1` = Office, `2` = Home, `3` = Abroad, `4` = Not Working, `5` = Undefined.
</ParamField>

<ParamField body="[].TuesdayAttendance" type="number">
  Tuesday attendance status (same values).
</ParamField>

<ParamField body="[].WednesdayAttendance" type="number">
  Wednesday attendance status.
</ParamField>

<ParamField body="[].ThursdayAttendance" type="number">
  Thursday attendance status.
</ParamField>

<ParamField body="[].FridayAttendance" type="number">
  Friday attendance status.
</ParamField>

<ParamField body="[].SaturdayAttendance" type="number">
  Saturday attendance status.
</ParamField>

<ParamField body="[].SundayAttendance" type="number">
  Sunday attendance status.
</ParamField>

## Response

Returns HTTP `200 OK` with an empty body on success.

## Examples

### Update attendance for two members

```http theme={null}
PUT /api/public/teams/55/attendance
Authorization: Bearer {token}
Content-Type: application/json
```

```json theme={null}
[
  {
    "CoworkerId": 101,
    "MondayAttendance": 1,
    "TuesdayAttendance": 1,
    "WednesdayAttendance": 2,
    "ThursdayAttendance": 1,
    "FridayAttendance": 2,
    "SaturdayAttendance": 4,
    "SundayAttendance": 4
  },
  {
    "CoworkerId": 102,
    "WednesdayAttendance": 1,
    "FridayAttendance": 3
  }
]
```

```
Status: 200 OK
Body: (empty)
```

## TypeScript Integration

```typescript theme={null}
import { endpoints } from '@/api/endpoints'

const data = Object.entries(updatedAttendance).map(([coworkerId, updates]) => ({
  CoworkerId: Number(coworkerId),
  ...updates,
}))

await httpClient.put(endpoints.teams.attendanceUpdate(teamId), data)
```

## Usage in Portal

| Context                                                | Source file                                                          |
| ------------------------------------------------------ | -------------------------------------------------------------------- |
| Attendance matrix editor (`/team/attendance/{teamId}`) | `src/views/user/team/attendance/components/TeamAttendanceMatrix.tsx` |

## Error Responses

<ResponseField name="401 Unauthorized" type="error">
  The customer is not authenticated or the session has expired.
</ResponseField>

<ResponseField name="403 Forbidden" type="error">
  The customer is not an administrator of the specified team.
</ResponseField>

<ResponseField name="400 Bad Request" type="error">
  Invalid request data — for example, an invalid attendance value or unknown member ID.
</ResponseField>

<ResponseField name="404 Not Found" type="error">
  Team with the specified ID does not exist.
</ResponseField>

## Related Endpoints

| Method | Endpoint                                | Description                 |
| ------ | --------------------------------------- | --------------------------- |
| `GET`  | `/api/public/teams/{teamId}/attendance` | Get current attendance data |
| `GET`  | `/api/public/teams/{teamId}/kpi`        | Team KPI data               |
| `GET`  | `/api/public/teams/{teamId}/profile`    | Full team profile           |
| `GET`  | `/api/public/teams/my`                  | List the customer's teams   |
