Teams API¶
Search and manage team information with comprehensive filtering and sorting capabilities.
Overview¶
Teams API Capabilities
- Search Teams: Find teams with advanced filtering options
- Team Details: Get comprehensive team information including members
- Flexible Sorting: Sort results by various criteria
- Pagination: Handle large result sets efficiently
- Member Management: Access team member details
Quick Start¶
from rezen import RezenClient
from rezen.enums import TeamStatus, SortDirection
client = RezenClient()
# Simple team search
teams = client.teams.search_teams(status="ACTIVE", page_size=10)
# Get team with full details
team = client.teams.get_team("team-uuid")
# Get team members
members = client.teams.get_team_members("team-uuid")
# Advanced search with enums
teams = client.teams.search_teams(
status=TeamStatus.ACTIVE,
sort_direction=SortDirection.DESC,
page_size=50
)
API Methods¶
Search Teams¶
Search teams given a set of criteria.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_number | Optional[int] | Page number for pagination (default: 0) | None |
page_size | Optional[int] | Number of results per page (default: 20, min: 1) | None |
sort_direction | Optional[Union[SortDirection, str]] | Sort direction (ASC or DESC, default: ASC) | None |
sort_by | Optional[Union[List[Union[TeamSortField, str]], Union[TeamSortField, str]]] | Fields to sort by (default: ["NAME"]) | None |
team_id | Optional[str] | Filter by team UUID | None |
name | Optional[str] | Filter by team name | None |
search_text | Optional[str] | General search text | None |
status | Optional[Union[TeamStatus, str]] | Filter by team status (ACTIVE or INACTIVE) | None |
created_at_start | Optional[Union[date, str]] | Filter by creation date start (YYYY-MM-DD format) | None |
created_at_end | Optional[Union[date, str]] | Filter by creation date end (YYYY-MM-DD format) | None |
team_type | Optional[Union[TeamType, str]] | Filter by team type (NORMAL, PLATINUM, GROUP, DOMESTIC, PRO) | None |
Returns:
Type | Description |
---|---|
Dict[str, Any] | Dictionary containing team search results with pagination information |
Example
# Search for active teams
teams = client.teams.search_teams(
status=TeamStatus.ACTIVE,
team_type=TeamType.PLATINUM,
page_size=50
)
# Search by name
teams = client.teams.search_teams(
name="Sales Team",
sort_by=[SortField.NAME, SortField.CREATED_AT],
sort_direction=SortDirection.DESC
)
# Search with text query
teams = client.teams.search_teams(
search_text="marketing",
page_number=2
)
Search Examples
Get Team Details¶
Get team by ID without agents information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
team_id | str | UUID of the team to retrieve | required |
Returns:
Type | Description |
---|---|
Dict[str, Any] | Dictionary containing team details without agent information |
Get team by ID with full information including agents.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
team_id | str | UUID of the team to retrieve | required |
Returns:
Type | Description |
---|---|
Dict[str, Any] | Dictionary containing full team details including agent information |
Raises:
Type | Description |
---|---|
RezenError | If the API request fails |
Team Details Methods
- Use
get_team_without_agents()
for basic team information without member details - Use
get_team()
for full team information including all agents/members
Get Team Members¶
Get team members for a specific team.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
team_id | str | UUID of the team to retrieve members for | required |
Returns:
Type | Description |
---|---|
Dict[str, Any] | Dictionary containing team members information |
Raises:
Type | Description |
---|---|
RezenError | If the API request fails |
Team Member Examples
# Get complete team information with agents
team = client.teams.get_team(team_id)
print(f"Team: {team['name']}")
print(f"Status: {team['status']}")
print(f"Type: {team['team_type']}")
print(f"Total agents: {len(team.get('agents', []))}")
# Process team agents
for agent in team.get('agents', []):
print(f"Agent: {agent['first_name']} {agent['last_name']}")
Parameters Reference¶
Search Parameters¶
Parameter | Type | Description |
---|---|---|
page_number | Optional[int] | Page number (default: 0) |
page_size | Optional[int] | Results per page (default: 20) |
sort_direction | Optional[SortDirection] | ASC or DESC |
sort_by | Optional[List[TeamSortField]] | Fields to sort by |
team_id | Optional[str] | Filter by team UUID |
name | Optional[str] | Filter by team name |
search_text | Optional[str] | General search text |
status | Optional[TeamStatus] | ACTIVE or INACTIVE |
created_at_start | Optional[str] | Date filter start (YYYY-MM-DD) |
created_at_end | Optional[str] | Date filter end (YYYY-MM-DD) |
team_type | Optional[TeamType] | Team type filter |
Complete Examples¶
Comprehensive Team Management
from rezen import RezenClient
from rezen.enums import TeamStatus, TeamType, SortDirection, TeamSortField
def comprehensive_team_management():
client = RezenClient()
# Search for active teams
teams = client.teams.search_teams(
status=TeamStatus.ACTIVE,
team_type=TeamType.PLATINUM,
sort_by=[TeamSortField.NAME, TeamSortField.CREATED_AT],
sort_direction=SortDirection.DESC,
page_size=25,
created_at_start="2024-01-01",
created_at_end="2024-12-31"
)
print(f"Found {len(teams)} teams")
# Get detailed information for each team
for team_summary in teams[:5]: # Process first 5 teams
team_id = team_summary['id']
# Get full team details
full_team = client.teams.get_team(team_id)
print(f"\nTeam: {full_team['name']}")
print(f"Status: {full_team['status']}")
print(f"Type: {full_team['team_type']}")
# Get team members
members = client.teams.get_team_members(team_id)
print(f"Members: {len(members.get('members', []))}")
# List member details
for member in members.get('members', [])[:3]: # Show first 3 members
print(f" - {member['name']} ({member['role']})")
return teams
Team Types and Statuses¶
Team Types
Type | Description |
---|---|
NORMAL | Standard team |
PLATINUM | Platinum-level team |
GROUP | Group team |
DOMESTIC | Domestic team |
PRO | Professional team |
Team Statuses
Status | Description |
---|---|
ACTIVE | Team is currently active |
INACTIVE | Team is inactive/archived |
Next Steps¶
-
:material-account-tie: Agents API
Search and manage agent information
-
:material-hammer-wrench: Transaction Builder
Create transactions with team members
-
:material-code-braces: Data Types
Learn about team-related enums and types