Home
Softono
y

ynab

Professional software vendor delivering innovative solutions on the Softono platform. Specialized in both open-source and proprietary software development.

Total Products
3

Software by ynab

ynab-sdk-js
Open Source

ynab-sdk-js

# YNAB API JavaScript Library [![Build](https://github.com/ynab/ynab-sdk-js/actions/workflows/build-test.yml/badge.svg)](https://github.com/ynab/ynab-sdk-js/actions/workflows/build-test.yml) [![npm version](https://badge.fury.io/js/ynab.svg?icon=si%3Anpm)](https://badge.fury.io/js/ynab) Please read the [YNAB API documentation](https://api.ynab.com) for an overview of using the API and a complete list of available resources. This client is generated using the [OpenAPI Generator](https://openapi-generator.tech/). ## Installation First, install the module with npm: ```shell npm install ynab ``` Then, depending upon your usage context, add a reference to it: ### CommonJS / Node ``` const ynab = require("ynab"); ``` ### ESM / TypeScript ``` import * as ynab from "ynab"; ``` ### Browser The API supports [Cross Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) for asynchronous browser requests from any origin. The `dist/browser/ynab.js` file (located in node_modules/ynab after installation) is specifically built to run in a browser / window context and exports `ynab` variable to global namespace. No other dependencies are needed. ``` <script src="ynab.js" async></script> ... <script> // This assignment is not necessary but demonstrates that // once the library is loaded, the global 'ynab' object will be available. var ynab = window.ynab; </script> ``` #### CDN A simple way to load the library in a browser is by using the [unpkg](https://unpkg.com/) CDN, which is a "fast, global content delivery network for everything on npm". To use it, include a script tag like this in your file: ``` <script src="https://unpkg.com/ynab@latest/dist/browser/ynab.js" async></script> ``` Using the "latest" tag will result in a 302 redirect to the latest version tag so it is highly recommended to use a specific version tag such as https://unpkg.com/[email protected]/dist/browser/ynab.js to avoid this redirect. ## Usage To use this client, you must [obtain an access token](https://api.ynab.com/#authentication) from the [Account Settings](https://app.ynab.com/settings) area of the YNAB web application. ```typescript const ynab = require("ynab"); const accessToken = "b43439eaafe2_this_is_fake_b43439eaafe2"; const ynabAPI = new ynab.API(accessToken); (async function() { const plansResponse = await ynabAPI.plans.getPlans(); const plans = plansResponse.data.plans; for (let plan of plans) { console.log(`Plan Name: ${plan.name}`); } })(); ``` ### Error Handling If a response is returned with a code >= 300, instead of returning the response, the response will be thrown as an error to be caught. ```typescript const ynab = require("ynab"); const accessToken = "invalid_token"; const ynabAPI = new ynab.API(accessToken); const plansResponse = ynabAPI.plans .getPlans() .then(plansResponse => { // Won't get here because an error will be thrown }) .catch(e => { console.log(e); // { // error: { // id: "401", // name: "unauthorized", // detail: "Unauthorized" // } // } }); ``` ### Rate Limiting The API enforces [Rate Limiting](https://api.ynab.com/#rate-limiting). If the rate limit is exceeded, a `429` [Error Response](https://api.ynab.com/#errors) will be returned from the API which will result in an [error being thrown](https://github.com/ynab/ynab-sdk-js#error-handling) in this library. ## Examples See the [examples](https://github.com/ynab/ynab-sdk-js/tree/main/examples) folder for example usage scenarios. ## Methods The following methods are available in this library. | | Method | Description | |----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------| | **User** | [user.getUser()](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/UserApi.d.ts) | Returns authenticated user information | | **Plans** | [plans.getPlans()](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/PlansApi.d.ts) | Returns plans list with summary information | | | [plans.getPlanById(plan_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/PlansApi.d.ts) | Returns a single plan with all related entities | | | [plans.getPlanSettingsById(plan_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/PlansApi.d.ts) | Returns settings for a plan | | **Accounts** | [accounts.getAccounts(plan_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/AccountsApi.d.ts) | Returns all accounts | | | [accounts.getAccountById(plan_id, account_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/AccountsApi.d.ts) | Returns a single account | | | [accounts.createAccount(plan_id, data)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/AccountsApi.d.ts) | Creates a new account | | **Categories** | [categories.getCategories(plan_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/CategoriesApi.d.ts) | Returns all categories grouped by category group. | | | [categories.getCategoryById(plan_id, category_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/CategoriesApi.d.ts) | Returns a single category | | | [categories.getMonthCategoryById(plan_id, month, category_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/CategoriesApi.d.ts) | Returns a single category for a specific plan month | | | [categories.createCategory(plan_id, data)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/CategoriesApi.d.ts) | Creates a new category | | | [categories.updateCategory(plan_id, category_id, category)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/CategoriesApi.d.ts) | Update a category | | | [categories.updateMonthCategory(plan_id, month, category_id, month_category)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/CategoriesApi.d.ts) | Update a category for a specific month | | | [categories.createCategoryGroup(plan_id, data)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/CategoriesApi.d.ts) | Creates a new category group | | | [categories.updateCategoryGroup(plan_id, category_group_id, data)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/CategoriesApi.d.ts) | Update a category group | | **Payees** | [payees.getPayees(plan_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/PayeesApi.d.ts) | Returns all payees | | | [payees.getPayeeById(plan_id, payee_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/PayeesApi.d.ts) | Returns a single payee | | | [payees.createPayee(plan_id, data)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/PayeesApi.d.ts) | Creates a new payee | | | [payees.updatePayee(plan_id, payee_id, data)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/PayeesApi.d.ts) | Update a payee | | **Payee Locations** | [payee_locations.getPayeeLocations(plan_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/PayeeLocationsApi.d.ts) | Returns all payee locations | | | [payee_locations.getPayeeLocationById(plan_id, payee_location_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/PayeeLocationsApi.d.ts) | Returns a single payee location | | | [payee_locations.getPayeeLocationsByPayee(plan_id, payee_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/PayeeLocationsApi.d.ts) | Returns all payee locations for the specified payee | | **Months** | [months.getPlanMonths(plan_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/MonthsApi.d.ts) | Returns all plan months | | | [months.getPlanMonth(plan_id, month)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/MonthsApi.d.ts) | Returns a single plan month | | **Money Movements** | [money_movements.getMoneyMovements(plan_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/MoneyMovementsApi.d.ts) | Returns all money movements | | | [money_movements.getMoneyMovementsByMonth(plan_id, month)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/MoneyMovementsApi.d.ts) | Returns all money movements for a specific month | | | [money_movements.getMoneyMovementGroups(plan_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/MoneyMovementsApi.d.ts) | Returns all money movement groups | | | [money_movements.getMoneyMovementGroupsByMonth(plan_id, month)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/MoneyMovementsApi.d.ts) | Returns all money movement groups for a specific month| | **Transactions** | [transactions.getTransactions(plan_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Returns plan transactions, excluding any pending | | | [transactions.getTransactionsByAccount(plan_id, account_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Returns all transactions for a specified account | | | [transactions.getTransactionsByCategory(plan_id, category_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Returns all transactions for a specified category | | | [transactions.getTransactionsByPayee(plan_id, payee_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Returns all transactions for a specified payee | | | [transactions.getTransactionsByMonth(plan_id, month)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Returns all transactions for a specified month | | | [transactions.getTransactionById(plan_id, transaction_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Returns a single transaction | | | [transactions.createTransaction(plan_id, data)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Creates a single transaction or multiple transactions | | | [transactions.updateTransaction(plan_id, transaction_id, data)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Updates a single transaction | | | [transactions.updateTransactions(plan_id, data)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Updates multiple transactions | | | [transactions.deleteTransaction(plan_id, transaction_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Deletes a transaction | | | [transactions.importTransactions(plan_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Imports transactions | | **Scheduled Transactions** | [scheduled_transactions.getScheduledTransactions(plan_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/ScheduledTransactionsApi.d.ts) | Returns all scheduled transactions | | | [scheduled_transactions.getScheduledTransactionById(plan_id, scheduled_transaction_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/ScheduledTransactionsApi.d.ts) | Returns a single scheduled transaction | | | [scheduled_transactions.createScheduledTransaction(plan_id, data)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/ScheduledTransactionsApi.d.ts) | Creates a single scheduled transaction | | | [scheduled_transactions.updateScheduledTransaction(plan_id, scheduled_transaction_id, data)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/ScheduledTransactionsApi.d.ts) | Updates a single scheduled transaction | | | [scheduled_transactions.deleteScheduledTransaction(plan_id, scheduled_transaction_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/ScheduledTransactionsApi.d.ts) | Deletes a scheduled transaction | ### Utilities There are several utilities available on the `utils` export to make working with [ISO dates and milliunits](https://api.ynab.com/#formats) a bit easier. ```typescript // Returns the current month (system timezone) in ISO 8601 format (i.e. '2015-12-01') utils.getCurrentMonthInISOFormat(): string; // Returns the current date (system timezone) in ISO 8601 format (i.e. '2015-12-15') utils.getCurrentDateInISOFormat(): string; // Converts an ISO 8601 formatted string to a JS date object utils.convertFromISODateString(isoDateString: string): Date; // Converts a milliunits amount to a currency amount utils.convertMilliUnitsToCurrencyAmount(milliunits: number, currencyDecimalDigits: number): number; ``` ## Versioning The version of this client is defined in the `package.json` file and follows [semantic versioning](https://semver.org/). The version of this client is maintained independently and does not align with the the version of YNAB API itself (which is defined in the [OpenAPI spec](https://api.ynab.com/papi/open_api_spec.yaml)). To determine which spec version of the YNAB API was used when generating this client you can refer to the "description" field in the `package.json` file. ## License Copyright (c) 2022 YNAB Licensed under the Apache-2.0 license

