### Install OpenAPI Generator Source: https://github.com/ynab/ynab-sdk-python/blob/main/DEVELOPMENT.md Installs the OpenAPI Generator tool, used for generating API client code. Example provided for macOS using Homebrew. ```bash brew install openapi-generator ``` -------------------------------- ### Account SDK Example (Python) Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/Account.md Example demonstrating how to use the YNAB Python SDK to create an Account instance from a JSON string, convert it to a dictionary, and create an instance from a dictionary. ```APIDOC ## Account SDK Example (Python) Example demonstrating how to use the YNAB Python SDK to create an Account instance from a JSON string, convert it to a dictionary, and create an instance from a dictionary. ```python from ynab.models.account import Account # TODO update the JSON string below json = "{}" # create an instance of Account from a JSON string account_instance = Account.from_json(json) # print the JSON string representation of the object print(Account.to_json()) # convert the object into a dict account_dict = account_instance.to_dict() # create an instance of Account from a dict account_from_dict = Account.from_dict(account_dict) ``` ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/ynab/ynab-sdk-python/blob/main/DEVELOPMENT.md Installs all necessary dependencies for the Ynab SDK Python project using Poetry. ```bash poetry install ``` -------------------------------- ### Install Poetry Source: https://github.com/ynab/ynab-sdk-python/blob/main/DEVELOPMENT.md Installs Poetry, a dependency management and packaging tool for Python. ```bash pipx install poetry ``` -------------------------------- ### Install YNAB Python Package Source: https://github.com/ynab/ynab-sdk-python/blob/main/README.md Install the YNAB Python client library using pip. Ensure you have Python 3.8+. ```sh pip install ynab ``` -------------------------------- ### BudgetDetailResponseData Usage Example Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/BudgetDetailResponseData.md Demonstrates how to create a BudgetDetailResponseData instance from a JSON string and a dictionary, and how to convert it back to a dictionary. Requires importing the BudgetDetailResponseData class. ```python from ynab.models.budget_detail_response_data import BudgetDetailResponseData # TODO update the JSON string below json = "{}" # create an instance of BudgetDetailResponseData from a JSON string budget_detail_response_data_instance = BudgetDetailResponseData.from_json(json) # print the JSON string representation of the object print(BudgetDetailResponseData.to_json()) # convert the object into a dict budget_detail_response_data_dict = budget_detail_response_data_instance.to_dict() # create an instance of BudgetDetailResponseData from a dict budget_detail_response_data_from_dict = BudgetDetailResponseData.from_dict(budget_detail_response_data_dict) ``` -------------------------------- ### Get All Accounts Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/AccountsApi.md This snippet demonstrates how to fetch all accounts for a given plan. It supports an optional `last_knowledge_of_server` parameter to retrieve only updated entities. ```python import ynab import os from ynab.rest import ApiException from pprint import pprint configuration = ynab.Configuration( host = "https://api.ynab.com/v1" ) configuration = ynab.Configuration( access_token = os.environ["BEARER_TOKEN"] ) with ynab.ApiClient(configuration) as api_client: api_instance = ynab.AccountsApi(api_client) plan_id = 'plan_id_example' last_knowledge_of_server = 56 try: api_response = api_instance.get_accounts(plan_id, last_knowledge_of_server=last_knowledge_of_server) print("The response of AccountsApi->get_accounts:\n") pprint(api_response) except Exception as e: print("Exception when calling AccountsApi->get_accounts: %s\n" % e) ``` -------------------------------- ### PostPayeeWrapper Usage Example Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PostPayeeWrapper.md Demonstrates how to create a PostPayeeWrapper instance from a JSON string and a dictionary, and how to convert it back to a dictionary. Requires the PostPayeeWrapper model to be imported. ```python from ynab.models.post_payee_wrapper import PostPayeeWrapper # TODO update the JSON string below json = "{}" # create an instance of PostPayeeWrapper from a JSON string post_payee_wrapper_instance = PostPayeeWrapper.from_json(json) # print the JSON string representation of the object print(PostPayeeWrapper.to_json()) # convert the object into a dict post_payee_wrapper_dict = post_payee_wrapper_instance.to_dict() # create an instance of PostPayeeWrapper from a dict post_payee_wrapper_from_dict = PostPayeeWrapper.from_dict(post_payee_wrapper_dict) ``` -------------------------------- ### PatchTransactionsWrapper Usage Example Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PatchTransactionsWrapper.md Demonstrates how to create, convert, and use PatchTransactionsWrapper instances from JSON and dictionary formats. Requires the PatchTransactionsWrapper model to be imported. ```python from ynab.models.patch_transactions_wrapper import PatchTransactionsWrapper # TODO update the JSON string below json = "{}" # create an instance of PatchTransactionsWrapper from a JSON string patch_transactions_wrapper_instance = PatchTransactionsWrapper.from_json(json) # print the JSON string representation of the object print(PatchTransactionsWrapper.to_json()) # convert the object into a dict patch_transactions_wrapper_dict = patch_transactions_wrapper_instance.to_dict() # create an instance of PatchTransactionsWrapper from a dict patch_transactions_wrapper_from_dict = PatchTransactionsWrapper.from_dict(patch_transactions_wrapper_dict) ``` -------------------------------- ### PatchPayeeWrapper Usage Example Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PatchPayeeWrapper.md Demonstrates how to create a PatchPayeeWrapper instance from a JSON string and a dictionary, and how to convert it back to a dictionary. Requires importing the PatchPayeeWrapper model. ```python from ynab.models.patch_payee_wrapper import PatchPayeeWrapper # TODO update the JSON string below json = "{}" # create an instance of PatchPayeeWrapper from a JSON string patch_payee_wrapper_instance = PatchPayeeWrapper.from_json(json) # print the JSON string representation of the object print(PatchPayeeWrapper.to_json()) # convert the object into a dict patch_payee_wrapper_dict = patch_payee_wrapper_instance.to_dict() # create an instance of PatchPayeeWrapper from a dict patch_payee_wrapper_from_dict = PatchPayeeWrapper.from_dict(patch_payee_wrapper_dict) ``` -------------------------------- ### Instantiate PlanSettings from JSON and Dictionary Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PlanSettings.md Demonstrates how to create a PlanSettings object from a JSON string and a dictionary. Also shows how to convert the object back to JSON and a dictionary. ```python from ynab.models.plan_settings import PlanSettings # TODO update the JSON string below json = "{}" # create an instance of PlanSettings from a JSON string plan_settings_instance = PlanSettings.from_json(json) # print the JSON string representation of the object print(PlanSettings.to_json()) # convert the object into a dict plan_settings_dict = plan_settings_instance.to_dict() # create an instance of PlanSettings from a dict plan_settings_from_dict = PlanSettings.from_dict(plan_settings_dict) ``` -------------------------------- ### Instantiate and Convert BudgetSettings Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/BudgetSettings.md Demonstrates how to create a BudgetSettings object from a JSON string, convert it to a dictionary, and then create a new object from that dictionary. Ensure the JSON string is valid and properly formatted. ```python from ynab.models.budget_settings import BudgetSettings # TODO update the JSON string below json = "{}" # create an instance of BudgetSettings from a JSON string budget_settings_instance = BudgetSettings.from_json(json) # print the JSON string representation of the object print(BudgetSettings.to_json()) # convert the object into a dict budget_settings_dict = budget_settings_instance.to_dict() # create an instance of BudgetSettings from a dict budget_settings_from_dict = BudgetSettings.from_dict(budget_settings_dict) ``` -------------------------------- ### Get All Categories with Bearer Authentication Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/CategoriesApi.md Retrieve all categories for a given plan, optionally filtering by server knowledge. This example uses bearer token authentication and demonstrates how to handle the response and exceptions. ```python import ynab import os from ynab.models.categories_response import CategoriesResponse from ynab.rest import ApiException from pprint import pprint # Defining the host is optional and defaults to https://api.ynab.com/v1 # See configuration.py for a list of all supported configuration parameters. configuration = ynab.Configuration( host = "https://api.ynab.com/v1" ) # The client must configure the authentication and authorization parameters # in accordance with the API server security policy. # Examples for each auth method are provided below, use the example that # satisfies your auth use case. # Configure Bearer authorization: bearer configuration = ynab.Configuration( access_token = os.environ["BEARER_TOKEN"] ) # Enter a context with an instance of the API client with ynab.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = ynab.CategoriesApi(api_client) plan_id = 'plan_id_example' # str | The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). last_knowledge_of_server = 56 # int | The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. (optional) try: # Get all categories api_response = api_instance.get_categories(plan_id, last_knowledge_of_server=last_knowledge_of_server) print("The response of CategoriesApi->get_categories:\n") pprint(api_response) except Exception as e: print("Exception when calling CategoriesApi->get_categories: %s\n" % e) ``` -------------------------------- ### PatchCategoryWrapper Usage Example Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PatchCategoryWrapper.md Demonstrates how to create a PatchCategoryWrapper instance from a JSON string, convert it to a dictionary, and create it from a dictionary. Requires importing the PatchCategoryWrapper model. ```python from ynab.models.patch_category_wrapper import PatchCategoryWrapper # TODO update the JSON string below json = "{}" # create an instance of PatchCategoryWrapper from a JSON string patch_category_wrapper_instance = PatchCategoryWrapper.from_json(json) # print the JSON string representation of the object print(PatchCategoryWrapper.to_json()) # convert the object into a dict patch_category_wrapper_dict = patch_category_wrapper_instance.to_dict() # create an instance of PatchCategoryWrapper from a dict patch_category_wrapper_from_dict = PatchCategoryWrapper.from_dict(patch_category_wrapper_dict) ``` -------------------------------- ### Instantiate and Convert BudgetSummary Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/BudgetSummary.md Demonstrates creating a BudgetSummary instance from a JSON string, converting it to a dictionary, and then creating a new instance from that dictionary. Requires importing the BudgetSummary model. ```python from ynab.models.budget_summary import BudgetSummary # TODO update the JSON string below json = "{}" # create an instance of BudgetSummary from a JSON string budget_summary_instance = BudgetSummary.from_json(json) # print the JSON string representation of the object print(BudgetSummary.to_json()) # convert the object into a dict budget_summary_dict = budget_summary_instance.to_dict() # create an instance of BudgetSummary from a dict budget_summary_from_dict = BudgetSummary.from_dict(budget_summary_dict) ``` -------------------------------- ### Get Account by ID - YNAB Python SDK Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/AccountsApi.md Retrieve a specific account by its ID within a given YNAB plan. This example demonstrates setting up the API client with Bearer authentication. ```python import ynab from ynab.models.account_response import AccountResponse from ynab.rest import ApiException from pprint import pprint # Defining the host is optional and defaults to https://api.ynab.com/v1 # See configuration.py for a list of all supported configuration parameters. configuration = ynab.Configuration( host = "https://api.ynab.com/v1" ) # The client must configure the authentication and authorization parameters # in accordance with the API server security policy. # Examples for each auth method are provided below, use the example that # satisfies your auth use case. # Configure Bearer authorization: bearer configuration = ynab.Configuration( access_token = os.environ["BEARER_TOKEN"] ) ``` -------------------------------- ### Get Transaction by ID with YNAB API Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/TransactionsApi.md Retrieves a single transaction by its ID. Requires the plan ID and transaction ID. This example sets up the API client and handles potential API exceptions. ```python import ynab from ynab.models.transaction_response import TransactionResponse from ynab.rest import ApiException from pprint import pprint # Defining the host is optional and defaults to https://api.ynab.com/v1 # See configuration.py for a list of all supported configuration parameters. configuration = ynab.Configuration( host = "https://api.ynab.com/v1" ) # The client must configure the authentication and authorization parameters # in accordance with the API server security policy. # Examples for each auth method are provided below, use the example that # satisfies your auth use case. # Configure Bearer authorization: bearer configuration = ynab.Configuration( access_token = os.environ["BEARER_TOKEN"] ) # Enter a context with an instance of the API client with ynab.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = ynab.TransactionsApi(api_client) plan_id = 'plan_id_example' # str | The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). transaction_id = 'transaction_id_example' # str | The id of the transaction try: # Get a transaction api_response = api_instance.get_transaction_by_id(plan_id, transaction_id) print("The response of TransactionsApi->get_transaction_by_id:\n") pprint(api_response) except ApiException as e: print("Exception when calling TransactionsApi->get_transaction_by_id: %s\n" % e) ``` -------------------------------- ### Python Example: Get Transactions by Month Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/TransactionsApi.md This Python snippet demonstrates how to authenticate using a Bearer token and retrieve transactions for a specific month using the YNAB SDK. It shows how to set up the API client, instantiate the TransactionsApi, and make the `get_transactions_by_month` call with various optional parameters. ```python import ynab from ynab.models.transactions_response import TransactionsResponse from ynab.rest import ApiException from pprint import pprint # Defining the host is optional and defaults to https://api.ynab.com/v1 # See configuration.py for a list of all supported configuration parameters. configuration = ynab.Configuration( host = "https://api.ynab.com/v1" ) # The client must configure the authentication and authorization parameters # in accordance with the API server security policy. # Examples for each auth method are provided below, use the example that # satisfies your auth use case. # Configure Bearer authorization: bearer configuration = ynab.Configuration( access_token = os.environ["BEARER_TOKEN"] ) # Enter a context with an instance of the API client with ynab.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = ynab.TransactionsApi(api_client) plan_id = 'plan_id_example' # str | The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). month = 'month_example' # str | The plan month in ISO format (e.g. 2016-12-01) ("current" can also be used to specify the current calendar month (UTC)) since_date = '2013-10-20' # date | If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). (optional) type = 'type_example' # str | If specified, only transactions of the specified type will be included. "uncategorized" and "unapproved" are currently supported. (optional) last_knowledge_of_server = 56 # int | The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. (optional) try: # Get all plan month transactions api_response = api_instance.get_transactions_by_month(plan_id, month, since_date=since_date, type=type, last_knowledge_of_server=last_knowledge_of_server) print("The response of TransactionsApi->get_transactions_by_month:\n") pprint(api_response) except Exception as e: print("Exception when calling TransactionsApi->get_transactions_by_month: %s\n" % e) ``` -------------------------------- ### Instantiate and Use PlanSettingsResponse Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PlanSettingsResponse.md Demonstrates how to create a PlanSettingsResponse object from a JSON string and convert it to a dictionary, and vice versa. Requires importing the PlanSettingsResponse model. ```python from ynab.models.plan_settings_response import PlanSettingsResponse # TODO update the JSON string below json = "{}" # create an instance of PlanSettingsResponse from a JSON string plan_settings_response_instance = PlanSettingsResponse.from_json(json) # print the JSON string representation of the object print(PlanSettingsResponse.to_json()) # convert the object into a dict plan_settings_response_dict = plan_settings_response_instance.to_dict() # create an instance of PlanSettingsResponse from a dict plan_settings_response_from_dict = PlanSettingsResponse.from_dict(plan_settings_response_dict) ``` -------------------------------- ### BudgetDetailResponse Instantiation and Conversion Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/BudgetDetailResponse.md Demonstrates how to create a BudgetDetailResponse instance from a JSON string or a dictionary, and how to convert it back to a dictionary or JSON string. Requires importing the BudgetDetailResponse model. ```python from ynab.models.budget_detail_response import BudgetDetailResponse # TODO update the JSON string below json = "{}" # create an instance of BudgetDetailResponse from a JSON string budget_detail_response_instance = BudgetDetailResponse.from_json(json) # print the JSON string representation of the object print(BudgetDetailResponse.to_json()) # convert the object into a dict budget_detail_response_dict = budget_detail_response_instance.to_dict() # create an instance of BudgetDetailResponse from a dict budget_detail_response_from_dict = BudgetDetailResponse.from_dict(budget_detail_response_dict) ``` -------------------------------- ### BudgetDetail Model Instantiation and Conversion Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/BudgetDetail.md Demonstrates how to create a BudgetDetail instance from a JSON string or a dictionary, and how to convert an instance to a JSON string or a dictionary. Ensure the JSON string is valid and properly formatted. ```python from ynab.models.budget_detail import BudgetDetail # TODO update the JSON string below json = "{}" # create an instance of BudgetDetail from a JSON string budget_detail_instance = BudgetDetail.from_json(json) # print the JSON string representation of the object print(BudgetDetail.to_json()) # convert the object into a dict budget_detail_dict = budget_detail_instance.to_dict() # create an instance of BudgetDetail from a dict budget_detail_from_dict = BudgetDetail.from_dict(budget_detail_dict) ``` -------------------------------- ### BudgetSettingsResponse Instantiation and Conversion Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/BudgetSettingsResponse.md Demonstrates how to create a BudgetSettingsResponse instance from a JSON string or a dictionary, and how to convert it back to JSON or a dictionary. Requires importing the BudgetSettingsResponse model. ```python from ynab.models.budget_settings_response import BudgetSettingsResponse # TODO update the JSON string below json = "{}" # create an instance of BudgetSettingsResponse from a JSON string budget_settings_response_instance = BudgetSettingsResponse.from_json(json) # print the JSON string representation of the object print(BudgetSettingsResponse.to_json()) # convert the object into a dict budget_settings_response_dict = budget_settings_response_instance.to_dict() # create an instance of BudgetSettingsResponse from a dict budget_settings_response_from_dict = BudgetSettingsResponse.from_dict(budget_settings_response_dict) ``` -------------------------------- ### Get All Payees Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PayeesApi.md Fetches a list of all payees for a given plan. Optionally, you can filter by `last_knowledge_of_server` to get only updated entities. ```python import ynab from ynab.models.payees_response import PayeesResponse from ynab.rest import ApiException from pprint import pprint import os # Defining the host is optional and defaults to https://api.ynab.com/v1 # See configuration.py for a list of all supported configuration parameters. configuration = ynab.Configuration( host = "https://api.ynab.com/v1" ) # The client must configure the authentication and authorization parameters # in accordance with the API server security policy. # Examples for each auth method are provided below, use the example that # satisfies your auth use case. # Configure Bearer authorization: bearer configuration = ynab.Configuration( access_token = os.environ["BEARER_TOKEN"] ) # Enter a context with an instance of the API client with ynab.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = ynab.PayeesApi(api_client) plan_id = 'plan_id_example' # str | The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). last_knowledge_of_server = 56 # int | The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. (optional) try: # Get all payees api_response = api_instance.get_payees(plan_id, last_knowledge_of_server=last_knowledge_of_server) print("The response of PayeesApi->get_payees:\n") pprint(api_response) except Exception as e: print("Exception when calling PayeesApi->get_payees: %s\n" % e) ``` -------------------------------- ### Instantiate and Convert User Model Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/User.md Demonstrates how to create a User instance from a JSON string, convert it to a dictionary, and create a new instance from that dictionary. Requires the User model import. ```python from ynab.models.user import User # TODO update the JSON string below json = "{}" # create an instance of User from a JSON string user_instance = User.from_json(json) # print the JSON string representation of the object print(User.to_json()) # convert the object into a dict user_dict = user_instance.to_dict() # create an instance of User from a dict user_from_dict = User.from_dict(user_dict) ``` -------------------------------- ### Get All Scheduled Transactions Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/ScheduledTransactionsApi.md Retrieves all scheduled transactions for a given plan. Optionally, you can filter by `last_knowledge_of_server` to get only updated entities. ```python import ynab from ynab.models.scheduled_transactions_response import ScheduledTransactionsResponse from ynab.rest import ApiException from pprint import pprint # Defining the host is optional and defaults to https://api.ynab.com/v1 # See configuration.py for a list of all supported configuration parameters. configuration = ynab.Configuration( host = "https://api.ynab.com/v1" ) # The client must configure the authentication and authorization parameters # in accordance with the API server security policy. # Examples for each auth method are provided below, use the example that # satisfies your auth use case. # Configure Bearer authorization: bearer configuration = ynab.Configuration( access_token = os.environ["BEARER_TOKEN"] ) # Enter a context with an instance of the API client with ynab.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = ynab.ScheduledTransactionsApi(api_client) plan_id = 'plan_id_example' # str | The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). last_knowledge_of_server = 56 # int | The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. (optional) try: # Get all scheduled transactions api_response = api_instance.get_scheduled_transactions(plan_id, last_knowledge_of_server=last_knowledge_of_server) print("The response of ScheduledTransactionsApi->get_scheduled_transactions:\n") pprint(api_response) except Exception as e: print("Exception when calling ScheduledTransactionsApi->get_scheduled_transactions: %s\n" % e) ``` -------------------------------- ### Instantiate and Convert PlanSettingsResponseData Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PlanSettingsResponseData.md Demonstrates how to create a PlanSettingsResponseData object from a JSON string and a dictionary, and how to convert it back to JSON and a dictionary. Assumes the JSON string is valid. ```python from ynab.models.plan_settings_response_data import PlanSettingsResponseData # TODO update the JSON string below json = "{}" # create an instance of PlanSettingsResponseData from a JSON string plan_settings_response_data_instance = PlanSettingsResponseData.from_json(json) # print the JSON string representation of the object print(PlanSettingsResponseData.to_json()) # convert the object into a dict plan_settings_response_data_dict = plan_settings_response_data_instance.to_dict() # create an instance of PlanSettingsResponseData from a dict plan_settings_response_data_from_dict = PlanSettingsResponseData.from_dict(plan_settings_response_data_dict) ``` -------------------------------- ### Get All Payees Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PayeesApi.md Retrieves a list of all payees associated with a plan. This endpoint is useful for getting an overview of all payees or for populating lists in an application. ```APIDOC ## GET /v1/plans/{plan_id}/payees ### Description Retrieves a list of all payees associated with a plan. ### Method GET ### Endpoint /v1/plans/{plan_id}/payees ### Parameters #### Path Parameters - **plan_id** (str) - Required - The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled. #### Query Parameters - **last_knowledge_of_server** (int) - Optional - The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. ### Response #### Success Response (200) - **data** (PayeesResponse) - The requested list of payees #### Response Example { "data": { "payees": [ { "id": "string", "name": "string", "transfer_account_id": "string", "deleted": false } ], "server_knowledge": 0 } } ``` -------------------------------- ### PayeeResponseData Usage Example Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PayeeResponseData.md Example of how to use the PayeeResponseData model in Python, including instantiation from JSON and dictionary, and conversion to JSON and dictionary. ```python from ynab.models.payee_response_data import PayeeResponseData # TODO update the JSON string below json_string = "{}" # create an instance of PayeeResponseData from a JSON string payee_response_data_instance = PayeeResponseData.from_json(json_string) # print the JSON string representation of the object print(PayeeResponseData.to_json()) # convert the object into a dict payee_response_data_dict = payee_response_data_instance.to_dict() # create an instance of PayeeResponseData from a dict payee_response_data_from_dict = PayeeResponseData.from_dict(payee_response_data_dict) ``` -------------------------------- ### Instantiate and Use PlanDetailResponse Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PlanDetailResponse.md Demonstrates how to create a PlanDetailResponse object from a JSON string, convert it to a dictionary, and then create a new object from that dictionary. Requires importing the PlanDetailResponse model. ```python from ynab.models.plan_detail_response import PlanDetailResponse # TODO update the JSON string below json = "{}" # create an instance of PlanDetailResponse from a JSON string plan_detail_response_instance = PlanDetailResponse.from_json(json) # print the JSON string representation of the object print(PlanDetailResponse.to_json()) # convert the object into a dict plan_detail_response_dict = plan_detail_response_instance.to_dict() # create an instance of PlanDetailResponse from a dict plan_detail_response_from_dict = PlanDetailResponse.from_dict(plan_detail_response_dict) ``` -------------------------------- ### CategoryBase Example Usage Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/CategoryBase.md Example of how to create and manipulate CategoryBase objects using the YNAB Python SDK, including converting from and to JSON and dictionaries. ```APIDOC ## Example Usage ```python from ynab.models.category_base import CategoryBase # TODO update the JSON string below with actual category data json_data = "{}" # Create an instance of CategoryBase from a JSON string category_base_instance = CategoryBase.from_json(json_data) # Print the JSON string representation of the object print(CategoryBase.to_json()) # Convert the object into a dictionary category_base_dict = category_base_instance.to_dict() print(category_base_dict) ``` ``` -------------------------------- ### Instantiate PlanSummaryResponse from JSON and Dictionary Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PlanSummaryResponse.md Demonstrates creating a PlanSummaryResponse object from a JSON string and a Python dictionary. Also shows how to convert the object back to JSON and a dictionary. ```python from ynab.models.plan_summary_response import PlanSummaryResponse # TODO update the JSON string below json = "{}" # create an instance of PlanSummaryResponse from a JSON string plan_summary_response_instance = PlanSummaryResponse.from_json(json) # print the JSON string representation of the object print(PlanSummaryResponse.to_json()) # convert the object into a dict plan_summary_response_dict = plan_summary_response_instance.to_dict() # create an instance of PlanSummaryResponse from a dict plan_summary_response_from_dict = PlanSummaryResponse.from_dict(plan_summary_response_dict) ``` -------------------------------- ### Instantiate and Convert BudgetSummaryResponseData Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/BudgetSummaryResponseData.md Demonstrates how to create a BudgetSummaryResponseData object from a JSON string, convert it to a dictionary, and then create a new object from that dictionary. Requires importing the BudgetSummaryResponseData model. ```python from ynab.models.budget_summary_response_data import BudgetSummaryResponseData # TODO update the JSON string below json = "{}" # create an instance of BudgetSummaryResponseData from a JSON string budget_summary_response_data_instance = BudgetSummaryResponseData.from_json(json) # print the JSON string representation of the object print(BudgetSummaryResponseData.to_json()) # convert the object into a dict budget_summary_response_data_dict = budget_summary_response_data_instance.to_dict() # create an instance of BudgetSummaryResponseData from a dict budget_summary_response_data_from_dict = BudgetSummaryResponseData.from_dict(budget_summary_response_data_dict) ``` -------------------------------- ### get_transactions Source: https://github.com/ynab/ynab-sdk-python/blob/main/README.md Get all transactions. ```APIDOC ## get_transactions ### Description Get all transactions. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters (Not specified in source) ### Request Example (Not specified in source) ### Response #### Success Response (200) (Not specified in source) #### Response Example (Not specified in source) ``` -------------------------------- ### PlanSummary Model Usage Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PlanSummary.md Demonstrates how to create a PlanSummary instance from a JSON string, convert it to a dictionary, and create an instance from a dictionary. Ensure the JSON string is valid. ```python from ynab.models.plan_summary import PlanSummary # TODO update the JSON string below json = "{}" # create an instance of PlanSummary from a JSON string plan_summary_instance = PlanSummary.from_json(json) # print the JSON string representation of the object print(PlanSummary.to_json()) # convert the object into a dict plan_summary_dict = plan_summary_instance.to_dict() # create an instance of PlanSummary from a dict plan_summary_from_dict = PlanSummary.from_dict(plan_summary_dict) ``` -------------------------------- ### get_transaction_by_id Source: https://github.com/ynab/ynab-sdk-python/blob/main/README.md Get a transaction. ```APIDOC ## get_transaction_by_id ### Description Get a transaction. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters (Not specified in source) ### Request Example (Not specified in source) ### Response #### Success Response (200) (Not specified in source) #### Response Example (Not specified in source) ``` -------------------------------- ### get_scheduled_transactions Source: https://github.com/ynab/ynab-sdk-python/blob/main/README.md Get all scheduled transactions. ```APIDOC ## get_scheduled_transactions ### Description Get all scheduled transactions. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters (Not specified in source) ### Request Example (Not specified in source) ### Response #### Success Response (200) (Not specified in source) #### Response Example (Not specified in source) ``` -------------------------------- ### Instantiate and Convert PayeeResponse Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PayeeResponse.md Demonstrates how to create a PayeeResponse object from a JSON string and a dictionary, and how to convert it back to a dictionary and JSON string. Requires importing the PayeeResponse model. ```python from ynab.models.payee_response import PayeeResponse # TODO update the JSON string below json = "{}" # create an instance of PayeeResponse from a JSON string payee_response_instance = PayeeResponse.from_json(json) # print the JSON string representation of the object print(PayeeResponse.to_json()) # convert the object into a dict payee_response_dict = payee_response_instance.to_dict() # create an instance of PayeeResponse from a dict payee_response_from_dict = PayeeResponse.from_dict(payee_response_dict) ``` -------------------------------- ### get_scheduled_transaction_by_id Source: https://github.com/ynab/ynab-sdk-python/blob/main/README.md Get a scheduled transaction. ```APIDOC ## get_scheduled_transaction_by_id ### Description Get a scheduled transaction. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters (Not specified in source) ### Request Example (Not specified in source) ### Response #### Success Response (200) (Not specified in source) #### Response Example (Not specified in source) ``` -------------------------------- ### Initialize YNAB API Client and Fetch Plans Source: https://github.com/ynab/ynab-sdk-python/blob/main/README.md Initialize the YNAB API client with an access token and fetch the list of plans. You need to obtain an access token from the YNAB website. ```python import ynab configuration = ynab.Configuration( access_token = "b43439eaafe2_this_is_fake_b43439eaafe2" ) with ynab.ApiClient(configuration) as api_client: plans_api = ynab.PlansApi(api_client) plans_response = plans_api.get_plans() plans = plans_response.data.plans for plan in plans: print(plan.name) ``` -------------------------------- ### get_transactions_by_payee Source: https://github.com/ynab/ynab-sdk-python/blob/main/README.md Get all payee transactions. ```APIDOC ## get_transactions_by_payee ### Description Get all payee transactions. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters (Not specified in source) ### Request Example (Not specified in source) ### Response #### Success Response (200) (Not specified in source) #### Response Example (Not specified in source) ``` -------------------------------- ### Instantiate and Use PlanDetailResponseData Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PlanDetailResponseData.md Demonstrates how to create a PlanDetailResponseData object from a JSON string and convert it to a dictionary, and vice-versa. Requires importing the PlanDetailResponseData class. ```python from ynab.models.plan_detail_response_data import PlanDetailResponseData # TODO update the JSON string below json = "{}" # create an instance of PlanDetailResponseData from a JSON string plan_detail_response_data_instance = PlanDetailResponseData.from_json(json) # print the JSON string representation of the object print(PlanDetailResponseData.to_json()) # convert the object into a dict plan_detail_response_data_dict = plan_detail_response_data_instance.to_dict() # create an instance of PlanDetailResponseData from a dict plan_detail_response_data_from_dict = PlanDetailResponseData.from_dict(plan_detail_response_data_dict) ``` -------------------------------- ### get_transactions_by_category Source: https://github.com/ynab/ynab-sdk-python/blob/main/README.md Get all category transactions. ```APIDOC ## get_transactions_by_category ### Description Get all category transactions. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters (Not specified in source) ### Request Example (Not specified in source) ### Response #### Success Response (200) (Not specified in source) #### Response Example (Not specified in source) ``` -------------------------------- ### get_transactions_by_account Source: https://github.com/ynab/ynab-sdk-python/blob/main/README.md Get all account transactions. ```APIDOC ## get_transactions_by_account ### Description Get all account transactions. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters (Not specified in source) ### Request Example (Not specified in source) ### Response #### Success Response (200) (Not specified in source) #### Response Example (Not specified in source) ``` -------------------------------- ### Instantiate and Convert MoneyMovementBase Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/MoneyMovementBase.md Demonstrates how to create a MoneyMovementBase object from a JSON string, convert it to a dictionary, and then create a new object from that dictionary. Requires importing the MoneyMovementBase class. ```python from ynab.models.money_movement_base import MoneyMovementBase # TODO update the JSON string below json = "{}" # create an instance of MoneyMovementBase from a JSON string money_movement_base_instance = MoneyMovementBase.from_json(json) # print the JSON string representation of the object print(MoneyMovementBase.to_json()) # convert the object into a dict money_movement_base_dict = money_movement_base_instance.to_dict() # create an instance of MoneyMovementBase from a dict money_movement_base_from_dict = MoneyMovementBase.from_dict(money_movement_base_dict) ``` -------------------------------- ### get_money_movements Source: https://github.com/ynab/ynab-sdk-python/blob/main/README.md Get all money movements. ```APIDOC ## get_money_movements ### Description Get all money movements. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters (Not specified in source) ### Request Example (Not specified in source) ### Response #### Success Response (200) (Not specified in source) #### Response Example (Not specified in source) ``` -------------------------------- ### PostTransactionsWrapper Usage Example Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PostTransactionsWrapper.md Demonstrates how to create a PostTransactionsWrapper instance from a JSON string and convert it to a dictionary. Also shows how to create an instance from a dictionary. Requires importing the PostTransactionsWrapper class. ```python from ynab.models.post_transactions_wrapper import PostTransactionsWrapper # TODO update the JSON string below json = "{}" # create an instance of PostTransactionsWrapper from a JSON string post_transactions_wrapper_instance = PostTransactionsWrapper.from_json(json) # print the JSON string representation of the object print(PostTransactionsWrapper.to_json()) # convert the object into a dict post_transactions_wrapper_dict = post_transactions_wrapper_instance.to_dict() # create an instance of PostTransactionsWrapper from a dict post_transactions_wrapper_from_dict = PostTransactionsWrapper.from_dict(post_transactions_wrapper_dict) ``` -------------------------------- ### get_scheduled_transaction_by_id Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/ScheduledTransactionsApi.md Get a scheduled transaction by its ID. ```APIDOC ## GET /plans/{plan_id}/scheduled_transactions/{scheduled_transaction_id} ### Description Get a scheduled transaction Get a scheduled transaction by its ID. ### Method GET ### Endpoint /plans/{plan_id}/scheduled_transactions/{scheduled_transaction_id} ### Parameters #### Path Parameters - **plan_id** (str) - Required - The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). - **scheduled_transaction_id** (str) - Required - The id of the scheduled transaction ### Response #### Success Response (200) - **ScheduledTransactionResponse** - The scheduled transaction was successfully retrieved ### Authorization [bearer](../README.md#bearer) ### HTTP request headers - **Accept**: application/json ``` -------------------------------- ### Instantiate and Convert UserResponseData Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/UserResponseData.md Demonstrates how to create a UserResponseData instance from a JSON string and a dictionary, and how to convert it back to JSON and a dictionary. Requires importing the UserResponseData model. ```python from ynab.models.user_response_data import UserResponseData # TODO update the JSON string below json = "{}" # create an instance of UserResponseData from a JSON string user_response_data_instance = UserResponseData.from_json(json) # print the JSON string representation of the object print(UserResponseData.to_json()) # convert the object into a dict user_response_data_dict = user_response_data_instance.to_dict() # create an instance of UserResponseData from a dict user_response_data_from_dict = UserResponseData.from_dict(user_response_data_dict) ``` -------------------------------- ### get_transactions_by_month Source: https://github.com/ynab/ynab-sdk-python/blob/main/README.md Get all plan month transactions. ```APIDOC ## get_transactions_by_month ### Description Get all plan month transactions. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters (Not specified in source) ### Request Example (Not specified in source) ### Response #### Success Response (200) (Not specified in source) #### Response Example (Not specified in source) ``` -------------------------------- ### Instantiate PayeeLocationsResponse from JSON Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PayeeLocationsResponse.md Demonstrates how to create a PayeeLocationsResponse object from a JSON string using the `from_json` class method. Also shows how to convert the object back to a dictionary and then instantiate from that dictionary. ```python from ynab.models.payee_locations_response import PayeeLocationsResponse # TODO update the JSON string below json = "{}" # create an instance of PayeeLocationsResponse from a JSON string payee_locations_response_instance = PayeeLocationsResponse.from_json(json) # print the JSON string representation of the object print(PayeeLocationsResponse.to_json()) # convert the object into a dict payee_locations_response_dict = payee_locations_response_instance.to_dict() # create an instance of PayeeLocationsResponse from a dict payee_locations_response_from_dict = PayeeLocationsResponse.from_dict(payee_locations_response_dict) ``` -------------------------------- ### Instantiate PlanDetail from JSON and Dictionary Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PlanDetail.md Demonstrates creating a PlanDetail object from a JSON string and converting it to a dictionary, and vice-versa. Requires the PlanDetail model to be imported. ```python from ynab.models.plan_detail import PlanDetail # TODO update the JSON string below json = "{}" # create an instance of PlanDetail from a JSON string plan_detail_instance = PlanDetail.from_json(json) # print the JSON string representation of the object print(PlanDetail.to_json()) # convert the object into a dict plan_detail_dict = plan_detail_instance.to_dict() # create an instance of PlanDetail from a dict plan_detail_from_dict = PlanDetail.from_dict(plan_detail_dict) ``` -------------------------------- ### get_money_movement_groups Source: https://github.com/ynab/ynab-sdk-python/blob/main/README.md Get all money movement groups. ```APIDOC ## get_money_movement_groups ### Description Get all money movement groups. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters (Not specified in source) ### Request Example (Not specified in source) ### Response #### Success Response (200) (Not specified in source) #### Response Example (Not specified in source) ``` -------------------------------- ### get_scheduled_transactions Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/ScheduledTransactionsApi.md Get all scheduled transactions for a given plan. ```APIDOC ## GET /plans/{plan_id}/scheduled_transactions ### Description Get all scheduled transactions Get all scheduled transactions for a given plan. ### Method GET ### Endpoint /plans/{plan_id}/scheduled_transactions ### Parameters #### Path Parameters - **plan_id** (str) - Required - The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). ### Response #### Success Response (200) - **ScheduledTransactionsResponse** - A list of scheduled transactions ### Authorization [bearer](../README.md#bearer) ### HTTP request headers - **Accept**: application/json ``` -------------------------------- ### Instantiate PayeesResponse from JSON and Dictionary Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/PayeesResponse.md Demonstrates creating a PayeesResponse object from a JSON string and a dictionary. Also shows how to convert the object back to JSON and a dictionary. ```python from ynab.models.payees_response import PayeesResponse # TODO update the JSON string below json = "{}" # create an instance of PayeesResponse from a JSON string payees_response_instance = PayeesResponse.from_json(json) # print the JSON string representation of the object print(PayeesResponse.to_json()) # convert the object into a dict payees_response_dict = payees_response_instance.to_dict() # create an instance of PayeesResponse from a dict payees_response_from_dict = PayeesResponse.from_dict(payees_response_dict) ``` -------------------------------- ### get_money_movements_by_month Source: https://github.com/ynab/ynab-sdk-python/blob/main/README.md Get money movements for a plan month. ```APIDOC ## get_money_movements_by_month ### Description Get money movements for a plan month. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters (Not specified in source) ### Request Example (Not specified in source) ### Response #### Success Response (200) (Not specified in source) #### Response Example (Not specified in source) ``` -------------------------------- ### BudgetSummaryResponse Instantiation and Conversion Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/BudgetSummaryResponse.md Demonstrates how to create a BudgetSummaryResponse object from a JSON string, convert it to a dictionary, and create it from a dictionary. Assumes the JSON string is valid. ```python from ynab.models.budget_summary_response import BudgetSummaryResponse # TODO update the JSON string below json = "{}" # create an instance of BudgetSummaryResponse from a JSON string budget_summary_response_instance = BudgetSummaryResponse.from_json(json) # print the JSON string representation of the object print(BudgetSummaryResponse.to_json()) # convert the object into a dict budget_summary_response_dict = budget_summary_response_instance.to_dict() # create an instance of BudgetSummaryResponse from a dict budget_summary_response_from_dict = BudgetSummaryResponse.from_dict(budget_summary_response_dict) ``` -------------------------------- ### get_money_movement_groups_by_month Source: https://github.com/ynab/ynab-sdk-python/blob/main/README.md Get money movement groups for a plan month. ```APIDOC ## get_money_movement_groups_by_month ### Description Get money movement groups for a plan month. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters (Not specified in source) ### Request Example (Not specified in source) ### Response #### Success Response (200) (Not specified in source) #### Response Example (Not specified in source) ``` -------------------------------- ### Import YNAB Python Package Source: https://github.com/ynab/ynab-sdk-python/blob/main/README.md Import the ynab package after installation. ```python import ynab ``` -------------------------------- ### Instantiate and Convert MonthDetailResponse Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/MonthDetailResponse.md Demonstrates how to create a MonthDetailResponse object from a JSON string, convert it to a dictionary, and then create a new object from that dictionary. Requires the MonthDetailResponse model to be imported. ```python from ynab.models.month_detail_response import MonthDetailResponse # TODO update the JSON string below json = "{}" # create an instance of MonthDetailResponse from a JSON string month_detail_response_instance = MonthDetailResponse.from_json(json) # print the JSON string representation of the object print(MonthDetailResponse.to_json()) # convert the object into a dict month_detail_response_dict = month_detail_response_instance.to_dict() # create an instance of MonthDetailResponse from a dict month_detail_response_from_dict = MonthDetailResponse.from_dict(month_detail_response_dict) ``` -------------------------------- ### get_user Source: https://github.com/ynab/ynab-sdk-python/blob/main/docs/UserApi.md Retrieves the authenticated user's information. This is a GET request to the /user endpoint. ```APIDOC ## GET /user ### Description Get user Returns authenticated user information ### Method GET ### Endpoint /user ### Parameters This endpoint does not need any parameter. ### Response #### Success Response (200) - **UserResponse** - The user info ### Response Example { "example": "response body" } ### Authorization bearer ### HTTP request headers - **Accept**: application/json ```