Pular para o conteúdo principal

kobana finance automatic-rules

Comandos de kobana finance automatic-rules. Toda opção global (Opções globais) vale aqui.

ComandoHTTPDescrição
automatic-rules listGET /v1/automatic-rulesListar regras automáticas
automatic-rules createPOST /v1/automatic-rulesCriar regra automática
automatic-rules reorderPOST /v1/automatic-rules/reorderReordenar regras automáticas
automatic-rules getGET /v1/automatic-rules/{id}Obter regra automática por ID
automatic-rules updatePATCH /v1/automatic-rules/{id}Atualizar regra automática
automatic-rules deleteDELETE /v1/automatic-rules/{id}Excluir regra automática

automatic-rules list​

Listar regras automáticas

kobana finance automatic-rules list [OPÇÕES]

GET /v1/automatic-rules

Returns a cursor-paginated page of automatic (classification) rules for the workspace tied to the token's sub claim. Rules fire on freshly-created transactions/billings, first-match-wins within (company, scope, position). Default order is the evaluation order (company, scope, position). Requires scope finance/automatic_rules with access level read.

Parâmetros de consulta

NomeTipoObrigatórioDescrição
company_idstringnãoFilter by owning company UUID. Accepts [in]=uuid1,uuid2 for OR matching.
scopestringnãoFilter by target ledger: transactions or billings. Valores: transactions, billings.
activebooleannãoFilter by active flag. ?active=true or ?active=false.
sort_bystringnãoField to order by. Default: (company, scope, position) ascending — the evaluation order. Valores: created_at, position.
sort_orderstringnãoOrder direction. Defaults to asc; ignored without sort_by. Valores: asc, desc.
limitintegernãoPage size. Default 25, max 100.
cursorstringnãoOpaque cursor for the next page. Round-trip meta.next_cursor from the previous response.
fieldsstringnãoComma-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.

Cabeçalhos

NomeTipoObrigatórioDescrição
X-Workspace-IdstringsimWorkspace 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).

Respostas

HTTPDescrição
200Page of rules plus pagination metadata.
400Malformed query (unknown filter / operator, invalid limit, bad cursor).

automatic-rules create​

Criar regra automática

kobana finance automatic-rules create [OPÇÕES]

POST /v1/automatic-rules

Creates a rule and appends it at the end of its (company, scope) group (position = next). Requires scope finance/automatic_rules with access level write. workspace_id comes from the token. A rule needs at least one criterion and at least one action; account_id is only valid for scope=transactions and set_expected_account_id only for scope=billings. Pass an X-Idempotency-Key header on retries.

Cabeçalhos

NomeTipoObrigatórioDescrição
X-Workspace-IdstringsimWorkspace 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).

Corpo da requisição

NomeTipoObrigatórioDescrição
company_idstring (uuid)simOwning company UUID. Must belong to the tenant.
scopestringsimTarget ledger. Immutable after create. Valores: transactions, billings.
activebooleannãoDefaults to true.
account_idstring (uuid)nãoCriterion — financial account. Only valid for scope=transactions (422 otherwise).
transaction_typestringnãoValores: debit, credit, null.
match_person_idstring (uuid)não
description_containsstringnãoCase-insensitive substring on description. "" opts into a wildcard (matches every row).
notes_containsstringnão
set_descriptionstringnão
set_person_idstring (uuid)não
set_category_idstring (uuid)não
set_classification_center_idstring (uuid)nãoAction — classification center. Maps to the internal cost-center column.
set_expected_account_idstring (uuid)nãoAction — expected settlement account. Only valid for scope=billings (422 otherwise).
custom_metadataobjectnãoMetadados do usuário: objeto JSON livre. Envie null para limpar. Máx. 64 KB serializado, 16 níveis.

Outros campos e objetos aninhados: kobana schema finance.automatic-rules.create.

Respostas

HTTPDescrição
201Rule created. The Location header points at the new row.
400Malformed JSON body.
409X-Idempotency-Key reused with a different body.
422Schema validation failure; company_id or a referenced entity not in the tenant; no criterion / no action; or a scope↔field mismatch.

automatic-rules reorder​

Reordenar regras automáticas

kobana finance automatic-rules reorder [OPÇÕES]

POST /v1/automatic-rules/reorder