Developer Tools Personal Finance API Tools
237 Github Stars
ynab-sdk-ruby
Open Source

ynab-sdk-ruby

# YNAB API Ruby Library [![Build](https://github.com/ynab/ynab-sdk-ruby/actions/workflows/build-test.yml/badge.svg)](https://github.com/ynab/ynab-sdk-ruby/actions/workflows/build-test.yml) [![Gem Version](https://badge.fury.io/rb/ynab.svg?icon=si%3Arubygems)](https://badge.fury.io/rb/ynab) This is the Ruby client for the YNAB API. Please read the [YNAB API documentation](https://api.ynab.com) for an overview of using the API and a complete list of available resources. This client is generated using the [OpenAPI Generator](https://openapi-generator.tech/). ## Installation ``` gem install ynab ``` Note: The current version of this gem requires Ruby version 3.3 or later. If you are using an older version of Ruby, you can install [version 2.1](https://rubygems.org/gems/ynab/versions/2.1.0) of this gem. ## Usage To use this client you must [obtain an access token](https://api.ynab.com/#authentication) from your [Account Settings](https://app.ynab.com/settings) page of the YNAB web app. ```ruby require 'ynab' access_token = ENV['YNAB_ACCESS_TOKEN'] ynab_api = YNAB::API.new(access_token) plan_response = ynab_api.plans.get_plans plans = plan_response.data.budgets plans.each do |plan| puts "Plan Name: #{plan.name}" end ``` ## Examples See the [examples folder](https://github.com/ynab/ynab-sdk-ruby/tree/master/examples) for example usage scenarios. ## Methods The following methods are available in this library. | | Method | Description | |----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------| | **User** | [user.get_user()](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/UserApi.md#get_user) | Returns authenticated user information | | **Plans** | [plans.get_plans()](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PlansApi.md#get_plans) | Returns plans list with summary information | | | [plans.get_plan_by_id(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PlansApi.md#get_plan_by_id) | Returns a single plan with all related entities | | | [plans.get_plan_settings_by_id(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PlansApi.md#get_plan_settings_by_id) | Returns settings for a plan | | **Accounts** | [accounts.get_accounts(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/AccountsApi.md#get_accounts) | Returns all accounts | | | [accounts.get_account_by_id(plan_id, account_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/AccountsApi.md#get_account_by_id) | Returns a single account | | | [accounts.create_account(plan_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/AccountsApi.md#create_account) | Creates a new account | | **Categories** | [categories.get_categories(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#get_categories) | Returns all categories grouped by category group | | | [categories.get_category_by_id(plan_id, category_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#get_category_by_id) | Returns a single category | | | [categories.get_month_category_by_id(plan_id, month, category_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#get_month_category_by_id) | Returns a single category for a specific plan month | | | [categories.create_category(plan_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#create_category) | Creates a new category | | | [categories.create_category_group(plan_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#create_category_group) | Creates a new category group | | | [categories.update_category(plan_id, category_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#update_category) | Updates a category | | | [categories.update_category_group(plan_id, category_group_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#update_category_group) | Updates a category group | | | [categories.update_month_category(plan_id, month, category_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#update_month_category) | Updates a category for a specific month | | **Payees** | [payees.get_payees(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PayeesApi.md#get_payees) | Returns all payees | | | [payees.get_payee_by_id(plan_id, payee_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PayeesApi.md#get_payee_by_id) | Returns a single payee | | | [payees.create_payee(plan_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PayeesApi.md#create_payee) | Creates a new payee | | | [payees.update_payee(plan_id, payee_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PayeesApi.md#update_payee) | Updates a payee | | **Payee Locations** | [payee_locations.get_payee_locations(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PayeeLocationsApi.md#get_payee_locations) | Returns all payee locations | | | [payee_locations.get_payee_location_by_id(plan_id, payee_location_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PayeeLocationsApi.md#get_payee_location_by_id) | Returns a single payee location | | | [payee_locations.get_payee_locations_by_payee(plan_id, payee_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PayeeLocationsApi.md#get_payee_locations_by_payee) | Returns all payee locations for the specified payee | | **Months** | [months.get_plan_months(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/MonthsApi.md#get_plan_months) | Returns all plan months | | | [months.get_plan_month(plan_id, month)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/MonthsApi.md#get_plan_month) | Returns a single plan month | | **Money Movements** | [money_movements.get_money_movements(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/MoneyMovementsApi.md#get_money_movements) | Returns all money movements | | | [money_movements.get_money_movements_by_month(plan_id, month)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/MoneyMovementsApi.md#get_money_movements_by_month) | Returns all money movements for a specific month | | | [money_movements.get_money_movement_groups(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/MoneyMovementsApi.md#get_money_movement_groups) | Returns all money movement groups | | | [money_movements.get_money_movement_groups_by_month(plan_id, month)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/MoneyMovementsApi.md#get_money_movement_groups_by_month) | Returns all money movement groups for a specific month| | **Transactions** | [transactions.get_transactions(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transactions) | Returns plan transactions | | | [transactions.get_transactions_by_account(plan_id, account_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transactions_by_account) | Returns all transactions for a specified account | | | [transactions.get_transactions_by_category(plan_id, category_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transactions_by_category) | Returns all transactions for a specified category | | | [transactions.get_transactions_by_payee(plan_id, payee_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transactions_by_payee) | Returns all transactions for a specified payee | | | [transactions.get_transactions_by_month(plan_id, month)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transactions_by_month) | Returns all transactions for a specified month | | | [transactions.get_transaction_by_id(plan_id, transaction_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transaction_by_id) | Returns a single transaction | | | [transactions.create_transaction(plan_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#create_transaction) | Creates a single transaction or multiple transactions | | | [transactions.update_transaction(plan_id, transaction_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#update_transaction) | Updates a single transaction | | | [transactions.update_transactions(plan_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#update_transactions) | Updates multiple transactions | | | [transactions.delete_transaction(plan_id, transaction_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#delete_transaction) | Deletes a single transaction | | | [transactions.import_transactions(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#import_transactions) | Imports transactions | | **Scheduled Transactions** | [scheduled_transactions.get_scheduled_transactions(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/ScheduledTransactionsApi.md#get_scheduled_transactions) | Returns all scheduled transactions | | | [scheduled_transactions.get_scheduled_transaction_by_id(plan_id, scheduled_transaction_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/ScheduledTransactionsApi.md#get_scheduled_transaction_by_id) | Returns a single scheduled transaction | | | [scheduled_transactions.create_scheduled_transaction(plan_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/ScheduledTransactionsApi.md#create_scheduled_transaction) | Creates a single scheduled transaction | | | [scheduled_transactions.update_scheduled_transaction(plan_id, scheduled_transaction_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/ScheduledTransactionsApi.md#update_scheduled_transaction) | Updates a single scheduled transaction | | | [scheduled_transactions.delete_scheduled_transaction(plan_id, scheduled_transaction_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/ScheduledTransactionsApi.md#delete_scheduled_transaction) | Deletes a single scheduled transaction | ## Versioning The version of this client is defined in the `ynab.gemspec` file and follows [semantic versioning](https://semver.org/). The version of this client is maintained independently and does not align with the the version of YNAB API itself (which is defined in the [OpenAPI spec](https://api.ynab.com/papi/open_api_spec.yaml)). To determine which spec version of the YNAB API was used when generating this client you can refer to the "description" in the field in the `ynab.gemspec` file. ## License Copyright (c) 2024 YNAB Licensed under the Apache-2.0 license

