Saltar al contenido principal

kobana finance financial-accounts

Comandos de kobana finance financial-accounts. Toda opción global (Opciones globales) vale aquí.

ComandoHTTPDescripción
financial-accounts balances latestGET /v1/financial-accounts/{id}/balances/latestÚltimo saldo de cada origen
financial-accounts balances listGET /v1/financial-accounts/{id}/balancesListar saldos registrados de la cuenta
financial-accounts balances createPOST /v1/financial-accounts/{id}/balancesRegistrar un saldo
financial-accounts balances deleteDELETE /v1/financial-accounts/{id}/balances/{balanceId}Eliminar saldo registrado
financial-accounts listGET /v1/financial-accountsListar cuentas financieras
financial-accounts createPOST /v1/financial-accountsCrear cuenta financiera
financial-accounts getGET /v1/financial-accounts/{id}Obtener cuenta financiera por ID
financial-accounts updatePATCH /v1/financial-accounts/{id}Actualizar cuenta financiera
financial-accounts deleteDELETE /v1/financial-accounts/{id}Eliminar cuenta financiera
financial-accounts adjust-balancePOST /v1/financial-accounts/{id}/adjust-balanceAjustar saldo de la cuenta

financial-accounts balances latest​

Último saldo de cada origen

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

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.

Argumentos de la ruta: id

Parámetros de consulta

NombreTipoObligatorioDescripción
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.

Encabezados

NombreTipoObligatorioDescripción
X-Workspace-IdstringsíWorkspace 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).

Respuestas

HTTPDescripción
200One entry per source.
404Account not found within the tenant.

financial-accounts balances list​

Listar saldos registrados de la cuenta

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

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.

Argumentos de la ruta: id

Parámetros de consulta

NombreTipoObligatorioDescripción
sourcestringnoFilter by the channel that produced the observation. Accepts [in]=banking,manual. Valores: 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. Valores: capture_date, created_at, amount.
sort_orderstringnoDefault desc — the newest observation first. Valores: 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.

Encabezados

NombreTipoObligatorioDescripción
X-Workspace-IdstringsíWorkspace 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).

Respuestas

HTTPDescripción
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​

Registrar un saldo

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

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.

Argumentos de la ruta: id

Encabezados

NombreTipoObligatorioDescripción
X-Workspace-IdstringsíWorkspace 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).

Cuerpo de la solicitud

NombreTipoObligatorioDescripción
amountnumbersíBalance 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. Valores: 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

Otros campos y objetos anidados: kobana schema finance.financial-accounts.balances.create.

Respuestas

HTTPDescripción
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​

Eliminar saldo registrado

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

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.

Argumentos de la ruta: id, balanceId

Encabezados

NombreTipoObligatorioDescripción
X-Workspace-IdstringsíWorkspace 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).

Respuestas

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

financial-accounts list​

Listar cuentas financieras

kobana finance financial-accounts list [OPCIONES]

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.

Parámetros de consulta

NombreTipoObligatorioDescripción
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. Valores: checking, savings, cash, investment, credit.
bank_idstringnoFilter by bank UUID. Accepts [in] for multi-bank lookups.
activestringnoFilter by active flag. Valores: true, false.
namestringnoFilter by exact account name. Accepts [in].
sort_bystringnoField to order by. Default: sort_by=name&sort_order=asc. Valores: created_at, name, type.
sort_orderstringnoOrder direction. Defaults to asc; ignored without sort_by. Valores: 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.

Encabezados

NombreTipoObligatorioDescripción
X-Workspace-IdstringsíWorkspace 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).

Respuestas

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

financial-accounts create​

Crear cuenta financiera

kobana finance financial-accounts create [OPCIONES]

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.

Encabezados

NombreTipoObligatorioDescripción
X-Workspace-IdstringsíWorkspace 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).

Cuerpo de la solicitud

NombreTipoObligatorioDescripción
company_idstring (uuid)síOwning 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.
namestringsí
typestringsíValores: 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.

Otros campos y objetos anidados: kobana schema finance.financial-accounts.create.

Respuestas

HTTPDescripción
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​

Obtener cuenta financiera por ID

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

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.

Argumentos de la ruta: id

Parámetros de consulta

NombreTipoObligatorioDescripción
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.

Encabezados

NombreTipoObligatorioDescripción
X-Workspace-IdstringsíWorkspace 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).

Respuestas

HTTPDescripción
200Get a financial account by id
404Account not found within the tenant.

financial-accounts update​

Actualizar cuenta financiera

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

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 }.

Argumentos de la ruta: id

Encabezados

NombreTipoObligatorioDescripción
X-Workspace-IdstringsíWorkspace 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).

Cuerpo de la solicitud

NombreTipoObligatorioDescripción
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
typestringnoValores: 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. Valores: replace, merge.

Otros campos y objetos anidados: kobana schema finance.financial-accounts.update.

Respuestas

HTTPDescripción
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​

Eliminar cuenta financiera

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

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.

Argumentos de la ruta: id

Encabezados

NombreTipoObligatorioDescripción
X-Workspace-IdstringsíWorkspace 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).

Respuestas

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

financial-accounts adjust-balance​

Ajustar saldo de la cuenta

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

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.

Argumentos de la ruta: id

Encabezados

NombreTipoObligatorioDescripción
X-Workspace-IdstringsíWorkspace 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).

Cuerpo de la solicitud

NombreTipoObligatorioDescripción
target_balancenumbersíThe balance the account should have after the adjustment. Signed number (up to 13 integer digits, 2 decimals).
category_idstring (uuid)síCategory 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").

Otros campos y objetos anidados: kobana schema finance.financial-accounts.adjust-balance.

Respuestas

HTTPDescripción
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.