Skip to main content

kobana finance financial-accounts

Commands of kobana finance financial-accounts. Every global option (Global options) applies here.

CommandHTTPDescription
financial-accounts balances latestGET /v1/financial-accounts/{id}/balances/latestLatest balance of every source
financial-accounts balances listGET /v1/financial-accounts/{id}/balancesList recorded balances of an account
financial-accounts balances createPOST /v1/financial-accounts/{id}/balancesRecord a balance
financial-accounts balances deleteDELETE /v1/financial-accounts/{id}/balances/{balanceId}Delete a recorded balance
financial-accounts listGET /v1/financial-accountsList financial accounts
financial-accounts createPOST /v1/financial-accountsCreate a financial account
financial-accounts getGET /v1/financial-accounts/{id}Get a financial account by id
financial-accounts updatePATCH /v1/financial-accounts/{id}Update a financial account
financial-accounts deleteDELETE /v1/financial-accounts/{id}Delete a financial account
financial-accounts adjust-balancePOST /v1/financial-accounts/{id}/adjust-balanceAdjust an account balance

financial-accounts balances latest​

Latest balance of every source

kobana finance financial-accounts balances latest [ID] [OPTIONS]

GET /v1/financial-accounts/{id}/balances/latest

Returns the most recent observation of each source in one call — what a source picker needs without one request per source. A source that never reported comes back with amount: null, which is deliberately different from a source that reported zero. calculated is always recomputed from the posted transactions rather than read from its stored snapshots, so it can never disagree with balance on the account detail. Requires scope finance/accounts with access level read.

Path arguments: id

Query parameters

NameTypeRequiredDescription
fieldsstringnoComma-separated top-level fields to return, e.g. fields=description,amount,due_date. Omit for every field. id is always included; naming an object field returns it whole. An unknown name is a 400 whose details lists unknown and available.

Headers

NameTypeRequiredDescription
X-Workspace-IdstringyesWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Responses

HTTPDescription
200One entry per source.
404Account not found within the tenant.

financial-accounts balances list​

List recorded balances of an account

kobana finance financial-accounts balances list [ID] [OPTIONS]

GET /v1/financial-accounts/{id}/balances

Returns a cursor-paginated page of the account's recorded balances, newest capture_date first. These are observations, not the computed balance — the transaction-derived number is balance on GET /financial-accounts/{id}. Each row carries the source that produced it, so a balance the bank reported and one a person typed stay distinguishable. Requires scope finance/accounts with access level read.

Path arguments: id

Query parameters

NameTypeRequiredDescription
sourcestringnoFilter by the channel that produced the observation. Accepts [in]=banking,manual. Values: calculated, banking, open_finance, manual, imported, api, mcp, cli.
capture_datestringnoFilter on the observation instant. Accepts the range operators [gte] / [lte] / [gt] / [lt].
external_idstringnoFilter by your own id for the observation. Accepts [in].
sort_bystringnoDefault capture_date. Values: capture_date, created_at, amount.
sort_orderstringnoDefault desc — the newest observation first. Values: asc, desc.
limitintegernoDefault 25.
cursorstringnoRound-trip meta.next_cursor from the previous response.
fieldsstringnoComma-separated top-level fields to return, e.g. fields=description,amount,due_date. Omit for every field. id is always included; naming an object field returns it whole. An unknown name is a 400 whose details lists unknown and available.

Headers

NameTypeRequiredDescription
X-Workspace-IdstringyesWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Responses

HTTPDescription
200Page of recorded balances plus pagination metadata.
400Malformed query (unknown filter / operator, invalid limit, bad cursor).
404Account not found within the tenant.

financial-accounts balances create​

Record a balance

kobana finance financial-accounts balances create [ID] [OPTIONS]

POST /v1/financial-accounts/{id}/balances

Records one observed balance for the account. This does NOT move money and creates no transaction — use POST /financial-accounts/{id}/adjust-balance when you want the ledger corrected. source defaults to api; narrow it to mcp or cli so the audit trail names the real channel. The sources the product produces itself (manual, banking, open_finance, calculated, imported) are refused (422). Re-sending the same external_id for the same account and source returns 409. The new row's id is the balanceId used by the delete. Requires scope finance/accounts with access level write; pass an X-Idempotency-Key header on retries.

Path arguments: id

Headers

NameTypeRequiredDescription
X-Workspace-IdstringyesWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Request body

NameTypeRequiredDescription
amountnumberyesBalance in BRL. Signed — an overdrawn account is negative.
capture_datestring (date-time)noInstant the balance refers to. Defaults to now.
sourcestringnoWhich client is recording this. Defaults to api; send mcp or cli so the audit trail names the real channel. manual, banking, calculated and imported are refused — each has a single producer inside the product and must not be forgeable from a request. Values: api, mcp, cli.
blocked_amountnumberno
automatically_invested_amountnumberno
external_idstringnoYour own id for this observation, unique per account and source.
tagsarray<string>no
notesstringno
custom_metadataobjectno

