Teams

Usage

List teams and memberships:

import asyncio
import factorialhr

async def main():
    auth = factorialhr.AccessTokenAuth("your_access_token")
    async with factorialhr.ApiClient(auth=auth) as api:
        teams = factorialhr.TeamsEndpoint(api)
        response = await teams.all()
        for team in response.data():
            print(team.name)
        memberships = factorialhr.MembershipsEndpoint(api)
        for m in (await memberships.get(params={"limit": 50})).data():
            print(m.team_id, m.employee_id)

asyncio.run(main())
class factorialhr.Membership(*, id: int, company_id: int | None = None, employee_id: int, team_id: int, lead: bool)[source]

Model for teams_membership.

company_id: int | None

Company ID of the membership

employee_id: int

Employee ID of the membership

id: int

Membership ID

lead: bool

Whether the employee is a lead of the team or not

team_id: int

Team ID of the membership

class factorialhr.MembershipsEndpoint(api: ApiClient)[source]

Endpoint for teams/memberships operations.

async all(**kwargs) ListApiResponse[Membership][source]

Get all memberships records.

Official documentation: teams/memberships

Parameters:

kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

Response containing the list of records.

Return type:

ListApiResponse[Membership]

async create(data: Mapping[str, Any], **kwargs) Membership[source]

Create a new membership.

Official documentation: teams/memberships

Parameters:
  • data (Mapping[str, Any]) – Payload for the new record (key-value mapping).

  • kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

The created record.

Return type:

Membership

async delete(membership_id: int | str, **kwargs) Membership[source]

Delete a membership.

Official documentation: teams/memberships

Parameters:
  • membership_id (int | str) – The unique identifier of the record to delete.

  • kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

The deleted record.

Return type:

Membership

async get(**kwargs) MetaApiResponse[Membership][source]

Get memberships with pagination metadata.

Official documentation: teams/memberships

Parameters:

kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

Response containing records and pagination metadata.

Return type:

MetaApiResponse[Membership]

async get_by_id(membership_id: int | str, **kwargs) Membership[source]

Get a specific team membership by ID.

Official documentation: teams/memberships

Parameters:
  • membership_id (int | str) – The unique identifier.

  • kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

The record.

Return type:

Membership

async update(membership_id: int | str, data: Mapping[str, Any], **kwargs) Membership[source]

Update a membership.

Official documentation: teams/memberships

Parameters:
  • membership_id (int | str) – The unique identifier of the record to update.

  • data (Mapping[str, Any]) – Payload with fields to update (key-value mapping).

  • kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

The updated record.

Return type:

Membership

class factorialhr.Team(*, id: int, name: str, description: str | None = None, avatar: str | None = None, employee_ids: Sequence[int] | None = None, lead_ids: Sequence[int] | None = None, company_id: int)[source]

Model for teams_team.

avatar: str | None

Team avatar URL

company_id: int

Company ID

description: str | None

Team description

employee_ids: Sequence[int] | None

List of employee IDs in the team

id: int

Team ID

lead_ids: Sequence[int] | None

List of team lead employee IDs

name: str

Team name

class factorialhr.TeamsEndpoint(api: ApiClient)[source]

Endpoint for teams/teams operations.

async all(**kwargs) ListApiResponse[Team][source]

Get all teams records.

Official documentation: teams/teams

Parameters:

kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

Response containing the list of records.

Return type:

ListApiResponse[Team]

async create(data: Mapping[str, Any], **kwargs) Team[source]

Create a new team.

Official documentation: teams/teams

Parameters:
  • data (Mapping[str, Any]) – Payload for the new record (key-value mapping).

  • kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

The created record.

Return type:

Team

async delete(team_id: int | str, **kwargs) Team[source]

Delete a team.

Official documentation: teams/teams

Parameters:
  • team_id (int | str) – The unique identifier of the record to delete.

  • kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

The deleted record.

Return type:

Team

async get(**kwargs) MetaApiResponse[Team][source]

Get teams with pagination metadata.

Official documentation: teams/teams

Parameters:

kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

Response containing records and pagination metadata.

Return type:

MetaApiResponse[Team]

async get_by_id(team_id: int | str, **kwargs) Team[source]

Get a specific team by ID.

Official documentation: teams/teams

Parameters:
  • team_id (int | str) – The unique identifier.

  • kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

The record.

Return type:

Team

async update(team_id: int | str, data: Mapping[str, Any], **kwargs) Team[source]

Update a team.

Official documentation: teams/teams

Parameters:
  • team_id (int | str) – The unique identifier of the record to update.

  • data (Mapping[str, Any]) – Payload with fields to update (key-value mapping).

  • kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

The updated record.

Return type:

Team