> For the complete documentation index, see [llms.txt](https://docs.valtimo.nl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.valtimo.nl/features/teams/for-developers.md).

# For developers

The teams feature provides a way to group users and manage their membership. This document describes the technical details of the teams feature.

## Backend implementation

The backend implementation for teams is located in the `backend/team` module.

### REST API

The teams feature provides several REST endpoints for managing teams and their members.

* `GET /api/v1/team`: List all teams.
* `GET /api/v1/team/{key}`: Get the details of a specific team.
* `POST /api/v1/team`: Create a new team.
* `PUT /api/v1/team/{key}`: Update an existing team.
* `DELETE /api/v1/team/{key}`: Delete a team.
* `GET /api/v1/team/{teamKey}/user`: List all users in a team.
* `POST /api/v1/team/{teamKey}/user`: Add a user to a team.
* `DELETE /api/v1/team/{teamKey}/user/{username}`: Remove a user from a team.
* `GET /api/v1/team/{teamKey}/candidate-user`: Get candidate users to add to a team.

### Integration with access control

Teams are integrated into Valtimo's access control system as a resource. The resource type for teams is `com.ritense.team.domain.Team`.

The following actions are available for the Team resource:

| Action      | Description                     |
| ----------- | ------------------------------- |
| `view`      | View a single team              |
| `view_list` | View the list of teams          |
| `create`    | Create a new team               |
| `modify`    | Update an existing team         |
| `delete`    | Delete a team                   |
| `assign`    | Add or remove users from a team |

### Database schema

The teams feature uses the following tables:

* `team`: Stores information about teams (key and title).
* `team_user`: Stores the membership information (team key and username).
* `task_team`: Stores team assignment for tasks (task id and team key).

Additionally, the `json_schema_document` table is extended with `assigned_team_key` and `assigned_team_title` columns to store the team assigned to a case.

## Frontend implementation

The frontend implementation for teams is located in the `frontend/projects/valtimo/teams` library.

### Module

The `TeamsModule` should be imported into the application to use the teams feature.

### Routing

The teams feature provides several routes for managing teams and their members:

* `/teams`: List all teams.
* `/teams/:teamKey`: Team details and member management.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.valtimo.nl/features/teams/for-developers.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