Rewrites position for one (company_id, scope) group so it matches ordered_ids (first → position 1). Requires scope finance/automatic_rules with access level write. ordered_ids must be the COMPLETE ordered set for that group — a partial or foreign set is rejected (422). Idempotent via X-Idempotency-Key. Answers 200 { data: { ordered_ids } }.

Cabeçalhos

NomeTipoObrigatórioDescrição
X-Workspace-IdstringsimWorkspace 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).

Corpo da requisição

NomeTipoObrigatórioDescrição
company_idstring (uuid)simCompany whose rules are being reordered.
scopestringsimLedger whose rules are being reordered. Valores: transactions, billings.
ordered_idsarray<string (uuid)>simThe COMPLETE ordered set of rule ids for (company_id, scope), first to last. Positions are rewritten 1..N to match. A partial or foreign set is rejected (422).

Outros campos e objetos aninhados: kobana schema finance.automatic-rules.reorder.

Respostas

HTTPDescrição
200Positions rewritten. Echoes the ids in the order they now hold.
400Malformed JSON body.
409X-Idempotency-Key reused with a different body.
422Schema validation failure; company_id not in the tenant; or ordered_ids is not the exact set for (company, scope).

automatic-rules get​

Obter regra automática por ID

kobana finance automatic-rules get [ID] [OPÇÕES]

GET /v1/automatic-rules/{id}

Returns the same shape as the rows from the list endpoint. Requires scope finance/automatic_rules with access level read. 404 covers both "doesn't exist" and "not in the tenant" — the API does not distinguish.

Argumentos do caminho: id

Parâmetros de consulta

NomeTipoObrigatórioDescrição
fieldsstringnãoComma-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.

Cabeçalhos

NomeTipoObrigatórioDescrição
X-Workspace-IdstringsimWorkspace 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).

Respostas

HTTPDescrição
200Get an automatic rule by id
404Rule not found within the tenant.

automatic-rules update​

Atualizar regra automática

kobana finance automatic-rules update [ID] [OPÇÕES]

PATCH /v1/automatic-rules/{id}

Partial update of criteria/actions and active. Requires scope finance/automatic_rules with access level write. scope and company_id are immutable (delete + recreate to move a rule); position is changed via POST /automatic-rules/reorder. The merged rule must still have at least one criterion and one action.

Argumentos do caminho: id

Cabeçalhos

NomeTipoObrigatórioDescrição
X-Workspace-IdstringsimWorkspace 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).

Corpo da requisição

NomeTipoObrigatórioDescrição
activebooleannão
account_idstring (uuid)nãoCriterion — financial account. Only valid for scope=transactions (422 otherwise).
transaction_typestringnãoValores: debit, credit, null.
match_person_idstring (uuid)não
description_containsstringnãoCase-insensitive substring on description. "" opts into a wildcard (matches every row).
notes_containsstringnão
set_descriptionstringnão
set_person_idstring (uuid)não
set_category_idstring (uuid)não
set_classification_center_idstring (uuid)nãoAction — classification center. Maps to the internal cost-center column.
set_expected_account_idstring (uuid)nãoAction — expected settlement account. Only valid for scope=billings (422 otherwise).
custom_metadataobjectnãoMetadados do usuário: objeto JSON livre. Envie null para limpar. Máx. 64 KB serializado, 16 níveis.
custom_metadata_modestringnãoComo 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.

Outros campos e objetos aninhados: kobana schema finance.automatic-rules.update.

Respostas

HTTPDescrição
200Updated rule.
400Malformed JSON body.
404Rule not found within the tenant.
409X-Idempotency-Key reused with a different body.
422Schema validation failure; a referenced entity not in the tenant; or the merged rule loses its last criterion/action.

automatic-rules delete​

Excluir regra automática

kobana finance automatic-rules delete [ID] [OPÇÕES]

DELETE /v1/automatic-rules/{id}

Hard-deletes a rule. Requires scope finance/automatic_rules with access level delete. Surviving rules keep their positions (a gap is left — reorder to compact). Calling DELETE twice returns 200 then 404.

Argumentos do caminho: id

Cabeçalhos

NomeTipoObrigatórioDescrição
X-Workspace-IdstringsimWorkspace 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).

Respostas

HTTPDescrição
200Rule deleted.
404Rule not found within the tenant.