Choose what you allow. Your choice applies on every tracken.ee address and you can change it any time with “Cookie settings” in the footer.

Remember your cookie choice, language and theme. Without them the site doesn't work the way you chose.

A cookie with your choice (6 months); language and theme in browser storage.


The services below learn that you visited this site, whether you came from their ad and whether you then created a Tracken account. That shows us which ads work, and these companies may show you Tracken ads later. They may link the data to your account with them. For Meta, Tracken ID's server reports the new account and also sends a hash of your e-mail address, your IP address and browser details.

ServiceCookiesKept for up to
Meta (Facebook, Instagram)_fbp, _fbc90 days

Tracken's own visit counter uses no cookies, stores no IP addresses and shares nothing with anyone. Privacy policy

Skip to content
Beta
BetaThe Tracken Accounts API is in beta: it may still change before v1, and every change is announced in the changelog.
Guide

Conventions

The rules every operation follows. Learn them once; the reference then only lists what differs from one resource to the next.

Each rule is one line with an example. The reasoning and the edge cases sit under Why and details.

Envelopes

Every body is JSON in an envelope: data for a record, data plus meta for a list, error for a failure.

Why and details

Every answer is JSON in an envelope: {"data": …} for one record, data plus meta for a list, and {"error": …} for a failure. Request bodies use the same wrapper: the record goes in data, and an operation's options (on_conflict, a period or dimension override) sit beside it, never inside the record.

A list
{
  "data": [ { … }, { … } ],
  "meta": {
    "pagination": { "limit": 50, "next_cursor": "c2VxOjQy…", "has_more": true },
    "sync": { "next_since": "2026-10-12T08:44:00Z" }
  }
}
A create, with an option beside the record
POST /v1/contacts

{ "data": { "name": "Mets ja Mägi OÜ", "external_ref": "crm-1042" }, "on_conflict": "return" }

Money, quantities and dates

Money is a decimal string, never a JSON number: 1 234,50 EUR travels as "1234.50". Dates are YYYY-MM-DD, instants RFC 3339 in UTC.

Why and details

Money is a decimal string, never a JSON number: an amount of 1 234,50 EUR travels as "1234.50". Amounts carry at most 2 fraction digits, prices and quantities at most 4; there is no exponent, no + and no thousands separator. A JSON number in a money field is refused, so no client rounds it through a binary float. Where the server computes (totals, VAT), it rounds half to even.

Amounts are positive. Which way money moved is a separate direction (incoming, outgoing), and totals are named by meaning (net_total, tax_total, total), the same on every document, in lists and in detail.

Dates are YYYY-MM-DD (12.10.2026 is "2026-10-12"); instants are RFC 3339 in UTC ("2026-10-12T09:30:00Z"). Formatting for people (1 234,50 EUR, 12.10.2026) is your client's job; the API never sends formatted numbers or dates.

Decimal strings in a request: "1234.50", never 1234.5
{
  "lines": [
    { "name": "Raamatupidamisteenus, oktoober", "quantity": "1.5", "unit": "h",
      "unit_price": "823.0000", "tax_code_id": "…", "account_id": "…" }
  ],
  "net_total": "1234.50"
}

Idempotency

Send an Idempotency-Key (a UUID you generate) on every POST; a retry answers the original response instead of creating twice.

Why and details

