Skip to content
This repository has been archived by the owner on Aug 24, 2023. It is now read-only.

Latest commit

 

History

History
251 lines (214 loc) · 11.8 KB

client-methods.md

File metadata and controls

251 lines (214 loc) · 11.8 KB

Available client methods

This document describes all methods that are available on the YNAB Client object.

User

User info

Returns authenticated user information

public function getUser(): UserResponseInterface;

Returns an instance of UserResponseInterface.

Budgets

List budgets

Returns budgets list with summary information.

public function getBudgets(bool $includeAccounts = false): BudgetSummaryResponseInterface;

Returns an instance of BudgetSummaryResponseInterface.

Single budget

Returns a single budget with all related entities. This resource is effectively a full budget export.

public function getBudget(string $budgetId, ?int $lastKnowledgeOfServer = null): BudgetDetailResponseInterface;

Returns an instance of BudgetDetailResponseInterface.

Budget settings

Returns settings for a budget.

public function getBudgetSettings(string $budgetId): BudgetSettingsResponseInterface;

Returns an instance of BudgetSettingsResponseInterface.

Accounts

The accounts for a budget.

Account list

Returns all accounts.

public function getAccounts(string $budgetId, ?int $lastKnowledgeOfServer = null): AccountsResponseInterface;

Returns an instance of AccountsResponseInterface.

Create a new account

Creates a new account. Requires an instance of SaveAccount describing the account to create.

public function createAccount(string $budgetId, SaveAccount $account): AccountResponseInterface;

Returns an instance of AccountResponseInterface.

Single account

Returns a single account.

public function getAccount(string $budgetId, string $accountId): AccountResponseInterface;

Returns an instance of AccountResponseInterface.

Categories

The categories for a budget.

List categories

Returns all categories grouped by category group. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC).

public function getCategories(string $budgetId, ?int $lastKnowledgeOfServer = null): CategoriesResponseInterface;

Returns an instance of CategoriesResponseInterface.

Single category

Returns a single category. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC).

public function getCategory(string $budgetId, string $categoryId): CategoryResponseInterface;

Returns an instance of CategoryResponseInterface.

Single category for a specific budget month

Returns a single category for a specific budget month. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC).

public function getCategoryForMonth(string $budgetId, string $month, string $categoryId): CategoryResponseInterface;

Returns an instance of CategoryResponseInterface.

Update a category for a specific month

Update a category for a specific month. Only budgeted amount can be updated. Requires an instance of SaveMonthCategory describing the category to be updated.

public function updateCategoryForMonth(string $budgetId, string $month, string $categoryId, SaveMonthCategory $category): SaveCategoryResponseInterface;

Returns an instance of SaveCategoryResponseInterface.

Payees

The payees for a budget

List payees

Returns all payees.

public function getPayees(string $budgetId, ?int $lastKnowledgeOfServer = null): PayeesResponseInterface;

Returns an instance of PayeesResponseInterface.

Single payee

Returns a single payee.

public function getPayee(string $budgetId, string $payeeId): PayeeResponseInterface;

Returns an instance of PayeeResponseInterface.

Payee Locations

When you enter a transaction and specify a payee on the YNAB mobile apps, the GPS coordinates for that location are stored, with your permission, so that the next time you are in the same place (like the Grocery store) we can pre-populate nearby payees for you! It’s handy and saves you time. This resource makes these locations available. Locations will not be available for all payees.

List payee locations

Returns all payee locations.

public function getPayeeLocations(string $budgetId): PayeeLocationsResponseInterface;

Returns an instance of PayeeLocationsResponseInterface.

Single payee location

Returns a single payee location.

public function getPayeeLocation(string $budgetId, string $payeeLocationId): PayeeLocationResponseInterface;

Returns an instance of PayeeLocationResponseInterface.

List locations for a payee

Returns all payee locations for a specified payee.

public function getLocationsForPayee(string $budgetId, string $payeeId): PayeeLocationsResponseInterface;

Returns an instance of PayeeLocationResponseInterface.

Months

