Skip to content

lunchable#

Lunch Money Python SDK

LunchMoney #

Bases: AssetsClient, BudgetsClient, CategoriesClient, CryptoClient, PlaidAccountsClient, RecurringExpensesClient, TagsClient, TransactionsClient, UserClient

Lunch Money Python Client.

This class facilitates with connections to the Lunch Money Developer API. Authenticate with an Access Token. If an access token isn't provided one will attempt to be inherited from a LUNCHMONEY_ACCESS_TOKEN environment variable.

Examples:

from typing import List

from lunchable import LunchMoney
from lunchable.models import TransactionObject

lunch = LunchMoney(access_token="xxxxxxx")
transactions: List[TransactionObject] = lunch.get_transactions()
Source code in lunchable/models/_lunchmoney.py
class LunchMoney(
    AssetsClient,
    BudgetsClient,
    CategoriesClient,
    CryptoClient,
    PlaidAccountsClient,
    RecurringExpensesClient,
    TagsClient,
    TransactionsClient,
    UserClient,
):
    """
    Lunch Money Python Client.

    This class facilitates with connections to
    the [Lunch Money Developer API](https://lunchmoney.dev/). Authenticate
    with an Access Token. If an access token isn't provided one will attempt to
    be inherited from a `LUNCHMONEY_ACCESS_TOKEN` environment variable.

    Examples
    --------
    ```python
    from typing import List

    from lunchable import LunchMoney
    from lunchable.models import TransactionObject

    lunch = LunchMoney(access_token="xxxxxxx")
    transactions: List[TransactionObject] = lunch.get_transactions()
    ```
    """

    def __init__(self, access_token: Optional[str] = None):
        """
        Initialize a Lunch Money object with an Access Token.

        Tries to inherit from the Environment if one isn't provided

        Parameters
        ----------
        access_token: Optional[str]
            Lunchmoney Developer API Access Token
        """
        super(LunchMoney, self).__init__(access_token=access_token)

__init__(access_token=None) #

Initialize a Lunch Money object with an Access Token.

Tries to inherit from the Environment if one isn't provided

Parameters:

Name Type Description Default
access_token Optional[str]

Lunchmoney Developer API Access Token

None
Source code in lunchable/models/_lunchmoney.py
def __init__(self, access_token: Optional[str] = None):
    """
    Initialize a Lunch Money object with an Access Token.

    Tries to inherit from the Environment if one isn't provided

    Parameters
    ----------
    access_token: Optional[str]
        Lunchmoney Developer API Access Token
    """
    super(LunchMoney, self).__init__(access_token=access_token)

LunchMoneyError #

Bases: Exception

Base Exception for Lunch Money

Source code in lunchable/exceptions.py
class LunchMoneyError(Exception):
    """
    Base Exception for Lunch Money
    """

TransactionInsertObject #

Bases: TransactionBaseObject

Object For Creating New Transactions

https://lunchmoney.dev/#insert-transactions

Parameters:

Name Type Description Default
date date

Must be in ISO 8601 format (YYYY-MM-DD).

required
amount float

Numeric value of amount. i.e. $4.25 should be denoted as 4.25.

required
category_id int | None

Unique identifier for associated category_id. Category must be associated with the same account and must not be a category group.

None
payee str | None

Max 140 characters

None
currency str | None

Three-letter lowercase currency code in ISO 4217 format. The code sent must exist in our database. Defaults to user account's primary currency.

None
asset_id int | None

Unique identifier for associated asset (manually-managed account). Asset must be associated with the same account.

None
recurring_id int | None

Unique identifier for associated recurring expense. Recurring expense must be associated with the same account.

None
notes str | None

Max 350 characters

None
status StatusEnum | None

Must be either cleared or uncleared. If recurring_id is provided, the status will automatically be set to recurring or recurring_suggested depending on the type of recurring_id. Defaults to uncleared.

None
external_id str | None

User-defined external ID for transaction. Max 75 characters. External IDs must be unique within the same asset_id.

None
tags List[Union[str, int]] | None

Passing in a number will attempt to match by ID. If no matching tag ID is found, an error will be thrown. Passing in a string will attempt to match by string. If no matching tag name is found, a new tag will be created.

None
Source code in lunchable/models/transactions.py
class TransactionInsertObject(TransactionBaseObject):
    """
    Object For Creating New Transactions

    https://lunchmoney.dev/#insert-transactions
    """

    class StatusEnum(str, Enum):
        """
        Status Options, must be "cleared" or "uncleared"
        """

        cleared = "cleared"
        uncleared = "uncleared"

    date: datetime.date = Field(description=_TransactionInsertDescriptions.date)
    amount: float = Field(description=_TransactionInsertDescriptions.amount)
    category_id: Optional[int] = Field(
        None, description=_TransactionInsertDescriptions.category_id
    )
    payee: Optional[str] = Field(None, description="Max 140 characters", max_length=140)
    currency: Optional[str] = Field(
        None, description=_TransactionInsertDescriptions.currency, max_length=3
    )
    asset_id: Optional[int] = Field(
        None, description=_TransactionInsertDescriptions.asset_id
    )
    recurring_id: Optional[int] = Field(
        None, description=_TransactionInsertDescriptions.recurring_id
    )
    notes: Optional[str] = Field(None, description="Max 350 characters", max_length=350)
    status: Optional[StatusEnum] = Field(
        None, description=_TransactionInsertDescriptions.status
    )
    external_id: Optional[str] = Field(
        None, description=_TransactionInsertDescriptions.external_id, max_length=75
    )
    tags: Optional[List[Union[str, int]]] = Field(
        None, description=_TransactionInsertDescriptions.tags
    )

