PT EN

Contabilidade

URL base: $BUSINESS_API

O objecto

tenant_idstring · obrigatório
idstring · obrigatório
account_numberstring · obrigatório
account_namestring · obrigatório
account_typestring · obrigatório

um de asset, liability, equity, revenue, expense

rolestring · opcional
currencystring · obrigatório
is_reconciledboolean · obrigatório
activeboolean · obrigatório
created_atstring (date-time) · obrigatório
O objecto
{
  "tenant_id": "ten_2ugFXIC316WXzGu1HGal90AxTA6",
  "id": "led_2DDAMfBcGzd6gv98kDhKqFBU6lt",
  "account_number": "ACC-2026-000142",
  "account_name": "Ana Matsinhe",
  "account_type": "asset",
  "role": "role",
  "currency": "MZN",
  "is_reconciled": true,
  "active": true,
  "created_at": "2026-11-19T09:30:00Z"
}

Listar o plano de contas

Registos

GET /ledger/accounts

Returns the general ledger accounts of the caller's tenant, ordered by account number, with cursor pagination (limit defaults to 20, at most 100). The optional q parameter matches account names and numbers. Requires the ledger:read permission.

Parâmetros

limitinteger · consulta · opcional

Maximum resources to return (default 20, maximum 100).

afterstring · consulta · opcional

Opaque cursor returned by the previous page.

qstring · consulta · opcional

Filter by name or number

activeboolean · consulta · opcional

Filters by account state: the value true returns only active accounts, any other non-empty value returns only inactive accounts, and omitting it returns both.

Devolve

200 Accounts

Mostrar atributos
dataarray of LedgerAccount · obrigatório
Mostrar atributos filhos
tenant_idstring · obrigatório
idstring · obrigatório
account_numberstring · obrigatório
account_namestring · obrigatório
account_typestring · obrigatório

um de asset, liability, equity, revenue, expense

rolestring · opcional
currencystring · obrigatório
is_reconciledboolean · obrigatório
activeboolean · obrigatório
created_atstring (date-time) · obrigatório
has_moreboolean · opcional
next_cursorstring · opcional

Erros 403

Permissões ledger:read · Funções: admin, analyst, billing_clerk, customer_service, finance, owner, viewer

curl -X GET "$BUSINESS_API/ledger/accounts" \
  -H "Authorization: Bearer sk_test_..."
Resposta 200
{
  "data": [
    {
      "tenant_id": "ten_2ugFXIC316WXzGu1HGal90AxTA6",
      "id": "led_2DDAMfBcGzd6gv98kDhKqFBU6lt",
      "account_number": "ACC-2026-000142",
      "account_name": "Ana Matsinhe",
      "account_type": "asset",
      "role": "role",
      "currency": "MZN",
      "is_reconciled": true,
      "active": true,
      "created_at": "2026-11-19T09:30:00Z"
    }
  ],
  "has_more": true,
  "next_cursor": "next cursor"
}

Adicionar uma conta ao plano

Registos

POST /ledger/accounts

Adds an account with the given account_number, account_name and account_type (asset, liability, equity, revenue or expense) to the tenant's chart; the account is created active and takes the currency of the existing chart. Returns 400 when a required field is missing, the type is invalid, or the tenant's chart has not been seeded yet. Requires the ledger:write permission.

Corpo application/json

account_numberstring · obrigatório
account_namestring · obrigatório
account_typestring · obrigatório

um de asset, liability, equity, revenue, expense

rolestring · opcional

Devolve

201 Account

Mostrar atributos
tenant_idstring · obrigatório
idstring · obrigatório
account_numberstring · obrigatório
account_namestring · obrigatório
account_typestring · obrigatório

um de asset, liability, equity, revenue, expense

rolestring · opcional
currencystring · obrigatório
is_reconciledboolean · obrigatório
activeboolean · obrigatório
created_atstring (date-time) · obrigatório

Erros 400 · 403 · 409

Permissões ledger:write · Funções: admin, finance, owner

curl -X POST "$BUSINESS_API/ledger/accounts" \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
  "account_number": "ACC-2026-000142",
  "account_name": "Ana Matsinhe",
  "account_type": "asset",
  "role": "role"
}'
Resposta 201
{
  "tenant_id": "ten_2ugFXIC316WXzGu1HGal90AxTA6",
  "id": "led_2DDAMfBcGzd6gv98kDhKqFBU6lt",
  "account_number": "ACC-2026-000142",
  "account_name": "Ana Matsinhe",
  "account_type": "asset",
  "role": "role",
  "currency": "MZN",
  "is_reconciled": true,
  "active": true,
  "created_at": "2026-11-19T09:30:00Z"
}

