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

# Teams

> SDK methods to list, create, and manage teams and team membership within a TrueFoundry tenant.

## Methods

<Accordion title="list">
  Retrieve all teams associated with the authenticated user. If the user is a tenant admin, returns all teams for the tenant. Pagination is available based on query parameters

  #### Parameters

  <ParamField body="limit" type="typing.Optional[int]">
    Number of items per page
  </ParamField>

  <ParamField body="offset" type="typing.Optional[int]">
    Number of items to skip
  </ParamField>

  <ParamField body="type" type="typing.Optional[TeamsListRequestType]">
    [🔗 TeamsListRequestType](/docs/truefoundry_sdk/enums#teamslistrequesttype)

    Filter teams by type
  </ParamField>

  #### Returns

  <ResponseField name="SyncPager[Team, ListTeamsResponse]" type="SyncPager[Team, ListTeamsResponse]">
    [🔗 ListTeamsResponse](/docs/truefoundry_sdk/types#listteamsresponse)

    Returns an array of teams associated with the user or tenant And also the response includes paginated data
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.teams.list(
      limit=10,
      offset=10,
      type="value",
  )

  # Iterate through results
  for item in response:
      print(item.name)

  # Or paginate page by page
  for page in response.iter_pages():
      for item in page:
          print(item.name)
  ```
</Accordion>

<Accordion title="create_or_update">
  Creates a new team or updates an existing team. It ensures that the team name is unique, valid, and that the team has at least one member. The members of the team are added or updated based on the provided emails.

  #### Parameters

  <ParamField body="manifest" type="TeamManifest" required>
    [🔗 TeamManifest](/docs/truefoundry_sdk/types#teammanifest)

    Team manifest
  </ParamField>

  <ParamField body="dry_run" type="typing.Optional[bool]">
    Dry run
  </ParamField>

  #### Returns

  <ResponseField name="GetTeamResponse" type="GetTeamResponse">
    [🔗 GetTeamResponse](/docs/truefoundry_sdk/types#getteamresponse)

    Returns the created or updated team.
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.teams.create_or_update(
      manifest={"key": "value"},
      dry_run=False,
  )
  ```
</Accordion>

<Accordion title="get">
  Get Team associated with provided team id

  #### Parameters

  <ParamField body="id" type="str" required>
    Team Id
  </ParamField>

  #### Returns

  <ResponseField name="GetTeamResponse" type="GetTeamResponse">
    [🔗 GetTeamResponse](/docs/truefoundry_sdk/types#getteamresponse)

    Returns the Team associated with provided team id
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.teams.get(
      id="id_value",
  )
  ```
</Accordion>

<Accordion title="delete">
  Deletes the Team associated with the provided Id.

  #### Parameters

  <ParamField body="id" type="str" required>
    Team Id
  </ParamField>

  #### Returns

  <ResponseField name="DeleteTeamResponse" type="DeleteTeamResponse">
    [🔗 DeleteTeamResponse](/docs/truefoundry_sdk/types#deleteteamresponse)

    Successfully deleted the team.
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.teams.delete(
      id="id_value",
  )
  ```
</Accordion>

<Accordion title="get_permissions">
  Get all role bindings associated with a team.

  #### Parameters

  <ParamField body="id" type="str" required>
    Team Id
  </ParamField>

  #### Returns

  <ResponseField name="GetTeamPermissionsResponse" type="GetTeamPermissionsResponse">
    [🔗 GetTeamPermissionsResponse](/docs/truefoundry_sdk/types#getteampermissionsresponse)

    Returns role bindings for the team.
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.teams.get_permissions(
      id="id_value",
  )
  ```
</Accordion>
