<!-- Generated by scripts/build-docs.js. Edit docs/swagger.yaml or docs/guides/, then run `npm run docs:build`. -->

# List teams

`GET https://marketplace-api.sequifi.com/v1/teams`

Module: Teams · operationId: `listTeams` · Auth: `Authorization: Bearer <token>`
Web page: https://apidocs.sequifi.com/#/api/list-teams

Lists teams, as on the Teams page in Sequifi, each with its Team Manager and Team Members. Teams and memberships are dated, and by default you get only those in effect today in UTC, which in US time zones is already tomorrow from late afternoon or evening. Always pass `effective_date`.

**What happens:**

- Read-only.
- A team or membership is in effect on a date when its `start_date` is on or before that date and its `end_date` is empty or on or after it.
- `effective_date` filters both the teams and each team's members, so a rep who left mid-period disappears from that date on. Pass `effective_date=all` to get every team and every membership.
- Members are not filtered by employment status. Each person has `status_id` (`1` = active), so a past roster still shows reps who were later terminated.
- Deleted teams and deleted memberships are left out.

**Filtering and paging:**

- Filters combine with AND.
- `team_name` is a partial, case-insensitive match. Every other filter is exact.
- `team_manager_id` matches the Team Manager. `team_member_id` returns the teams that user belongs to on `effective_date` (the answer to "which team is this rep on").
- `start_date_from`, `start_date_to`, `end_date_from` and `end_date_to` are inclusive ranges on the team's own dates.
- `updated_since` (`YYYY-MM-DD`) returns teams whose own details changed on or after that day. Adding or removing a member probably does not count as a change to the team, so for a roster sync re-read each period by `effective_date`.
- `per_page` defaults to 50, maximum 200. `last_page` is `0` when nothing matches.
- Sorted by team `start_date`, newest first, then by `id`.
- Unknown query parameters are rejected with `400`. Empty values are ignored.

**Formats:**

- Team `start_date` and `end_date`, and each member's `start_date` and `end_date`, are `YYYY-MM-DD`. `end_date` is null when open-ended. A member's dates are their own membership on this team and can differ from the team's dates.
- `created_at` and `updated_at` are UTC timestamps, for example `"2026-09-07T15:05:14.000Z"`.
- `manager_gets_override` is a boolean in the response. The filter takes `0` or `1`.
- `type` is always `lead`.
- `team_manager` is null when the team has no manager.
- A member whose user record no longer exists comes back with only `start_date` and `end_date`, with no `id`.
- `filters` always includes `effective_date`: the date used, or `"all"`.
- There is no `requestedBy` field on this endpoint.

**Errors:**

- `400 Invalid query parameter(s)`, with `data.invalid_params` and `data.allowed_params`.
- `400 effective_date must be a YYYY-MM-DD date or 'all'`
- `400 <name> must be a YYYY-MM-DD date` for `start_date_from`, `start_date_to`, `end_date_from`, `end_date_to` and `updated_since`.
- `400 <name> must be a positive integer` for `team_manager_id`, `team_member_id`, `location_id` and `office_id`.
- `400 manager_gets_override must be 0 or 1`
- `400 per_page must be an integer between 1 and 200`, `400 page must be a positive integer`

**Related:**

- `GET /v1/teams/{id}` returns one team with its full membership history.
- `POST /v1/teams` creates a team.
- `GET /v1/users/{id}` for full details of a manager or member.

## Query parameters

- `effective_date` (string): Return teams and memberships in effect on this date: `YYYY-MM-DD`, or `all` for no date filter. Defaults to today's date in UTC. Always send it. Example: `2026-09-06`.
- `start_date_from` (string (date)): Teams whose `start_date` is on or after this date (`YYYY-MM-DD`). Example: `2026-09-01`.
- `start_date_to` (string (date)): Teams whose `start_date` is on or before this date (`YYYY-MM-DD`). Example: `2026-09-30`.
- `end_date_from` (string (date)): Teams whose `end_date` is on or after this date (`YYYY-MM-DD`). Example: `2026-09-01`.
- `end_date_to` (string (date)): Teams whose `end_date` is on or before this date (`YYYY-MM-DD`). Example: `2026-09-30`.
- `updated_since` (string (date)): Teams whose own details changed on or after this day (`YYYY-MM-DD`, from 00:00 UTC). Member changes may not count; re-read by `effective_date` for roster sync. Example: `2026-09-01`.
- `team_name` (string): Partial, case-insensitive match on the team name. Example: `Alpha`.
- `team_manager_id` (integer): Only teams led by this Team Manager (user id). Minimum: 1. Example: `72`.
- `team_member_id` (integer): Only teams this user belongs to on `effective_date`. Minimum: 1. Example: `428`.
- `type` (string): Team type. Every team is `lead`. Example: `lead`.
- `location_id` (integer): Exact location id on the team. Minimum: 1. Example: `3`.
- `office_id` (integer): Exact office id on the team. Minimum: 1. Example: `5`.
- `manager_gets_override` (integer): The "Team Manager gets Override" setting: `0` or `1`. One of: `0`, `1`. Example: `1`.
- `per_page` (integer): Records per page. Default 50, maximum 200. Default: `50`. Minimum: 1. Maximum: 200. Example: `50`.
- `page` (integer): Page number, starting at 1. Default: `1`. Minimum: 1. Example: `1`.

