All URIs are relative to https://api.ynab.com/v1
| Method | HTTP request | Description |
|---|---|---|
| create_account | POST /budgets/{plan_id}/accounts | Create an account |
| get_account_by_id | GET /budgets/{plan_id}/accounts/{account_id} | Get an account |
| get_accounts | GET /budgets/{plan_id}/accounts | Get all accounts |
AccountResponse create_account(plan_id, data)
Create an account
Creates a new account
- Bearer Authentication (bearer):
import ynab
from ynab.models.account_response import AccountResponse
from ynab.models.post_account_wrapper import PostAccountWrapper
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.AccountsApi(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)
data = ynab.PostAccountWrapper() # PostAccountWrapper | The account to create.
try:
# Create an account
api_response = api_instance.create_account(plan_id, data)
print("The response of AccountsApi->create_account:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling AccountsApi->create_account: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| plan_id | 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) | |
| data | PostAccountWrapper | The account to create. |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 201 | The account was successfully created | - |
| 400 | The request could not be understood due to malformed syntax or validation error(s). | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
AccountResponse get_account_by_id(plan_id, account_id)
Get an account
Returns a single account
- Bearer Authentication (bearer):
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"]
)
# 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.AccountsApi(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).
account_id = UUID('38400000-8cf0-11bd-b23e-10b96e4ef00d') # UUID | The id of the account
try:
# Get an account
api_response = api_instance.get_account_by_id(plan_id, account_id)
print("The response of AccountsApi->get_account_by_id:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling AccountsApi->get_account_by_id: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| plan_id | 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). | |
| account_id | UUID | The id of the account |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | The requested account | - |
| 404 | The requested account was not found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
AccountsResponse get_accounts(plan_id, last_knowledge_of_server=last_knowledge_of_server)
Get all accounts
Returns all accounts
- Bearer Authentication (bearer):
import ynab
from ynab.models.accounts_response import AccountsResponse
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.AccountsApi(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 accounts
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)| Name | Type | Description | Notes |
|---|---|---|---|
| plan_id | 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 | int | The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | The list of requested accounts | - |
| 404 | No accounts were found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]