Create an account
const url = 'https://example.com/api/v1/money/budgets/example/accounts';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"kind":"example","name":"example","opening_balance":1,"opening_date":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/money/budgets/example/accounts \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "kind": "example", "name": "example", "opening_balance": 1, "opening_date": "example" }'Add a cash, card, or tracking account to a budget. An opening balance needs an opening date. A card account also adds its payment Category. The response lists the accounts. Route: /api/v1/money/budgets/{budget_id}/accounts. Inputs: budget_id. Do not automatically replay this operation after an uncertain result.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Budget ID
Request Bodyrequired
Section titled “Request Bodyrequired”Create an account (and, for a Card account, its payment Category).
object
cash, card or tracking.
Display name.
Opening balance in minor units (a Card account’s debt is negative).
Date of the opening balance YYYY-MM-DD (required with a balance).
Examplegenerated
{ "kind": "example", "name": "example", "opening_balance": 1, "opening_date": "example"}Responses
Section titled “Responses”The account list with the new account
Accounts of a budget with totals.
object
Accounts in file order.
One account with its balances in budget minor units.
object
Balance of every recorded row.
Balance of cleared rows.
Closed accounts remain available through history and deep links (#1130).
Account currency.
For a Card account: debt its payment reserve does not cover.
Account ID.
cash, card or tracking.
Display name.
False for Tracking accounts.
For a Card account: its payment Category.
Balance of uncleared rows.
Budget ID.
Budget currency.
Sum of on-budget balances.
Decimal places of currency.
Sum of tracking balances.
Examplegenerated
{ "accounts": [ { "balance": 1, "cleared_balance": 1, "closed": true, "currency": "example", "debt_not_covered": 1, "id": "example", "kind": "example", "name": "example", "on_budget": true, "payment_category_id": "example", "uncleared_balance": 1 } ], "budget_id": "example", "currency": "example", "on_budget_total": 1, "scale": 1, "tracking_total": 1}The standard API error response: { "error": { ... } }.
object
Example
{ "error": { "code": "bad_request" }}The standard API error response: { "error": { ... } }.
object
Example
{ "error": { "code": "bad_request" }}The standard API error response: { "error": { ... } }.
object
Example
{ "error": { "code": "bad_request" }}