Obter o balancete

Registos

GET /ledger/trial-balance

Trial balance; total debits equal total credits

Returns the debit and credit totals of every account in the tenant's chart, computed from all posted entries or, with the optional as_of RFC 3339 timestamp, only from entries up to that instant. Because every posting is validated as balanced, the debit and credit totals match. Returns 400 when as_of is not RFC 3339. Requires the ledger:read permission.

Parâmetros

as_ofstring (date-time) · consulta · opcional

Entries dated at or before this RFC 3339 instant

Devolve

200 Trial balance

Mostrar atributos
currencystring · opcional
total_debit_minorinteger (int64) · opcional
total_credit_minorinteger (int64) · opcional
balancedboolean · opcional
linesarray of object · opcional
Mostrar atributos filhos
account_idstring · opcional
account_numberstring · opcional
account_namestring · opcional
account_typestring · opcional
currencystring · opcional
debit_minorinteger (int64) · opcional
credit_minorinteger (int64) · opcional
balance_minorinteger (int64) · opcional

Erros 400 · 403

Permissões ledger:read · Funções: admin, analyst, billing_clerk, customer_service, finance, owner, viewer

curl -X GET "$BUSINESS_API/ledger/trial-balance" \
  -H "Authorization: Bearer sk_test_..."
Resposta 200
{
  "currency": "MZN",
  "total_debit_minor": 125000,
  "total_credit_minor": 125000,
  "balanced": true,
  "lines": [
    {
      "account_id": "act_2JFioNDgIfvkgflk8RtcqhBaARP",
      "account_number": "ACC-2026-000142",
      "account_name": "Ana Matsinhe",
      "account_type": "account type",
      "currency": "MZN",
      "debit_minor": 1,
      "credit_minor": 1,
      "balance_minor": 125000
    }
  ]
}

Obter a reconciliação contabilística

Registos

GET /ledger/reconciliation

Compare control accounts to the billing and payment sub-ledgers

Compares the balance of the receivable and unallocated cash control accounts, and of the stock control account where stock is valued, with the totals reported by the operational sub-ledgers. Each pair returns the control balance, the sub-ledger total and the difference in minor units, and balanced is true only when every difference is zero. Returns 400 when sub-ledger totals are not configured on the server. Requires the ledger:read permission.

Devolve

200 Reconciliation

Mostrar atributos
currencystring · opcional
receivable_control_minorinteger (int64) · opcional
receivable_sub_ledger_minorinteger (int64) · opcional
receivable_difference_minorinteger (int64) · opcional
unallocated_control_minorinteger (int64) · opcional
unallocated_sub_ledger_minorinteger (int64) · opcional
unallocated_difference_minorinteger (int64) · opcional
stock_control_minorinteger (int64) · opcional

Stock on hand account (RFC 0071 phase 4).

stock_sub_ledger_minorinteger (int64) · opcional

Inventory balances, on hand and in transit, at moving average cost.

stock_difference_minorinteger (int64) · opcional
balancedboolean · opcional

Erros 403

Permissões ledger:read · Funções: admin, analyst, billing_clerk, customer_service, finance, owner, viewer

curl -X GET "$BUSINESS_API/ledger/reconciliation" \
  -H "Authorization: Bearer sk_test_..."
Resposta 200
{
  "currency": "MZN",
  "receivable_control_minor": 1,
  "receivable_sub_ledger_minor": 1,
  "receivable_difference_minor": 1,
  "unallocated_control_minor": 1,
  "unallocated_sub_ledger_minor": 1,
  "unallocated_difference_minor": 1,
  "stock_control_minor": 1,
  "stock_sub_ledger_minor": 1,
  "stock_difference_minor": 1,
  "balanced": true
}

Listar lançamentos

Registos

GET /ledger/entries

Returns the tenant's posted journal entries, newest first, each with its debit and credit lines, using cursor pagination (limit defaults to 20, at most 100). Filters combine with AND; an invalid cursor or a from/to value that is not RFC 3339 returns 400. Requires the ledger:read permission.

Parâmetros

limitinteger · consulta · opcional

Maximum resources to return (default 20, maximum 100).

afterstring · consulta · opcional

Opaque cursor returned by the previous page.

account_idstring · consulta · opcional

Ledger account ID; returns only entries that have at least one line posted to this account.

party_idstring · consulta · opcional

Customer or tenant on a sub-ledger line

source_modulestring · consulta · opcional

Exact name of the module that posted the entry, such as ledger for manual reversals.