## Example request

```bash
curl -X GET "https://marketplace-api.sequifi.com/v1/teams" \
  -H "Authorization: Bearer $SEQUIFI_TOKEN"
```

## Responses

### 200: One page of teams. An empty page is still a `200`.

- `status` (integer): Same as the HTTP status code. Example: `200`.
- `message` (string) Example: `success`.
- `data` (object)
  - `current_page` (integer): The page returned.
  - `per_page` (integer): Page size used.
  - `total` (integer): Number of teams that match.
  - `last_page` (integer): Last page number. `0` when nothing matches.
  - `filters` (object): The filters applied. Always includes `effective_date` (a date or `"all"`).
  - `teams` (array of object): Teams on this page.
    - `id` (integer): Team id.
    - `team_name` (string): Team name.
    - `type` (string): Always `lead`.
    - `start_date` (string): First day of the team, `YYYY-MM-DD`.
    - `end_date` (string, nullable): Last day of the team, `YYYY-MM-DD`, or null when open-ended.
    - `manager_gets_override` (boolean): Whether the Team Manager becomes each member's manager for the team's dates.
    - `location_id` (integer, nullable): Location id, if set.
    - `office_id` (integer, nullable): Office id, if set.
    - `created_at` (string): UTC timestamp.
    - `updated_at` (string): UTC timestamp of the last change to the team itself.
    - `team_manager` (object, nullable): The Team Manager, or null.
      - `id` (integer): User id.
      - `first_name` (string): First name.
      - `last_name` (string): Last name.
      - `email` (string): Email address.
      - `position_id` (integer, nullable): Position id, as on `GET /v1/users`.
      - `position_name` (string, nullable): Position name.
      - `sub_position_id` (integer, nullable): Sub-position id.
      - `sub_position_name` (string, nullable): Sub-position name.
      - `is_manager` (integer, nullable): `1` when the user is a manager, else `0`.
      - `status_id` (integer, nullable): Employment status. `1` is active.
    - `team_members` (array of object): Members in effect on `effective_date` (or all memberships with `all`). Same person fields as `team_manager`, plus this membership's dates.
      - `id` (integer): User id. Missing when the user no longer exists.
      - `first_name` (string): First name.
      - `last_name` (string): Last name.
      - `email` (string): Email address.
      - `status_id` (integer, nullable): Employment status. `1` is active.
      - `start_date` (string): First day on this team, `YYYY-MM-DD`.
      - `end_date` (string, nullable): Last day on this team, `YYYY-MM-DD`, or null.

Example (list_response): Teams in effect on a given date

```json
{
  "status": 200,
  "message": "success",
  "data": {
    "current_page": 1,
    "per_page": 50,
    "total": 1,
    "last_page": 1,
    "filters": {
      "effective_date": "2026-09-06"
    },
    "teams": [
      {
        "id": 44,
        "team_name": "Team Alpha - Sep 6",
        "type": "lead",
        "start_date": "2026-09-06",
        "end_date": "2026-09-12",
        "manager_gets_override": false,
        "location_id": null,
        "office_id": null,
        "created_at": "2026-09-07T15:05:14.000Z",
        "updated_at": "2026-09-07T15:05:14.000Z",
        "team_manager": {
          "id": 72,
          "first_name": "Avery",
          "last_name": "Nolan",
          "email": "avery.nolan@example.com",
          "position_id": 2,
          "position_name": "Closer",
          "sub_position_id": 7,
          "sub_position_name": "Veteran",
          "is_manager": 1,
          "status_id": 1
        },
        "team_members": [
          {
            "id": 428,
            "first_name": "Alex",
            "last_name": "Morgan",
            "email": "alex.morgan@example.com",
            "position_id": 2,
            "position_name": "Closer",
            "sub_position_id": 9,
            "sub_position_name": "Sophomore",
            "is_manager": 0,
            "status_id": 1,
            "start_date": "2026-09-06",
            "end_date": "2026-09-12"
          },
          {
            "id": 487,
            "first_name": "Sam",
            "last_name": "Lee",
            "email": "sam.lee@example.com",
            "position_id": 2,
            "position_name": "Closer",
            "sub_position_id": 9,
            "sub_position_name": "Sophomore",
            "is_manager": 0,
            "status_id": 1,
            "start_date": "2026-09-06",
            "end_date": "2026-09-12"
          }
        ]
      }
    ]
  }
}
```

### 400: An unknown query parameter or an invalid filter value. The message names the parameter.

Example (invalid_effective_date): effective_date is not a date or all

```json
{
  "status": 400,
  "message": "effective_date must be a YYYY-MM-DD date or 'all'",
  "data": {}
}
```

### 401: Missing, unknown, expired or disabled token. Sent by the gateway as `{"message":"Unauthorized"}`, without `status` or `data`.

```json
{
  "message": "Unauthorized"
}
```

### 500: Unexpected server error. Safe to retry.

```json
{
  "status": 500,
  "message": "Internal Server Error",
  "data": {}
}
```
