Companies

Usage

List legal entities (companies):

import asyncio
import factorialhr

async def main():
    auth = factorialhr.AccessTokenAuth("your_access_token")
    async with factorialhr.ApiClient(auth=auth) as api:
        entities = factorialhr.LegalEntitiesEndpoint(api)
        response = await entities.all()
        for entity in response.data():
            print(entity.name, entity.country)

asyncio.run(main())
class factorialhr.LegalEntitiesEndpoint(api: ApiClient)[source]

Endpoint for legal entities.

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

Get all companies records.

Official documentation: companies/legal_entities

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[LegalEntity]

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

Create a new companies.

Official documentation: companies/legal_entities

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:

LegalEntity

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

Get companies with pagination metadata.

Official documentation: companies/legal_entities

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[LegalEntity]

async get_by_id(legal_entity_id: int | str, **kwargs) LegalEntity[source]

Get a specific companies by ID.

Official documentation: companies/legal_entities

Parameters:
  • legal_entity_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:

LegalEntity

class factorialhr.LegalEntity(*, id: int, company_id: int, country: str, legal_name: str, currency: str, tin: str | None = None, city: str | None = None, state: str | None = None, postal_code: str | None = None, address_line_1: str | None = None, address_line_2: str | None = None)[source]

Model for companies_legal_entity.

address_line_1: str | None

Address line 1 of the legal entity

address_line_2: str | None

Address line 2 of the legal entity

city: str | None

City of the legal entity

company_id: int

Company identifier

country: str

Country code of the legal entity

currency: str

The currency code in ISO 4217 format

id: int

Identifier of the legal entity

legal_name: str

Legal name of the legal entity

postal_code: str | None

Postal code of the legal entity

state: str | None

State of the legal entity

tin: str | None

Tax identification number