More fields and nested objects: kobana schema finance.financial-accounts.balances.create.

Responses

HTTPDescription
201Balance recorded. Location points at the new row.
400Malformed JSON body.
404Account not found within the tenant.
409X-Idempotency-Key reuse with a different body, or an external_id already used for this account and source.
422Validation failure, including a source the product produces itself.

financial-accounts balances delete​

Delete a recorded balance

kobana finance financial-accounts balances delete [ID] [BALANCEID] [OPTIONS]

DELETE /v1/financial-accounts/{id}/balances/{balanceId}

Removes one recorded balance. A banking or calculated row is refused (422): both are reproducible from their producer, so the delete would be undone by the next import or snapshot. Requires scope finance/accounts with access level delete.

Path arguments: id, balanceId

Headers

NameTypeRequiredDescription
X-Workspace-IdstringyesWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Responses

HTTPDescription
200Balance removed.
404Balance not found within the tenant.
422The row's source is reproducible and cannot be deleted.

financial-accounts list​

List financial accounts

kobana finance financial-accounts list [OPTIONS]

GET /v1/financial-accounts

Returns a cursor-paginated page of financial accounts for the workspace tied to the token's sub claim. Accounts may belong to a specific company or be workspace-level (company_id nullable). The current balance is NOT returned by this listing — the stored balance column is a write-only seed; the real balance is derived from the transactions ledger and will be available on the detail endpoint. Requires scope finance/accounts with access level read.

Query parameters

NameTypeRequiredDescription
company_idstringnoFilter by owning company UUID. Accepts [in]=uuid1,uuid2. Workspace-level accounts (company_id IS NULL) are returned only when this filter is omitted.
typestringnoAccount kind. Accepts [in]=checking,savings. Values: checking, savings, cash, investment, credit.
bank_idstringnoFilter by bank UUID. Accepts [in] for multi-bank lookups.
activestringnoFilter by active flag. Values: true, false.
namestringnoFilter by exact account name. Accepts [in].
sort_bystringnoField to order by. Default: sort_by=name&sort_order=asc. Values: created_at, name, type.
sort_orderstringnoOrder direction. Defaults to asc; ignored without sort_by. Values: asc, desc.
limitintegernoPage size. Default 25, max 100.
cursorstringnoOpaque cursor for the next page. Round-trip meta.next_cursor from the previous response.
fieldsstringnoComma-separated top-level fields to return, e.g. fields=description,amount,due_date. Omit for every field. id is always included; naming an object field returns it whole. An unknown name is a 400 whose details lists unknown and available.

Headers

NameTypeRequiredDescription
X-Workspace-IdstringyesWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Responses

HTTPDescription
200Page of accounts plus pagination metadata. No balance field by design.
400Malformed query (unknown filter / operator, invalid limit, bad cursor).

financial-accounts create​

Create a financial account

kobana finance financial-accounts create [OPTIONS]

POST /v1/financial-accounts

