> ## 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.

# Get Team Attendance

> Returns attendance data for a team on a given week, including per-member schedules and bookings.

# Get Team Attendance

Returns the attendance matrix for a team centred on a given date. Includes per-member day-of-week attendance preferences (office, home, abroad, not working), aggregate statistics, and any bookings overlapping the requested week.

## Authentication

Requires a valid customer bearer token. The customer must be a member or 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>

## Query Parameters

<ParamField query="date" type="string" required>
  ISO 8601 UTC datetime specifying the week to retrieve. The API returns the full week containing this date.
</ParamField>

<ParamField query="_shape" type="string">
  Comma-separated list of field paths to include in the response. When provided, only the
  specified fields are returned — useful for reducing payload size. Supports nested paths
  using dot notation.
</ParamField>

## Response

<ResponseField name="IsTeamAdministrator" type="boolean">
  Whether the authenticated customer is an administrator of this team. Used by the portal to show or hide the attendance editing UI.
</ResponseField>

<ResponseField name="Attendance" type="TeamAttendanceDetails" required>
  The attendance data object.
</ResponseField>

### Attendance Details

<ResponseField name="Attendance.TeamId" type="number">
  Numeric identifier of the team.
</ResponseField>

<ResponseField name="Attendance.TeamName" type="string">
  Display name of the team.
</ResponseField>

<ResponseField name="Attendance.AvgBookedMinutesPerWeek" type="number">
  Average booked minutes per week across all members.
</ResponseField>

<ResponseField name="Attendance.AvgBookingsCoworkersPerDay" type="number">
  Average number of members with bookings per day.
</ResponseField>

<ResponseField name="Attendance.AvgCheckedinCoworkersPerDay" type="number">
  Average number of members checked in per day.
</ResponseField>

<ResponseField name="Attendance.AvgCheckinsDaysPerWeek" type="number">
  Average check-in days per week.
</ResponseField>

### Attendance.Coworkers\[]

<ResponseField name="Attendance.Coworkers[].CoworkerId" type="number">
  Numeric identifier of the member.
</ResponseField>

<ResponseField name="Attendance.Coworkers[].CoworkerFullName" type="string">
  Display name of the member.
</ResponseField>

<ResponseField name="Attendance.Coworkers[].CoworkerType" type="number">
  Member type code.
</ResponseField>

<ResponseField name="Attendance.Coworkers[].CoworkerCompanyName" type="string | undefined">
  Company name associated with the member, if any.
</ResponseField>

<ResponseField name="Attendance.Coworkers[].MondayAttendance" type="eCoworkerAttendance">
  Monday attendance status: `1` = Office, `2` = Home, `3` = Abroad, `4` = Not Working, `5` = Undefined.
</ResponseField>

<ResponseField name="Attendance.Coworkers[].TuesdayAttendance" type="eCoworkerAttendance">
  Tuesday attendance status (same values as Monday).
</ResponseField>

<ResponseField name="Attendance.Coworkers[].WednesdayAttendance" type="eCoworkerAttendance">
  Wednesday attendance status.
</ResponseField>

<ResponseField name="Attendance.Coworkers[].ThursdayAttendance" type="eCoworkerAttendance">
  Thursday attendance status.
</ResponseField>

<ResponseField name="Attendance.Coworkers[].FridayAttendance" type="eCoworkerAttendance">
  Friday attendance status.
</ResponseField>

<ResponseField name="Attendance.Coworkers[].SaturdayAttendance" type="eCoworkerAttendance">
  Saturday attendance status.
</ResponseField>

<ResponseField name="Attendance.Coworkers[].SundayAttendance" type="eCoworkerAttendance">
  Sunday attendance status.
</ResponseField>

### Attendance.Days\[]

<ResponseField name="Attendance.Days[].Date" type="string">
  ISO 8601 date for this day.
</ResponseField>