Each budget contains one or more months, which is where Ready to Assign, Age of Money and category (budgeted / activity / balances) amounts are available.

List budget months

Returns all budget months.

public function getMonths(string $budgetId, ?int $lastKnowledgeOfServer = null): MonthSummariesResponseInterface;

Returns an instance of MonthSummariesResponseInterface.

Single budget month

Returns a single budget month.

public function getMonth(string $budgetId, string $month): MonthDetailResponseInterface;

Returns an instance of MonthDetailResponseInterface.

Transactions

The transactions for a budget

List transactions

Returns budget transactions.

public function getTransactions(string $budgetId, ?string $sinceDate = null, ?string $type = null, ?int $lastKnowledgeOfServer = null): TransactionsResponseInterface;

Returns an instance of TransactionsResponseInterface.

Create a single transaction

Creates a single transaction. Scheduled transactions cannot be created on this endpoint. Requires an instance of SaveTransaction describing the transaction to create.

public function createTransaction(string $budgetId, SaveTransaction $transaction): SaveTransactionsResponseInterface;

Returns an instance of SaveTransactionsResponseInterface.

Create multiple transactions

Creates multiple transactions. Scheduled transactions cannot be created on this endpoint. Requires an array of instances of SaveTransaction describing the transactions to create.

public function createTransactions(string $budgetId, array $transactions): SaveTransactionsResponseInterface;

Returns an instance of SaveTransactionsResponseInterface.

Update multiple transactions

Updates multiple transactions, by id or import_id. Requires an array of instances of UpdateTransaction describing the transactions to update.

public function updateTransactions(string $budgetId, array $transactions): SaveTransactionsResponseInterface;

Returns an instance of SaveTransactionsResponseInterface.

Import transactions

Imports available transactions on all linked accounts for the given budget. Linked accounts allow transactions to be imported directly from a specified financial institution and this endpoint initiates that import. Sending a request to this endpoint is the equivalent of clicking “Import” on each account in the web application or tapping the “New Transactions” banner in the mobile applications. The response for this endpoint contains the transaction ids that have been imported.

public function importTransactions(string $budgetId): TransactionsImportResponseInterface;

Returns an instance of TransactionsImportResponseInterface.

Single transaction

Returns a single transaction.

public function getTransaction(string $budgetId, string $transactionId): TransactionResponseInterface;

Returns an instance of TransactionResponseInterface.

Update an existing transaction

Updates a single transaction. Requires an instance of SaveTransaction describing the transaction to update.

public function updateTransaction(string $budgetId, string $transactionId, SaveTransaction $transaction): TransactionResponseInterface;

Returns an instance of TransactionResponseInterface.

List account transactions

Returns all transactions for a specified account.

public function getAccountTransactions(string $budgetId, string $accountId, ?string $sinceDate = null, ?string $type = null, ?int $lastKnowledgeOfServer = null): TransactionsResponseInterface;

Returns an instance of TransactionsResponseInterface.

List category transactions

Returns all transactions for a specified category.

public function getCategoryTransactions(string $budgetId, string $categoryId, ?string $sinceDate = null, ?string $type = null, ?int $lastKnowledgeOfServer = null): HybridTransactionsResponseInterface;

Returns an instance of HybridTransactionsResponseInterface.

List payee transactions

Returns all transactions for a specified payee.

public function getPayeeTransactions(string $budgetId, string $payeeId, ?string $sinceDate = null, ?string $type = null, ?int $lastKnowledgeOfServer = null): HybridTransactionsResponseInterface;

Returns an instance of HybridTransactionsResponseInterface.

Scheduled transactions

The scheduled transactions for a budget

List scheduled transactions

Returns all scheduled transactions.

public function getScheduledTransactions(string $budgetId, ?int $lastKnowledgeOfServer = null): ScheduledTransactionsResponseInterface;

Returns an instance of ScheduledTransactionsResponseInterface.

Single scheduled transaction

Returns a single scheduled transaction.

public function getScheduledTransaction(string $budgetId, string $scheduledTransactionId): ScheduledTransactionResponseInterface;

Returns an instance of ScheduledTransactionResponseInterface.