source_reference_idstring · consulta · opcional

Exact source reference the posting module recorded on the entry (for example the ID of the invoice or payment it came from, or reversal:<entry id> for a reversal).

fromstring (date-time) · consulta · opcional

RFC 3339 timestamp; returns only entries whose entry date is at or after this instant.

tostring (date-time) · consulta · opcional

RFC 3339 timestamp; returns only entries whose entry date is at or before this instant.

Devolve

200 Journal entries

Mostrar atributos
dataarray of LedgerEntry · obrigatório
Mostrar atributos filhos
tenant_idstring · obrigatório
idstring · obrigatório
entry_numberstring · obrigatório
entry_datestring (date-time) · obrigatório
source_modulestring · obrigatório
source_reference_idstring · obrigatório
descriptionstring · obrigatório
posted_by_user_idstring · obrigatório
reverses_entry_idstring · opcional
created_atstring (date-time) · obrigatório
linesarray of object · opcional
Mostrar atributos filhos
tenant_idstring · obrigatório
idstring · obrigatório
entry_idstring · obrigatório
gl_account_idstring · obrigatório
entry_sidestring · obrigatório

um de debit, credit

amount_minorinteger (int64) · obrigatório
currencystring · obrigatório
sub_ledger_party_idstring · opcional
created_atstring (date-time) · obrigatório
has_moreboolean · opcional
next_cursorstring · opcional

Erros 400 · 403

Permissões ledger:read · Funções: admin, analyst, billing_clerk, customer_service, finance, owner, viewer

curl -X GET "$BUSINESS_API/ledger/entries" \
  -H "Authorization: Bearer sk_test_..."
Resposta 200
{
  "data": [
    {
      "tenant_id": "ten_2ugFXIC316WXzGu1HGal90AxTA6",
      "id": "led_2KINdcqxzWS5JyAd3kktL2eFFCW",
      "entry_number": "ENT-2026-000142",
      "entry_date": "2026-11-19T09:30:00Z",
      "source_module": "source module",
      "source_reference_id": "sou_2tDCiB9UgPx6UNxauznOOZjiQPv",
      "description": "Leitura confirmada no local.",
      "posted_by_user_id": "pos_2dxUMrJSyR9qQTp0wXpci5PMabh",
      "reverses_entry_id": "rev_2SCXR4GDjAQljcKJ1c6pxAMtJ2C",
      "created_at": "2026-11-19T09:30:00Z",
      "lines": [
        {
          "tenant_id": "ten_2ugFXIC316WXzGu1HGal90AxTA6",
          "id": "led_2KINdcqxzWS5JyAd3kktL2eFFCW",
          "entry_id": "ent_26mnjWER3gyZFykxF0EdZ0wl9Au",
          "gl_account_id": "gla_2lXga9FAuTjW4rvUEhziYldiizp",
          "entry_side": "debit",
          "amount_minor": 125000,
          "currency": "MZN",
          "sub_ledger_party_id": "sub_2VLkWh3eYlTIObHccrTQ2BVcg9f",
          "created_at": "2026-11-19T09:30:00Z"
        }
      ]
    }
  ],
  "has_more": true,
  "next_cursor": "next cursor"
}

Obter um lançamento

Registos

GET /ledger/entries/{id}

Returns the journal entry with its entry number, source module and reference, description, the user who posted it, the entry it reverses if any, and all of its lines. Returns 404 when the entry does not exist in the caller's tenant. Requires the ledger:read permission.

Parâmetros

idstring · caminho · obrigatório

ID of the journal entry in the caller's tenant.

Devolve

200 Journal entry

Mostrar atributos
tenant_idstring · obrigatório
idstring · obrigatório
entry_numberstring · obrigatório
entry_datestring (date-time) · obrigatório
source_modulestring · obrigatório
source_reference_idstring · obrigatório
descriptionstring · obrigatório
posted_by_user_idstring · obrigatório
reverses_entry_idstring · opcional
created_atstring (date-time) · obrigatório
linesarray of object · opcional
Mostrar atributos filhos
tenant_idstring · obrigatório
idstring · obrigatório
entry_idstring · obrigatório
gl_account_idstring · obrigatório
entry_sidestring · obrigatório

um de debit, credit

amount_minorinteger (int64) · obrigatório
currencystring · obrigatório
sub_ledger_party_idstring · opcional
created_atstring (date-time) · obrigatório

Erros 403 · 404

Permissões ledger:read · Funções: admin, analyst, billing_clerk, customer_service, finance, owner, viewer

