Since the first draft
start_period is required when you create a billing plan (createBillingPlan). An invalid plan now names each problem in error.details, with a JSON pointer such as /data/start_period.
Answers to API credentials and to sessions with narrowed scopes carry only the fields this reference documents.
The error code list covers every code a response can carry, including the general ones BAD_REQUEST, FORBIDDEN, NOT_FOUND, CONFLICT and ERROR.
Billing formulas compare values (lt, le, gt, ge, eq, ne) and choose with if; a plan variable can be a formula.
A billing plan line's recipient_filter always answers with recipient_ids; you may still leave it out when you send a line.
Foreign-currency documents: the euro figures
Sales and purchase invoices, quotes, their lines, payments and payment allocations answer with their euro figures.
The fields
exchange_rate (document-currency units per 1 EUR, the ECB's direction), book_currency (always EUR), the book_ amounts, exchange_rate_source on invoices and an allocation's exchange_difference. A document in EUR has exchange_rate 1; a rate and its book_ figures are null while a document has no rate yet.
Invoice inputs accept an exchange_rate override, and purchase invoice inputs also accept book_tax_total, the VAT in EUR as the seller states it.
Payment.amount changed meaning: it is now the money that moved, in Payment.currency (the bank or cash account's currency). Before, it was the amount in the document's currency.
What to change
What the payment settled of the document, in the document's currency, is the allocation's amount. A document in another currency may also be paid in EUR. For a payment in the document's currency nothing changes.
A journal entry is in the book currency only: a currency other than EUR is refused with TRANSACTION_CURRENCY_NOT_SUPPORTED. Journal entries in other currencies, with their rates, came later: see Foreign currencies.
Sales invoices and quotes
Sales invoices and quotes are separate resources over a shared SalesDocument base. A sales invoice's kind is invoice, credit_note, prepayment_invoice or late_fee; a quote's is quote only.
A quote no longer carries the fields only an invoice can fill (payments, amount_paid, amount_due, issued_at and the rest), and an invoice no longer carries quote_status or valid_until.
Invoices, quotes and payments use their public field names only. A body with an older spelling is refused with extra_forbidden at that field.
Invoices, quotes and payments: a refusal about a record's state is a 409
A refusal caused by the state of a record, not by the request, answers 409 where it answered 400. The error body and error.code are the same; a client that branched on the status for these codes moves to 409, and one that switches on error.code sees no change.
The operations and codes
issueSalesInvoice:INVOICE_NOT_DRAFT, also when the issue lost a race to a concurrent one.sendSalesInvoice:INVOICE_NOT_ISSUEDfor a draft.acceptQuote:QUOTE_EXPIRED;createSalesInvoicefrom an expired quote answers it as409too.updateSalesInvoice:PREPAYMENT_INVOICE_NOT_EDITABLE.updatePurchaseInvoice:PURCHASE_INVOICE_CANCELLEDandPREPAYMENT_INVOICE_NOT_EDITABLE.createPaymentandreconcileBankLine:PAYMENT_INVOICE_NOT_ISSUED, when the invoice is not issued, is voided or is archived.createObject:BILLING_OBJECT_TYPE_ARCHIVED, when the object's type is archived.
An archived customer is a conflict: createSalesInvoice, updateSalesInvoice, createQuote and updateQuote answer 409 BUSINESS_PARTNER_ARCHIVED when they name one, and PARTNER_ARCHIVED_MATCH when a typed customer resolves to one. details names the partner.
Deducting a prepayment that another invoice already deducts is 409 PREPAYMENT_ALREADY_DEDUCTED: on createSalesInvoice, updateSalesInvoice and issueSalesInvoice, and on postPurchaseInvoice. A purchase draft reserves nothing, so createPurchaseInvoice and updatePurchaseInvoice save a second one, and posting it is refused.
A credit note whose source cannot be credited is 409 CREDIT_NOTE_SOURCE_NOT_CREDITABLE on createSalesInvoice (credits_invoice_id) and createPurchaseInvoice (kind: credit_note), where it was 400: the credited invoice is not issued, is partly paid or paid, or deducts a prepayment. CREDIT_NOTE_SOURCE_NOT_INVOICE, a source that is not an invoice at all, stays 400.
A purchase invoice line on the organization's accounts payable or receivable control account is refused with PURCHASE_LINE_CONTROL_ACCOUNT at the line, except a kept line that stays on the account it already has.
The 201 of createSalesInvoice and createPurchaseInvoice carries an ETag, the version a read of the new invoice answers, so the first PATCH can send it as If-Match without reading the invoice first.
Foreign-currency documents: opening state and history
An open invoice in the opening state may be in the book currency or any currency the organization has activated (CURRENCY_NOT_ACTIVE otherwise; before, only EUR), with an optional exchange_rate: the rate the source system booked it at.
The rate
What is still open of a foreign invoice ties to the receivable or payable balance in EUR at its rate. Omitted or null, that is the ECB rate of the balances date (EXCHANGE_RATE_MISSING when the bank has none). An invoice in EUR takes only 1; a foreign one never does (OPENING_STATE_FOREIGN_RATE_OF_ONE). getOpeningState reads the stored rate back.
History of foreign documents: an issued create linked to an imported transaction (transaction_id) may be in another currency, and ties in EUR at the exchange_rate sent or at the rate the journal was booked at. A payment linked to an imported transaction may settle a foreign document, in EUR or in the document's currency.
An update that sends an exchange_rate to an invoice brought in by an import is 409 IMPORTED_INVOICE_RATE_SET_SEPARATELY (an opening item's: OPENING_INVOICE_EDIT_IN_OPENING_STATE). Before, it answered 200 and dropped the rate. A rate echoed back as stored is answered as before.
A purchase invoice's book_tax_total input is the printed VAT of the supply: a prepayment deduction keeps its prepayment's VAT, so the stored figure is that less the deducted VAT.
The open-item reports of runReport (contact-balances, aging and the open_items rows of control-totals) add each open invoice at its book value in EUR, not at its face. For a company whose open invoices are all in EUR nothing changes.
A sales invoice PDF's balance block covers only the invoice's own currency, and a held prepayment in that currency reduces the total due.
INVOICE_TRANSACTION_CURRENCY_UNSUPPORTED and OPENING_STATE_CURRENCY_NOT_EUR are no longer answered: what they refused now works.
Billing: values taken from a purchase invoice
An asked number variable of a billing plan takes an invoice_formula: how a run computes the value it takes from a purchase invoice's chosen lines, such as sum_lines(line.amount / line.quantity) for a price per unit. Null is the lines' sum.
The formula context
Formulas gain the invoice and line scopes and sum_lines, with line. only inside it. parseBillingFormula checks the invoice context, and getBillingFormulaCatalog lists the invoice and lines references. An invalid formula is BILLING_PLAN_VARIABLE_INVOICE_FORMULA_INVALID; one that gives no value from the chosen lines, at run time, is BILLING_RUN_PURCHASE_FORMULA_NO_VALUE.
A billing run's variable value is a VariableDecimal: at most 6 decimal places, stored and read back as sent. A value taken from a purchase invoice is computed by the server to 6 places, and the run's values read back the invoice_formula it was computed with.
Action names, and the codes each operation answers
Two actions are renamed to one camelCase word, as every other action is: assignObjectPaymentReferences is POST /objects:assignPaymentReferences, and rotateWebhookEndpointSecret is POST /webhook-endpoints/{id}:rotateSecret. The old paths are gone, with no alias. The operation ids, bodies and answers are unchanged, and so is the CLI command, tracken objects assign-payment-references.
Each operation's error responses name the codes it answers with that status, and the shared responses name the codes any operation can answer, such as DEMO_ORG_ACTION_BLOCKED on the 403. Each error code's page names the operations that answer it and the status they answer it with, and every listed code is named by an operation or can come from any of them.
Responses the server already gave are now documented: getCurrentUser 409 ACCOUNT_EMAIL_CONFLICT, getOrganization 404 ORG_NOT_FOUND, getVatReturn 400 VAT_RETURN_SCHEMA_INVALID and listDimensionValues 404 DIMENSION_NOT_FOUND.
createObject and updateObject may answer 503 ADDRESS_STORE_UNAVAILABLE: a service the operation depends on is briefly unavailable, so retry later.
The 400 of replaceOpeningState names the code of each opening-state rule. The server answered them before; they are now in the error code list.
The codes
OPENING_STATE_AS_OF_DATE_INVALID, OPENING_STATE_UNRESOLVED_REF, OPENING_STATE_INVALID_ACCOUNT_TYPE, OPENING_STATE_UNBALANCED, OPENING_STATE_SUBLEDGER_MISMATCH, OPENING_STATE_CONTROL_ACCOUNT_UNRESOLVED, OPENING_STATE_NO_ZERO_TAX_CODE, OPENING_STATE_DUPLICATE_ENTRY, OPENING_STATE_LINES_TOTAL_MISMATCH, OPENING_STATE_NEGATIVE_AMOUNT, OPENING_STATE_FIXED_ASSET_INVALID and OPENING_STATE_PREPAYMENT_INVALID.
Foreign currencies: journals, accounts, bank accounts, billing plans and the opening state
A journal entry may be kept in a currency the organization has activated, one currency and one rate per transaction. This replaces the book-currency-only rule above.
The fields
In another currency each entry sends foreign_debit or foreign_credit, and its EUR debit and credit are computed: each side's total converts once and is shared over its entries, so a balanced entry stays balanced in EUR to the cent. exchange_rate is optional (omitted, the ECB rate of the date). A read answers exchange_rate, book_currency, exchange_rate_source and foreign_total, and each entry its foreign_amount and currency. fx_revaluation is a new origin: a period-end revaluation journal, its reversal on the next day, or the storno of either, with the source.type fx_revaluation_run; like every origin but manual and import, it cannot be changed or deleted here. TRANSACTION_CURRENCY_NOT_SUPPORTED now refuses only a move to another foreign currency without entries typed in it.
An account may be kept in a currency: Account.currency (null for EUR) and the read-only currency_locked. A posting to such an account carries its amount in that currency, else FX_ACCOUNT_CURRENCY_MISMATCH.
The refusals
400 ACCOUNT_CURRENCY_IS_BOOK_CURRENCY and ACCOUNT_OPENING_IN_CURRENCY; 409 ACCOUNT_CURRENCY_SET_BY_BANK_ACCOUNT, ACCOUNT_CURRENCY_HAS_BOOK_POSTINGS and ACCOUNT_CURRENCY_HAS_FOREIGN_POSTINGS, each with the next free account code in details.suggested_code where it helps.
A bank account in another currency keeps its GL account in that currency. Creating or updating one is 409 BANK_ACCOUNT_GL_CURRENCY_CONFLICT when that GL account already holds EUR postings or serves another bank account, BANK_ACCOUNT_GL_CURRENCY_MISMATCH when it is kept in another currency, and BANK_ACCOUNT_CURRENCY_LOCKED when the currency changes while imported lines exist. A bank account reads currency_locked.
A bank statement's closing_balance is statement_balance, with no alias, and the statement gains currency, its bank account's, which its balances and lines are in (listBankStatements, getBankStatement).
A bank line carries its rate: exchange_rate (the ECB rate of its booking date, line-currency units per 1 EUR), book_amount (the line in EUR) and rate_date (the day the ECB published the rate). A line in EUR reads 1, its own amount and no rate_date; a foreign line with no rate yet reads null in all three.
importBankStatement refuses a statement or line in another currency than the bank account with 400 BANK_STATEMENT_CURRENCY_MISMATCH, and imports nothing of the file; before, such a line was stored and could never be booked. reconcileBankLine answers BANK_LINE_CURRENCY_MISMATCH. BANK_STATEMENT_LINE_BLOCKED_CURRENCY is no longer answered.
A billing plan may bill in an activated currency: currency (omitted on a create, the book currency) and currency_locked, with 409 BILLING_PLAN_CURRENCY_LOCKED once an invoice from the plan is issued. createBillingRun takes an exchange_rate for a currency the ECB publishes no rate for; a run answers its currency, and each recipient its currency, exchange_rate and book_total.
The opening state takes the balance of an account kept in a currency (currency, foreign_amount, exchange_rate), advances in other currencies (currency, exchange_rate, book_amount) and an open invoice's book_outstanding, the EUR still open as the source books hold it.
Purchases, fixed assets and figures out of range
createPurchaseInvoice and updatePurchaseInvoice refuse a supplier that is archived with 409 BUSINESS_PARTNER_ARCHIVED, as the sales documents do. An invoice whose supplier was archived after it was saved keeps it. When migrating, create a contact's documents before you archive the contact.
A fixed asset's figures are read exactly as stored: acquisition_cost, residual_value, opening_accumulated_depreciation, accumulated_depreciation, book_value and a schedule row's accumulated and book_value are LineDecimal, up to 10 decimal places. Writes still take cents.
A figure out of its column's range is 400 VALIDATION_ERROR with context.reason value_too_large, not 500. Nothing is written.
An ETag on every create, open response enums, and the subscription permission
The permission billing.manage is renamed subscription.manage in getCurrentUser's data.organizations[].permissions[]: an owner's right over the company's Tracken subscription. No operation required it.
Every create of a record whose GET /{id} sends an ETag now sends the same ETag on its 201, so the first PATCH can send it as If-Match without a read (conventions). createDocumentLink has no record of its own and sends none.
Details
createSalesInvoice and createPurchaseInvoice already did; now so do the creates of fiscal years, periods, accounts, dimensions and their values, contacts, items, transactions, meter readings, meter types, meters, object types, objects, quotes, billing plans, payments, bank accounts, documents, depreciation runs, fixed asset groups, fixed assets, report definitions and VAT returns. A new VAT return is a draft, so its tag is weak (W/"…"), as getVatReturn answers it for a draft: a cache validator for If-None-Match only, since no VAT return operation takes If-Match. The 200 a create answers for an existing external_ref (on_conflict return or update) carries no ETag; read the record for it.
Every enum that appears only in responses is marked x-extensible-enum: true (88 of them), and its description says new values may be added. This is what the API always promised (conventions); a client generator can now type these enums as open. An enum a request can carry stays closed.
A billing plan's start_period of null means not chosen yet: the plan saves as a draft, approving it needs a start, and a copy (based_on_plan_id) refuses null.
Subscription refusals: a 402 and new codes
Tracken Accounts is moving to a paid subscription. While it is switched off none of these refusals is answered; a client can handle them now. error.context keys are snake_case with machine values (a plan or feature key, never a display name), and money is a decimal string.
402 SUBSCRIPTION_INACTIVE, a new status (the shared PaymentRequired response): the organization's subscription is not active, so every operation is refused, reads included, except getCurrentUser, getOrganization and the data export. Do not retry: export the data if needed, and ask an owner to reopen the subscription in the app.
The context
context.reason is trial_ended, not_paid, cancelled or payer_stopped (an open list: accept a value you do not know; a company an accounting firm pays for reads payer_stopped). context.export_until is the ISO date until which the data can still be exported.
403 PLAN_FEATURE_NOT_INCLUDED on write operations: the organization's plan does not include the feature (context.capability, context.required_plan). For an API credential without the API feature it answers every operation that names an organization, with the public API as capability, not 401: the credential is kept, and getCurrentUser still answers. Do not retry; an owner changes the plan in the app.
409 PLAN_LIMIT_REACHED on createTransaction, issueSalesInvoice, postPurchaseInvoice and reconcileBankLine: the document's month already holds the plan's document limit (context.month, context.limit, and context.next_plan, a plan key or null when no larger plan exists). An owner moves to next_plan in the app, then retry.
409 WORK_MONTH_CONFIRM_REQUIRED and EXTRA_MONTH_CONFIRM_REQUIRED on the operations that change the books, named on each one's own 409, and on importBankStatement for a company on the annual_report plan uploading outside its working month: the write would start a month the subscription bills (context.month, context.price, context.currency). An API credential cannot confirm: a person confirms the month in the app, then retry the request unchanged, with the same Idempotency-Key (the refusal is never stored under it).
A test copy of a company does not hand out its declaration files
A company created as a test copy of another follows the original's subscription and is free. getVatReturn with format=kmd or format=vd answers 403 SANDBOX_ACTION_BLOCKED in a test copy (context.action emta_file_download, an open list); format=json answers as before. Take the file from the real company, or remove the copy mark in the app if this company is now the real one.
Trial limits: a 409 for a used allowance
409 TRIAL_LIMIT_REACHED on sendSalesInvoice and sendQuote (the day's customer e-mails) and on digitizeDocument (the month's documents): a company on a free trial has used one of the trial's allowances, and nothing was sent or started. Do not retry before context.resets_on; an owner who chooses a plan in the app lifts the limit at once.
The context
context.limit names the allowance: emails_per_day or ocr_per_month on these operations (an open list: accept a value you do not know; the app's own operations also answer companies, firm_companies and ai_per_month). context.max is its number (Tracken sets the numbers; today 50 e-mails a day and 100 documents a month), and context.resets_on the ISO date the count starts again, with days and months counted in Europe/Tallinn. While the subscription is switched off this is never answered, and a company on a chosen plan never meets it.
Beta in production
The API is in beta in production, for companies in Tracken Accounts. It may still change before v1: the document stays x-stability: draft, and every change is announced here.
The tracken CLI and the TypeScript SDK are on npm, MIT licensed: npm i -g @tracken/cli and npm i @tracken/sdk (0.2.0).
This portal is public at tracken.ee/developers. developers.tracken.ee, which every error's doc_url names, redirects to it: developers.tracken.ee/errors/<CODE> lands on the code's page.
The first published draft of version 1
196 operations in the reference: 184 live on https://accounts-api.dev.tracken.ee/v1, and 12 (webhooks, events and full exports) specified for after v1.
Sign-in through Tracken ID: API credentials (OAuth client credentials, by secret or private_key_jwt) and people (device flow for the CLI, MCP clients), with scopes.
The conventions: {"data": …} envelopes, money as decimal strings, Idempotency-Key, ETag and If-Match, cursor pagination, updated_since and /deletions sync, dry runs, external_ref upserts, per-credential rate limits, open response enums.
One error envelope, with a page for every error code.
The tracken CLI and its local MCP server, on npm since 0.2.0: npm i -g @tracken/cli.