Creates a financial account. Requires scope finance/accounts with access level write. workspace_id is taken from the token. company_id is required (accounts must belong to a company; workspace-level accounts exist from imports but aren't creatable via v1). balance is an opening seed (default 0.00) — it is NOT the live balance (that is computed from transactions and returned on the detail endpoint) and cannot be updated. The bank may be given as bank_id (UUID) or bank_code (public COMPE/BACEN, e.g. 341) — not both (400); an unknown code → 422. The response echoes the resolved bank as bank: { code, name }. Pass an X-Idempotency-Key header on retries.

Headers

NameTypeRequiredDescription
X-Workspace-IdstringyesWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Request body

NameTypeRequiredDescription
company_idstring (uuid)yesOwning company UUID — required (financial accounts must belong to a company). Must belong to the tenant. Workspace-level accounts (company_id: null) exist from imports but are not creatable via v1.
namestringyes
typestringyesValues: checking, savings, cash, investment, credit.
bank_idstring (uuid)noReference to a banks row. null for cash / non-bank accounts.
bank_codestringnoAlternative to bank_id: the bank's public COMPE/BACEN code (e.g. 341), resolved to the catalog bank server-side. Mutually exclusive with bank_id — sending both returns 400; an unknown code returns 422.
agencystringno
agency_digitstringno
account_numberstringno
account_digitstringno
balancenumbernoOpening balance seed (signed number, up to 13 integer digits). Defaults to 0.00. NOT the live balance — that is computed from transactions.
disable_reconcilebooleanno
custom_metadataobjectnoMetadados do usuário: objeto JSON livre. Envie null para limpar. Máx. 64 KB serializado, 16 níveis.

More fields and nested objects: kobana schema finance.financial-accounts.create.

Responses

HTTPDescription
201Account created. The body is the detail shape (includes the computed balance).
400Malformed JSON body, or bank_id and bank_code sent together.
409X-Idempotency-Key reused with a different body.
422Schema validation failure, company_id not in the tenant, or unknown bank_code.

financial-accounts get​

Get a financial account by id

kobana finance financial-accounts get [ID] [OPTIONS]

GET /v1/financial-accounts/{id}

Returns the account plus the computed balance (live, derived from posted transactions — not the creation seed; #13). The listing still omits balance. Returns the same shape as the rows from the list endpoint. Requires scope finance/accounts with access level read. 404 covers both "doesn't exist" and "not in the tenant" — the API does not distinguish.

Path arguments: id

Query parameters

NameTypeRequiredDescription
fieldsstringnoComma-separated top-level fields to return, e.g. fields=description,amount,due_date. Omit for every field. id is always included; naming an object field returns it whole. An unknown name is a 400 whose details lists unknown and available.

Headers

NameTypeRequiredDescription
X-Workspace-IdstringyesWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Responses

HTTPDescription
200Get a financial account by id
404Account not found within the tenant.

financial-accounts update​

Update a financial account

kobana finance financial-accounts update [ID] [OPTIONS]

PATCH /v1/financial-accounts/{id}

Partial update. Requires scope finance/accounts with access level write. balance is never settable (the live balance is computed). Set active: false to soft-deactivate (existing transactions stay valid). The bank accepts bank_id or bank_code (not both → 400; unknown code → 422); the response echoes bank: { code, name }.

Path arguments: id

Headers

NameTypeRequiredDescription
X-Workspace-IdstringyesWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Request body

NameTypeRequiredDescription
company_idstring (uuid)noOwning company UUID — required (financial accounts must belong to a company). Must belong to the tenant. Workspace-level accounts (company_id: null) exist from imports but are not creatable via v1.
namestringno
typestringnoValues: checking, savings, cash, investment, credit.
bank_idstring (uuid)noReference to a banks row. null for cash / non-bank accounts.
bank_codestringnoAlternative to bank_id: the bank's public COMPE/BACEN code (e.g. 341), resolved to the catalog bank server-side. Mutually exclusive with bank_id — sending both returns 400; an unknown code returns 422.
agencystringno
agency_digitstringno
account_numberstringno
account_digitstringno
disable_reconcilebooleanno
custom_metadataobjectnoMetadados do usuário: objeto JSON livre. Envie null para limpar. Máx. 64 KB serializado, 16 níveis.
activebooleannoSet false to soft-deactivate (existing transactions stay valid).
custom_metadata_modestringnoComo o custom_metadata enviado é reconciliado com o valor armazenado: replace (padrão) substitui o objeto inteiro, merge faz deep merge sobre o valor atual. Aceito apenas na atualização. Values: replace, merge.

More fields and nested objects: kobana schema finance.financial-accounts.update.

Responses

HTTPDescription
200Updated account (detail shape with computed balance).
400Malformed JSON body, or bank_id and bank_code sent together.
404Account not found within the tenant.
409X-Idempotency-Key reused with a different body.
422Schema validation failure, company_id not in the tenant, or unknown bank_code.

financial-accounts delete​

Delete a financial account

kobana finance financial-accounts delete [ID] [OPTIONS]

DELETE /v1/financial-accounts/{id}

Deletes an account. Requires scope finance/accounts with access level delete. Returns 422 (reason: in_use, with a usage breakdown) when the account has any transaction, payable or receivable — deleting would cascade-delete its transactions, so soft-deactivate via PATCH { active: false } instead. Calling DELETE twice returns 200 then 404.

Path arguments: id

Headers

NameTypeRequiredDescription
X-Workspace-IdstringyesWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Responses

HTTPDescription
200Account deleted.
404Account not found within the tenant.
422The account is in use (reason: in_use).

financial-accounts adjust-balance​

Adjust an account balance

kobana finance financial-accounts adjust-balance [ID] [OPTIONS]

POST /v1/financial-accounts/{id}/adjust-balance

Corrects the account's calculated balance to target_balance by inserting an auto-created adjustment transaction for the signed diff. Requires scope finance/accounts with access level write. The category_id type must match the diff direction (credit for a positive diff, debit for negative) and its company must match the account's. A target equal to the current balance is rejected (422). Pass an X-Idempotency-Key header on retries.

Path arguments: id

Headers

NameTypeRequiredDescription
X-Workspace-IdstringyesWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Request body

NameTypeRequiredDescription
target_balancenumberyesThe balance the account should have after the adjustment. Signed number (up to 13 integer digits, 2 decimals).
category_idstring (uuid)yesCategory for the adjustment transaction. Its type must match the diff direction (credit for a positive diff, debit for negative) and its company must match the account's.
occurred_atstring (date-time)noWhen the adjustment transaction is dated (ISO 8601). Defaults to now.
descriptionstringnoOverrides the auto-created transaction description (default "Ajuste de saldo").

More fields and nested objects: kobana schema finance.financial-accounts.adjust-balance.

Responses

HTTPDescription
201Adjustment created. The Location header points at the auto-created adjustment transaction (GET /financial-transactions/{transaction_id}).
400Malformed JSON body.
404Account or category not found within the tenant.
409X-Idempotency-Key reuse with a different body.
422Validation failure: target equals current balance, account without a company, or a category of the wrong type/company.