StatusEnum #

Bases: str, Enum

Status Options, must be "cleared" or "uncleared"

Source code in lunchable/models/transactions.py
class StatusEnum(str, Enum):
    """
    Status Options, must be "cleared" or "uncleared"
    """

    cleared = "cleared"
    uncleared = "uncleared"

TransactionSplitObject #

Bases: TransactionBaseObject

Object for Splitting Transactions

https://lunchmoney.dev/#split-object

Parameters:

Name Type Description Default
date date

Must be in ISO 8601 format (YYYY-MM-DD).

required
category_id int | None

Unique identifier for associated category_id. Category must be associated with the same account.

None
notes str | None

Transaction Split Notes.

None
amount float

Individual amount of split. Currency will inherit from parent transaction. All amounts must sum up to parent transaction amount.

required
Source code in lunchable/models/transactions.py
class TransactionSplitObject(TransactionBaseObject):
    """
    Object for Splitting Transactions

    https://lunchmoney.dev/#split-object
    """

    date: datetime.date = Field(description=_TransactionSplitDescriptions.date)
    category_id: Optional[int] = Field(
        default=None, description=_TransactionSplitDescriptions.category_id
    )
    notes: Optional[str] = Field(None, description=_TransactionSplitDescriptions.notes)
    amount: float = Field(description=_TransactionSplitDescriptions.amount)

TransactionUpdateObject #

Bases: TransactionBaseObject

Object For Updating Existing Transactions

https://lunchmoney.dev/#update-transaction

Parameters:

Name Type Description Default
date date | None

Must be in ISO 8601 format (YYYY-MM-DD).

None
category_id int | None

Unique identifier for associated category_id. Category must be associated with the same account and must not be a category group.

None
payee str | None

Max 140 characters

None
amount float | None

You may only update this if this transaction was not created from an automatic import, i.e. if this transaction is not associated with a plaid_account_id

None
currency str | None

You may only update this if this transaction was not created from an automatic import, i.e. if this transaction is not associated with a plaid_account_id. Defaults to user account's primary currency.

None
asset_id int | None

Unique identifier for associated asset (manually-managed account). Asset must be associated with the same account. You may only update this if this transaction was not created from an automatic import, i.e. if this transaction is not associated with a plaid_account_id

None
recurring_id int | None

Unique identifier for associated recurring expense. Recurring expense must be associated with the same account.

None
notes str | None

Max 350 characters

None
status StatusEnum | None

Must be either cleared or uncleared. Defaults to uncleared If recurring_id is provided, the status will automatically be set to recurring or recurring_suggested depending on the type of recurring_id. Defaults to uncleared.

None
external_id str | None

User-defined external ID for transaction. Max 75 characters. External IDs must be unique within the same asset_id. You may only update this if this transaction was not created from an automatic import, i.e. if this transaction is not associated with a plaid_account_id

None
tags List[Union[str, int]] | None

Passing in a number will attempt to match by ID. If no matching tag ID is found, an error will be thrown. Passing in a string will attempt to match by string. If no matching tag name is found, a new tag will be created.

None
Source code in lunchable/models/transactions.py
class TransactionUpdateObject(TransactionBaseObject):
    """
    Object For Updating Existing Transactions

    https://lunchmoney.dev/#update-transaction
    """

    class StatusEnum(str, Enum):
        """
        Status Options, must be "cleared" or "uncleared"
        """

        cleared = "cleared"
        uncleared = "uncleared"

    date: Optional[datetime.date] = Field(
        None, description=_TransactionUpdateDescriptions.date
    )
    category_id: Optional[int] = Field(
        None, description=_TransactionUpdateDescriptions.category_id
    )
    payee: Optional[str] = Field(None, description="Max 140 characters", max_length=140)
    amount: Optional[float] = Field(
        None, description=_TransactionUpdateDescriptions.amount
    )
    currency: Optional[str] = Field(
        None, description=_TransactionUpdateDescriptions.currency
    )
    asset_id: Optional[int] = Field(
        None, description=_TransactionUpdateDescriptions.asset_id
    )
    recurring_id: Optional[int] = Field(
        None, description=_TransactionUpdateDescriptions.recurring_id
    )
    notes: Optional[str] = Field(None, description="Max 350 characters", max_length=350)
    status: Optional[StatusEnum] = Field(
        None, description=_TransactionUpdateDescriptions.status
    )
    external_id: Optional[str] = Field(
        None, description=_TransactionUpdateDescriptions.external_id
    )
    tags: Optional[List[Union[int, str]]] = Field(
        None, description=_TransactionUpdateDescriptions.tags
    )

StatusEnum #

Bases: str, Enum

Status Options, must be "cleared" or "uncleared"

Source code in lunchable/models/transactions.py
class StatusEnum(str, Enum):
    """
    Status Options, must be "cleared" or "uncleared"
    """

    cleared = "cleared"
    uncleared = "uncleared"