A retry with the same key (after a timeout, a dropped connection, a 5xx) answers the original response instead of creating the record twice. Keys are kept for 24 hours, per caller. The same key with a different body, or for another operation, is 409 IDEMPOTENCY_KEY_REUSED: a new logical request needs a new key. An answer that carries a secret (a new credential's) is never stored for replay. The CLI and SDK send keys for you.

curl
curl -X POST https://accounts-api.tracken.ee/v1/sales-invoices \
  -H "Authorization: Bearer $TOKEN" \
  -H "Idempotency-Key: 6f1c0f6e-2b1d-4b8e-9a51-3f0f3c1d2e4a" \
  -H "Content-Type: application/json" \
  -d @invoice.json

Concurrency: ETag and If-Match

Send the ETag a read or a create answered back as If-Match on the PATCH; if the record changed meanwhile you get 412 and nothing is overwritten.

Why and details

GET /{id} answers an ETag, and so does the 201 of every create of such a record, so the first update of a new record needs no read. A draft VAT return's tag is weak (W/"…"), as its read's is: it is 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 carries none: read that record for it. Send it back as If-Match on the PATCH: if the record changed since you read it, the update is refused with 412 PRECONDITION_FAILED and nothing is overwritten. Read again, reapply your change, send the new ETag. PATCH is partial: fields you leave out stay as they are, and null clears a field.

HTTP
POST /v1/contacts   → 201, ETag: "1c07…"
PATCH /v1/contacts/7d1e…   If-Match: "1c07…"   → 200, ETag: "3f9a…"
GET /v1/contacts/7d1e…   → 200, ETag: "3f9a…"
PATCH /v1/contacts/7d1e…   If-Match: <an older ETag>   → 412 PRECONDITION_FAILED

Pagination

Lists are cursor-paged: follow meta.pagination.next_cursor until it is null. limit is 1–200, default 50.

Why and details

Pass the cursor back as cursor with the same filters and sort, until it is null (has_more says the same). A cursor is opaque: never build or decode one. Every sort is total, ties broken on id, so a record never appears on two pages of one read. There are no page numbers and no date windows.

HTTP
GET /v1/contacts?limit=200
GET /v1/contacts?limit=200&cursor=c2VxOjQy…   (until next_cursor is null)

Sync

Read changes with updated_since and sort=updated_at, removals with GET /deletions?since=, and start every next pass at meta.sync.next_since.

Why and details

Every list of records that change takes updated_since (an RFC 3339 instant, inclusive) and sort=updated_at. A read with updated_since includes archived records, each with is_archived. A change to a line, an allocation or a link moves its parent's updated_at. Removals are listed by GET /deletions?since= (resource, id, external_ref, deleted_at), kept for 13 months.

Every page of a pass answers the same meta.sync.next_since: 16 minutes before the pass began, so a change committed by a long-running writer during your pass is still seen in the next one. Start the next pass there. A record can therefore arrive twice; keep the newer by id and updated_at. A since older than the 13 months is 409 SYNC_WINDOW_EXPIRED, never a partial list: read everything again.

Two passes
# First pass: read every list in full and remember meta.sync.next_since.
GET /v1/sales-invoices?sort=updated_at&limit=200        # next_since = T1
GET /v1/deletions?limit=200                             # next_since = T1

# Every later pass starts where the last one said:
GET /v1/sales-invoices?updated_since=T1&sort=updated_at # next_since = T2
GET /v1/deletions?since=T1                              # next_since = T2

Rate limits

600 request units a minute per credential, at most 100 in any 10 seconds. On 429 wait Retry-After seconds, then retry.

Why and details

Each API credential (and each scope-narrowed token, the CLI's included) has 600 request units a minute, at most 100 in any 10 seconds. Most calls cost 1 unit; heavy ones (running a report, rendering a PDF, reading a VAT return, importing a bank statement, starting a billing run, uploading or digitizing a document) cost 10. Every limited response carries the IETF RateLimit-Policy and RateLimit headers (r = units left, t = seconds until that window resets). Over the limit is 429 RATE_LIMITED with Retry-After: wait that many seconds, then retry. A person in the web app is not limited. Every response carries X-Request-Id.

Response headers
RateLimit-Policy: "burst";q=100;w=10, "minute";q=600;w=60
RateLimit: "burst";r=87;t=4, "minute";r=512;t=41

Enums: closed in, open out

Send only the values the reference lists; accept values you do not know in a response.

Why and details

Enum values are lowercase codes (draft, credit_note), the same in every language. In a request they are closed: a value the reference does not list is refused with 400, never mapped to a default, and so is an unknown field. In a response they are open: v1 grows by adding values, so a client must tolerate one it does not know (treat it as “other”, show the raw code, or skip the record) rather than fail. The reference marks every enum accordingly.

TypeScript
switch (invoice.status) {
  case "draft": /* … */ break;
  case "issued": /* … */ break;
  default: showRawCode(invoice.status); // a value added later
}

Only documented fields

Read only the fields the reference documents, and ignore any field you do not know.

Why and details

An API credential's responses carry exactly the fields this reference documents, at every depth: the app's own internal fields are left out. A person's session (the web app, the CLI, an MCP client) may see more fields in the same response; they are not part of the contract and can change at any time, so read only what the reference lists, and ignore any field you do not know. New documented fields can appear in v1 at any time.

API credential: exactly the documented fields. A person's session (web app, CLI, MCP) may see more; they are not part of the contract.

Errors

A failure answers its HTTP status and one envelope. Switch on error.code; field problems are in details, each with a JSON Pointer.

400The request is wrong; fix it, do not retry it as it is.
401Authentication only: no token, or an expired or foreign one.
402The organization's subscription is not active (SUBSCRIPTION_INACTIVE): every operation is refused, reads included, except reading the user and the organization and the export. Do not retry; an owner reopens it in the app.
403A missing scope or role; WWW-Authenticate names a missing scope.
404No such record in this organization.
409The record's state forbids it (issuing an issued invoice, deleting a referenced contact).
412If-Match did not match.
429Rate limited; wait Retry-After.
5xxRetry with backoff, with the same Idempotency-Key.
Why and details

The envelope has a stable code to switch on, a developer-facing English message (never show it to people or parse it), every field problem at once in details with a JSON Pointer to the field (or ?name for a query parameter), the figures your own text needs in context, the request_id to quote to support, and doc_url, the code's page here. On a conflict with a record that already exists, existing_id names it.

400Two invalid fields
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Request body has 2 invalid fields",
    "details": [
      { "code": "REQUIRED", "message": "Field required", "pointer": "/lines/0/unit_price" },
      { "code": "VALIDATION_ERROR", "message": "Not a decimal string", "pointer": "/lines/1/quantity" }
    ],
    "request_id": "req_01JB4Z0K3Q7V8W9X0Y1Z2A3B4C",
    "doc_url": "https://developers.tracken.ee/errors/VALIDATION_ERROR"
  }
}

