Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 2.0.3
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
Python >= 3.6
Install from source via:
pip install git+https://github.com/dmlerner/ynab-api.git
(you may need to run pip
with root permission: sudo pip install git+https://github.com/dmlerner/ynab-api.git
)
OR from pypi via:
pip install ynab_api
Then import the package:
import ynab_api
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import ynab_api
Please follow the installation procedure and then run the following:
import time
import ynab_api
from pprint import pprint
from ynab_api.api import accounts_api
from ynab_api.model.account_response import AccountResponse
from ynab_api.model.accounts_response import AccountsResponse
from ynab_api.model.error_response import ErrorResponse
from ynab_api.model.save_account_wrapper import SaveAccountWrapper
# Defining the host is optional and defaults to https://api.youneedabudget.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = ynab_api.Configuration(
host = "https://api.youneedabudget.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 API key authorization: bearer
configuration.api_key['bearer'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['bearer'] = 'Bearer'
# Enter a context with an instance of the API client
with ynab_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = accounts_api.AccountsApi(api_client)
budget_id = "budget_id_example" # str, none_type | The id of the budget (\"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.youneedabudget.com/#oauth-default-budget)
data = SaveAccountWrapper(
account=SaveAccount(
name="name_example",
type="checking",
balance=1,
),
) # SaveAccountWrapper | The account to create.
try:
# Create a new account
api_response = api_instance.create_account(budget_id, data)
pprint(api_response)
except ynab_api.ApiException as e:
print("Exception when calling AccountsApi->create_account: %s\n" % e)
All URIs are relative to https://api.youneedabudget.com/v1
Class | Method | HTTP request | Description |
---|---|---|---|
AccountsApi | create_account | POST /budgets/{budget_id}/accounts | Create a new account |
AccountsApi | get_account_by_id | GET /budgets/{budget_id}/accounts/{account_id} | Single account |
AccountsApi | get_accounts | GET /budgets/{budget_id}/accounts | Account list |
BudgetsApi | get_budget_by_id | GET /budgets/{budget_id} | Single budget |
BudgetsApi | get_budget_settings_by_id | GET /budgets/{budget_id}/settings | Budget Settings |
BudgetsApi | get_budgets | GET /budgets | List budgets |
CategoriesApi | get_categories | GET /budgets/{budget_id}/categories | List categories |
CategoriesApi | get_category_by_id | GET /budgets/{budget_id}/categories/{category_id} | Single category |
CategoriesApi | get_month_category_by_id | GET /budgets/{budget_id}/months/{month}/categories/{category_id} | Single category for a specific budget month |
CategoriesApi | update_month_category | PATCH /budgets/{budget_id}/months/{month}/categories/{category_id} | Update a category for a specific month |
DeprecatedApi | bulk_create_transactions | POST /budgets/{budget_id}/transactions/bulk | Bulk create transactions |
MonthsApi | get_budget_month | GET /budgets/{budget_id}/months/{month} | Single budget month |
MonthsApi | get_budget_months | GET /budgets/{budget_id}/months | List budget months |
PayeeLocationsApi | get_payee_location_by_id | GET /budgets/{budget_id}/payee_locations/{payee_location_id} | Single payee location |
PayeeLocationsApi | get_payee_locations | GET /budgets/{budget_id}/payee_locations | List payee locations |
PayeeLocationsApi | get_payee_locations_by_payee | GET /budgets/{budget_id}/payees/{payee_id}/payee_locations | List locations for a payee |
PayeesApi | get_payee_by_id | GET /budgets/{budget_id}/payees/{payee_id} | Single payee |
PayeesApi | get_payees | GET /budgets/{budget_id}/payees | List payees |
ScheduledTransactionsApi | get_scheduled_transaction_by_id | GET /budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id} | Single scheduled transaction |
ScheduledTransactionsApi | get_scheduled_transactions | GET /budgets/{budget_id}/scheduled_transactions | List scheduled transactions |
TransactionsApi | create_transaction | POST /budgets/{budget_id}/transactions | Create a single transaction or multiple transactions |
TransactionsApi | get_transaction_by_id | GET /budgets/{budget_id}/transactions/{transaction_id} | Single transaction |
TransactionsApi | get_transactions | GET /budgets/{budget_id}/transactions | List transactions |
TransactionsApi | get_transactions_by_account | GET /budgets/{budget_id}/accounts/{account_id}/transactions | List account transactions |
TransactionsApi | get_transactions_by_category | GET /budgets/{budget_id}/categories/{category_id}/transactions | List category transactions |
TransactionsApi | get_transactions_by_payee | GET /budgets/{budget_id}/payees/{payee_id}/transactions | List payee transactions |
TransactionsApi | import_transactions | POST /budgets/{budget_id}/transactions/import | Import transactions |
TransactionsApi | update_transaction | PUT /budgets/{budget_id}/transactions/{transaction_id} | Updates an existing transaction |
TransactionsApi | update_transactions | PATCH /budgets/{budget_id}/transactions | Update multiple transactions |
UserApi | get_user | GET /user | User info |
- Account
- AccountResponse
- AccountResponseData
- AccountsResponse
- AccountsResponseData
- BudgetDetail
- BudgetDetailAllOf
- BudgetDetailResponse
- BudgetDetailResponseData
- BudgetSettings
- BudgetSettingsResponse
- BudgetSettingsResponseData
- BudgetSummary
- BudgetSummaryResponse
- BudgetSummaryResponseData
- BulkResponse
- BulkResponseData
- BulkResponseDataBulk
- BulkTransactions
- CategoriesResponse
- CategoriesResponseData
- Category
- CategoryGroup
- CategoryGroupWithCategories
- CategoryGroupWithCategoriesAllOf
- CategoryResponse
- CategoryResponseData
- CurrencyFormat
- DateFormat
- ErrorDetail
- ErrorResponse
- HybridTransaction
- HybridTransactionAllOf
- HybridTransactionsResponse
- HybridTransactionsResponseData
- MonthDetail
- MonthDetailAllOf
- MonthDetailResponse
- MonthDetailResponseData
- MonthSummariesResponse
- MonthSummariesResponseData
- MonthSummary
- Payee
- PayeeLocation
- PayeeLocationResponse
- PayeeLocationResponseData
- PayeeLocationsResponse
- PayeeLocationsResponseData
- PayeeResponse
- PayeeResponseData
- PayeesResponse
- PayeesResponseData
- SaveAccount
- SaveAccountWrapper
- SaveCategoryResponse
- SaveCategoryResponseData
- SaveMonthCategory
- SaveMonthCategoryWrapper
- SaveSubTransaction
- SaveTransaction
- SaveTransactionWrapper
- SaveTransactionsResponse
- SaveTransactionsResponseData
- SaveTransactionsWrapper
- ScheduledSubTransaction
- ScheduledTransactionDetail
- ScheduledTransactionDetailAllOf
- ScheduledTransactionResponse
- ScheduledTransactionResponseData
- ScheduledTransactionSummary
- ScheduledTransactionsResponse
- ScheduledTransactionsResponseData
- SubTransaction
- TransactionDetail
- TransactionDetailAllOf
- TransactionResponse
- TransactionResponseData
- TransactionSummary
- TransactionsImportResponse
- TransactionsImportResponseData
- TransactionsResponse
- TransactionsResponseData
- UpdateTransaction
- UpdateTransactionAllOf
- UpdateTransactionsWrapper
- User
- UserResponse
- UserResponseData
- Type: API key
- API key parameter name: Authorization
- Location: HTTP header
If the OpenAPI document is large, imports in ynab_api.apis and ynab_api.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:
Solution 1: Use specific imports for apis and models like:
from ynab_api.api.default_api import DefaultApi
from ynab_api.model.pet import Pet
Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:
import sys
sys.setrecursionlimit(1500)
import ynab_api
from ynab_api.apis import *
from ynab_api.models import *