Banking

Usage

List bank accounts and transactions:

import asyncio
import factorialhr

async def main():
    auth = factorialhr.AccessTokenAuth("your_access_token")
    async with factorialhr.ApiClient(auth=auth) as api:
        accounts = factorialhr.BankAccountsEndpoint(api)
        response = await accounts.all()
        for account in response.data():
            print(account.name, account.currency)

        # List card payments or transactions
        transactions = factorialhr.TransactionsEndpoint(api)
        txs = await transactions.get(params={"limit": 50})
        for t in txs.data():
            print(t.amount, t.description)

asyncio.run(main())
class factorialhr.BankAccount(*, id: int, external_id: str, currency: str, country: str, account_number: str, account_number_type: AccountNumberType, sort_code: str | None = None, bic: str | None = None, iban: str | None = None, routing_number: str | None = None, account_balance_cents: int, available_balance_cents: int, pending_balance_cents: int, beneficiary_name: str | None = None, bank_name: str | None = None, account_alias: str | None = None, updated_at: datetime, legal_entity_id: int | None = None)[source]

Model for banking_bank_account.

account_alias: str | None

Account alias

account_balance_cents: int

Account balance in cents

account_number: str

Account number

account_number_type: AccountNumberType

Account number type

available_balance_cents: int

Available balance in cents

bank_name: str | None

Bank name

beneficiary_name: str | None

Beneficiary name

bic: str | None

Bank Identifier Code

country: str

Country

currency: str

Currency

external_id: str

External ID for the bank account

iban: str | None

International Bank Account Number

id: int

Factorial unique identifier

legal_entity_id: int | None

Factorial unique identifier of the legal entity

pending_balance_cents: int

Pending balance in cents

routing_number: str | None

Routing number

sort_code: str | None

Sort code

updated_at: datetime

Last updated date

class factorialhr.BankAccountNumber(*, id: str, company_id: int, account_number: str, complementary_data: str | None = None, format: str)[source]

Model for banking_bank_account_number.

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

Endpoint for bank accounts operations.

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

Get all bank accounts records.

Official documentation: banking/bank_accounts

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

async create_manual(data: Mapping[str, Any], **kwargs) BankAccount[source]

Create a manual bank account.

Official documentation: banking/bank_accounts

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:

BankAccount

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

Get bank accounts with pagination metadata.

Official documentation: banking/bank_accounts

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

async get_by_id(bank_account_id: int | str, **kwargs) BankAccount[source]

Get a specific bank account by ID.

Official documentation: banking/bank_accounts

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

BankAccount

class factorialhr.CardPayment(*, id: int, card_id: int, amount_cents: int, currency: str, merchant_name: str, merchant_amount_cents: int, merchant_currency: str, approved: bool, external_created_at: datetime, status: CardPaymentStatus, type: CardPaymentType, exchange_rate: float, rejected_reason: RejectedReason | None = None, created_at: datetime)[source]

Model for banking_card_payment.

amount_cents: int

The amount of the card payment

approved: bool

Whether the card payment was approved

card_id: int

The ID of the card

created_at: datetime

The date and time the card payment was created in factorial

currency: str

The currency of the card payment

exchange_rate: float

The exchange rate of the card payment

external_created_at: datetime

The date and time the card payment was created in the external system

id: int

The ID of the card payment

merchant_amount_cents: int

The amount of the merchant

merchant_currency: str

The currency of the merchant

merchant_name: str

The name of the merchant

rejected_reason: RejectedReason | None

The reason the card payment was rejected

status: CardPaymentStatus

The status of the card payment

type: CardPaymentType

The type of the card payment

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

Endpoint for card payments operations.

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

Get all card payments records.

Official documentation: banking/card_payments

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

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

Get card payments with pagination metadata.

Official documentation: banking/card_payments

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

async get_by_id(card_payment_id: int | str, **kwargs) CardPayment[source]

Get a specific card payment by ID.

Official documentation: banking/card_payments

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

CardPayment

class factorialhr.Transaction(*, id: int, bank_account_id: int, amount_cents: int, balance_after_cents: int | None = None, currency: str, type: TransactionType, description: str | None = None, booking_date: datetime, value_date: datetime, card_payment_id: int, updated_at: datetime)[source]

Model for banking_transaction.

amount_cents: int

Amount in cents

balance_after_cents: int | None

Balance after the transaction in cents

bank_account_id: int

Factorial Banking Bank Account unique identifier

booking_date: datetime

Booking date of the transaction

card_payment_id: int

Factorial unique identifier of the card payment

currency: str

Currency

description: str | None

Description of the transaction

id: int

Factorial unique identifier

type: TransactionType

Type of transaction

updated_at: datetime

Date when the transaction was last updated

value_date: datetime

Value date of the transaction

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

Endpoint for transactions operations.

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

Get all transactions records.

Official documentation: banking/transactions

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

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

Get transactions with pagination metadata.

Official documentation: banking/transactions

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

async get_by_id(transaction_id: int | str, **kwargs) Transaction[source]

Get a specific transaction by ID.

Official documentation: banking/transactions

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

Transaction