Developer Tools Budget & Expense Tracking API Tools
72 Github Stars
ynab-sdk-python
Open Source

ynab-sdk-python

# YNAB API Python Library [![Build](https://github.com/ynab/ynab-sdk-python/actions/workflows/build-test.yml/badge.svg)](https://github.com/ynab/ynab-sdk-python/actions/workflows/build-test.yml) [![PyPI version](https://badge.fury.io/py/ynab.svg?icon=si%3Apython)](https://badge.fury.io/py/ynab) This is the Python client for the YNAB API. Please read the [YNAB API documentation](https://api.ynab.com) for an overview of using the API and a complete list of available resources. This client is generated using the [OpenAPI Generator](https://openapi-generator.tech/). ## Requirements Python 3.8+ ## Installation First, install the package using pip: ```sh pip install ynab ``` Then import the package: ```python import ynab ``` ## Usage To use this client, you must [obtain an access token](https://api.ynab.com/#authentication) from the [Account Settings](https://app.ynab.com/settings) area of the YNAB web application. ```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) ``` ## Methods | Class | Method | Description | | ---------------------------- | ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | | **UserApi** | [**get_user**](docs/UserApi.md#get_user) | Get user | | **AccountsApi** | [**create_account**](docs/AccountsApi.md#create_account) | Create an account | | &nbsp; | [**get_account_by_id**](docs/AccountsApi.md#get_account_by_id) | Get an account | | &nbsp; | [**get_accounts**](docs/AccountsApi.md#get_accounts) | Get all accounts | | **PlansApi** | [**get_plan_by_id**](docs/PlansApi.md#get_plan_by_id) | Get a plan | | &nbsp; | [**get_plan_settings_by_id**](docs/PlansApi.md#get_plan_settings_by_id) | Get plan settings | | &nbsp; | [**get_plans**](docs/PlansApi.md#get_plans) | Get all plans | | **CategoriesApi** | [**create_category**](docs/CategoriesApi.md#create_category) | Create a category | | &nbsp; | [**create_category_group**](docs/CategoriesApi.md#create_category_group) | Create a category group | | &nbsp; | [**get_categories**](docs/CategoriesApi.md#get_categories) | Get all categories | | &nbsp; | [**get_category_by_id**](docs/CategoriesApi.md#get_category_by_id) | Get a category | | &nbsp; | [**get_month_category_by_id**](docs/CategoriesApi.md#get_month_category_by_id) | Get a category for a specific plan month | | &nbsp; | [**update_category**](docs/CategoriesApi.md#update_category) | Update a category | | &nbsp; | [**update_category_group**](docs/CategoriesApi.md#update_category_group) | Update a category group | | &nbsp; | [**update_month_category**](docs/CategoriesApi.md#update_month_category) | Update a category for a specific month | | **MonthsApi** | [**get_plan_month**](docs/MonthsApi.md#get_plan_month) | Get a plan month | | &nbsp; | [**get_plan_months**](docs/MonthsApi.md#get_plan_months) | Get all plan months | | **PayeeLocationsApi** | [**get_payee_location_by_id**](docs/PayeeLocationsApi.md#get_payee_location_by_id) | Get a payee location | | &nbsp; | [**get_payee_locations**](docs/PayeeLocationsApi.md#get_payee_locations) | Get all payee locations | | &nbsp; | [**get_payee_locations_by_payee**](docs/PayeeLocationsApi.md#get_payee_locations_by_payee) | Get all locations for a payee | | **PayeesApi** | [**create_payee**](docs/PayeesApi.md#create_payee) | Create a payee | | &nbsp; | [**get_payee_by_id**](docs/PayeesApi.md#get_payee_by_id) | Get a payee | | &nbsp; | [**get_payees**](docs/PayeesApi.md#get_payees) | Get all payees | | &nbsp; | [**update_payee**](docs/PayeesApi.md#update_payee) | Update a payee | | **MoneyMovementsApi** | [**get_money_movement_groups**](docs/MoneyMovementsApi.md#get_money_movement_groups) | Get all money movement groups | | &nbsp; | [**get_money_movement_groups_by_month**](docs/MoneyMovementsApi.md#get_money_movement_groups_by_month) | Get money movement groups for a plan month | | &nbsp; | [**get_money_movements**](docs/MoneyMovementsApi.md#get_money_movements) | Get all money movements | | &nbsp; | [**get_money_movements_by_month**](docs/MoneyMovementsApi.md#get_money_movements_by_month) | Get money movements for a plan month | | **TransactionsApi** | [**create_transaction**](docs/TransactionsApi.md#create_transaction) | Create a single transaction or multiple transactions | | &nbsp; | [**delete_transaction**](docs/TransactionsApi.md#delete_transaction) | Delete a transaction | | &nbsp; | [**get_transaction_by_id**](docs/TransactionsApi.md#get_transaction_by_id) | Get a transaction | | &nbsp; | [**get_transactions**](docs/TransactionsApi.md#get_transactions) | Get all transactions | | &nbsp; | [**get_transactions_by_account**](docs/TransactionsApi.md#get_transactions_by_account) | Get all account transactions | | &nbsp; | [**get_transactions_by_category**](docs/TransactionsApi.md#get_transactions_by_category) | Get all category transactions | | &nbsp; | [**get_transactions_by_month**](docs/TransactionsApi.md#get_transactions_by_month) | Get all plan month transactions | | &nbsp; | [**get_transactions_by_payee**](docs/TransactionsApi.md#get_transactions_by_payee) | Get all payee transactions | | &nbsp; | [**import_transactions**](docs/TransactionsApi.md#import_transactions) | Import transactions | | &nbsp; | [**update_transaction**](docs/TransactionsApi.md#update_transaction) | Update a transaction | | &nbsp; | [**update_transactions**](docs/TransactionsApi.md#update_transactions) | Update multiple transactions | | **ScheduledTransactionsApi** | [**create_scheduled_transaction**](docs/ScheduledTransactionsApi.md#create_scheduled_transaction) | Create a scheduled transaction | | &nbsp; | [**delete_scheduled_transaction**](docs/ScheduledTransactionsApi.md#delete_scheduled_transaction) | Delete a scheduled transaction | | &nbsp; | [**get_scheduled_transaction_by_id**](docs/ScheduledTransactionsApi.md#get_scheduled_transaction_by_id) | Get a scheduled transaction | | &nbsp; | [**get_scheduled_transactions**](docs/ScheduledTransactionsApi.md#get_scheduled_transactions) | Get all scheduled transactions | | &nbsp; | [**update_scheduled_transaction**](docs/ScheduledTransactionsApi.md#update_scheduled_transaction) | Update a scheduled transaction | ## Versioning The version of this client is defined in the `pyproject.toml` file and follows [semantic versioning](https://semver.org/). The version of this client is maintained independently and does not align with the the version of YNAB API itself (which is defined in the [OpenAPI spec](https://api.ynab.com/papi/open_api_spec.yaml)). To determine which spec version of the YNAB API was used when generating this client you can refer to the "description" field in the `pyproject.toml` file. ## License Copyright (c) 2025 YNAB Licensed under the Apache-2.0 license

Accounting Personal Finance API Tools
47 Github Stars