Your ids and upserts

Put your own id in external_ref; send on_conflict beside data to return or update the existing record instead of a 409.

Why and details

Every record you create can carry your own id in external_ref (up to 200 characters, unique per organization and resource). Lists filter by it, up to 100 values at once, so a migration checks a batch in one call. Creating a second record with a taken external_ref is 409 EXTERNAL_REF_EXISTS with the holder's existing_id; send on_conflict beside data (error, return or update) to answer the existing record or upsert instead.

Upsert a contact
POST /v1/contacts

{ "data": { "name": "Mets ja Mägi OÜ", "external_ref": "crm-1042" }, "on_conflict": "update" }
201 the first time, 200 with the same record after that.

Dry run

?dry_run=true on any write answers exactly what the write would, and stores, posts and sends nothing.

Why and details

The answer has the status, errors, computed totals and assigned numbers of the real write, and the response carries Tracken-Dry-Run: true. Check an invoice's totals, or a migration batch, before you commit to it.

The request, and the header on its answer
POST /v1/sales-invoices?dry_run=true
Tracken-Dry-Run: true
201 as the real create would answer, and nothing is stored.

Resources, verbs and actions

Plural nouns, UUID ids, snake_case fields. Actions are custom methods after a colon: POST /sales-invoices/{id}:issue.

Why and details

Resources are plural nouns (/sales-invoices), ids are UUIDs, fields are snake_case. GET lists and reads, POST creates (201 and Location), PATCH updates part of a record, DELETE removes it (204, or 409 when it is referenced). Actions are custom methods after a colon: POST /sales-invoices/{id}:issue, POST /bank-statements:import; a slash always means a sub-resource. A rendition of a record is a format of its GET (?format=pdf), answered with a 303 to a short-lived link that you follow without your Authorization header. Long work answers 202 with a job to poll.

GETList and read
POSTCreate: 201 and Location
PATCHUpdate part of a record
DELRemove: 204, or 409 when referenced
POST…/{id}:issue, /bank-statements:import: actions
GET?format=pdf: a 303 to a short-lived link

Versioning

The major version is in the path (/v1). Until v1 is stable it may still change; the changelog lists every change.

Why and details

Once v1 is stable, changes within it are additive only (new fields, new optional parameters, new enum values in responses, new operations), and a removal is announced with Deprecation and Sunset headers at least 12 months ahead. Until then v1 is a draft and may still change; the changelog lists every change.

After v1 is stable, a removal is announced
Deprecation: …
Sunset: …
Sunset at least 12 months ahead.