<ResponseField name="Attendance.Days[].Bookings" type="AttendanceBooking[]">
  Bookings on this day.
</ResponseField>

<ResponseField name="Attendance.Days[].Bookings[].Id" type="number">
  Booking identifier.
</ResponseField>

<ResponseField name="Attendance.Days[].Bookings[].FromTime" type="string">
  Booking start time.
</ResponseField>

<ResponseField name="Attendance.Days[].Bookings[].ToTime" type="string">
  Booking end time.
</ResponseField>

<ResponseField name="Attendance.Days[].Bookings[].ResourceId" type="number">
  Identifier of the booked resource.
</ResponseField>

<ResponseField name="Attendance.Days[].Bookings[].ResourceName" type="string">
  Name of the booked resource.
</ResponseField>

<ResponseField name="Attendance.Days[].Bookings[].CoworkerId" type="number | undefined">
  Customer who owns the booking, if applicable.
</ResponseField>

## Examples

### Fetch attendance for a week

```http theme={null}
GET /api/public/teams/55/attendance?date=2025-01-20T00:00:00.000Z
Authorization: Bearer {token}
```

```json theme={null}
{
  "IsTeamAdministrator": true,
  "Attendance": {
    "TeamId": 55,
    "TeamName": "Tech Innovators",
    "AvgBookedMinutesPerWeek": 480,
    "AvgBookingsCoworkersPerDay": 3,
    "AvgCheckedinCoworkersPerDay": 5,
    "AvgCheckinsDaysPerWeek": 4.2,
    "Coworkers": [
      {
        "CoworkerId": 101,
        "CoworkerFullName": "Jane Smith",
        "CoworkerType": 1,
        "CoworkerCompanyName": "Tech Innovators Ltd",
        "MondayAttendance": 1,
        "TuesdayAttendance": 1,
        "WednesdayAttendance": 2,
        "ThursdayAttendance": 1,
        "FridayAttendance": 2,
        "SaturdayAttendance": 4,
        "SundayAttendance": 4
      }
    ],
    "Days": [
      {
        "Date": "2025-01-20T00:00:00",
        "Bookings": [
          {
            "Id": 5001,
            "FromTime": "09:00",
            "ToTime": "17:00",
            "ResourceId": 201,
            "ResourceName": "Meeting Room A",
            "CoworkerId": 101
          }
        ]
      }
    ]
  }
}
```

## TypeScript Integration

```typescript theme={null}
import { endpoints } from '@/api/endpoints'
import { TeamAttendance } from '@/types/endpoints/TeamAttandance'
import { useData } from '@/hooks/useData'
import { DateTime } from 'luxon'

const { resource: attendance } = useData<TeamAttendance>(httpClient, endpoints.teams.attendance(teamId, DateTime.now()))
```

## Usage in Portal

| Context                                                     | Source file                                                                 |
| ----------------------------------------------------------- | --------------------------------------------------------------------------- |
| Team dashboard attendance KPIs (`/dashboard/team/{teamId}`) | `src/views/user/dashboards/team/components/TeamAttendanceKpiSection.tsx`    |
| Team attendance section (`/team/attendance/{teamId}`)       | `src/views/user/team/attendance/components/TeamAttedanceSection.tsx`        |
| Attendance management (`/team/attendance/{teamId}`)         | `src/views/user/team/attendance/components/AttendanceManagementSection.tsx` |

## Error Responses

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

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

## Related Endpoints

| Method | Endpoint                                | Description                          |
| ------ | --------------------------------------- | ------------------------------------ |
| `PUT`  | `/api/public/teams/{teamId}/attendance` | Update member attendance preferences |
| `GET`  | `/api/public/teams/{teamId}/kpi`        | Team KPI data                        |
| `GET`  | `/api/public/teams/{teamId}/metrics`    | Team performance metrics             |
| `GET`  | `/api/public/teams/{teamId}/profile`    | Full team profile                    |