curl -X GET "$BUSINESS_API/ledger/entries/{id}" \
  -H "Authorization: Bearer sk_test_..."
Resposta 200
{
  "tenant_id": "ten_2ugFXIC316WXzGu1HGal90AxTA6",
  "id": "led_2KINdcqxzWS5JyAd3kktL2eFFCW",
  "entry_number": "ENT-2026-000142",
  "entry_date": "2026-11-19T09:30:00Z",
  "source_module": "source module",
  "source_reference_id": "sou_2tDCiB9UgPx6UNxauznOOZjiQPv",
  "description": "Leitura confirmada no local.",
  "posted_by_user_id": "pos_2dxUMrJSyR9qQTp0wXpci5PMabh",
  "reverses_entry_id": "rev_2SCXR4GDjAQljcKJ1c6pxAMtJ2C",
  "created_at": "2026-11-19T09:30:00Z",
  "lines": [
    {
      "tenant_id": "ten_2ugFXIC316WXzGu1HGal90AxTA6",
      "id": "led_2KINdcqxzWS5JyAd3kktL2eFFCW",
      "entry_id": "ent_26mnjWER3gyZFykxF0EdZ0wl9Au",
      "gl_account_id": "gla_2lXga9FAuTjW4rvUEhziYldiizp",
      "entry_side": "debit",
      "amount_minor": 125000,
      "currency": "MZN",
      "sub_ledger_party_id": "sub_2VLkWh3eYlTIObHccrTQ2BVcg9f",
      "created_at": "2026-11-19T09:30:00Z"
    }
  ]
}

Estornar um lançamento

Registos

POST /ledger/entries/{id}/reverse

Posts a new entry dated now that swaps the debit and credit side of every line of the original, which stays unchanged; the reversal is linked to the original and returned with 201. A non-empty reason is required and is added to the reversal's description. Returns 409 when the entry has already been reversed or is itself a reversing entry, and 404 when it does not exist. Requires the ledger:write permission.

Parâmetros

idstring · caminho · obrigatório

ID of the journal entry to reverse, in the caller's tenant.

Corpo application/json

reasonstring · obrigatório

Devolve

201 Reversing entry

Mostrar atributos
tenant_idstring · obrigatório
idstring · obrigatório
entry_numberstring · obrigatório
entry_datestring (date-time) · obrigatório
source_modulestring · obrigatório
source_reference_idstring · obrigatório
descriptionstring · obrigatório
posted_by_user_idstring · obrigatório
reverses_entry_idstring · opcional
created_atstring (date-time) · obrigatório
linesarray of object · opcional
Mostrar atributos filhos
tenant_idstring · obrigatório
idstring · obrigatório
entry_idstring · obrigatório
gl_account_idstring · obrigatório
entry_sidestring · obrigatório

um de debit, credit

amount_minorinteger (int64) · obrigatório
currencystring · obrigatório
sub_ledger_party_idstring · opcional
created_atstring (date-time) · obrigatório

Erros 400 · 403 · 404 · 409

Permissões ledger:write · Funções: admin, finance, owner

curl -X POST "$BUSINESS_API/ledger/entries/{id}/reverse" \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
  "reason": "Leitura confirmada no local."
}'
Resposta 201
{
  "tenant_id": "ten_2ugFXIC316WXzGu1HGal90AxTA6",
  "id": "led_2KINdcqxzWS5JyAd3kktL2eFFCW",
  "entry_number": "ENT-2026-000142",
  "entry_date": "2026-11-19T09:30:00Z",
  "source_module": "source module",
  "source_reference_id": "sou_2tDCiB9UgPx6UNxauznOOZjiQPv",
  "description": "Leitura confirmada no local.",
  "posted_by_user_id": "pos_2dxUMrJSyR9qQTp0wXpci5PMabh",
  "reverses_entry_id": "rev_2SCXR4GDjAQljcKJ1c6pxAMtJ2C",
  "created_at": "2026-11-19T09:30:00Z",
  "lines": [
    {
      "tenant_id": "ten_2ugFXIC316WXzGu1HGal90AxTA6",
      "id": "led_2KINdcqxzWS5JyAd3kktL2eFFCW",
      "entry_id": "ent_26mnjWER3gyZFykxF0EdZ0wl9Au",
      "gl_account_id": "gla_2lXga9FAuTjW4rvUEhziYldiizp",
      "entry_side": "debit",
      "amount_minor": 125000,
      "currency": "MZN",
      "sub_ledger_party_id": "sub_2VLkWh3eYlTIObHccrTQ2BVcg9f",
      "created_at": "2026-11-19T09:30:00Z"
    }
  ]
}