Skip to content

REST API

Every Command and every query of the registry is one route: POST /v1/commands/{name} changes something, POST /v1/queries/{name} reads. The body is {"payload": {...}}; a Command also takes rationale (stored in the Command-Log) and, where it is offered, dry_run: true (the checks and the handler run, then everything is rolled back: nothing is kept, logged or sent). The instance serves its OpenAPI 3.1 document at /v1/openapi.json; every operation is listed in the API reference.

decuma dev --seed muster-gmbh (see Demo instance) prints address and api-key:

Terminal window
export DECUMA_URL=http://127.0.0.1:<port> DECUMA_API_KEY=<api-key>
curl -s -X POST "$DECUMA_URL/v1/queries/journal.list" \
-H "Authorization: Bearer $DECUMA_API_KEY" -H 'Content-Type: application/json' \
-d '{"payload": {"pro_seite": 5}}'

An API-Schlüssel is bound to its Mandant and carries a Freigabeklasse; what it may do without a person is set by the Freigaberichtlinie. A Freigabe of a Meldung, a yearly return or a payment is given by a person in the web app, never by a key. The SDKs wrap these routes: SDKs.

The sections below are what the web app relies on; it is a client of this API and nothing else. Every Command and query by domain, with payload and result: App contract.

  • POST /v1/commands/{name} and POST /v1/queries/{name}, body {"payload": {...}} (rationale optional).
  • Every request of the app carries X-Decuma-Client: web. The session cookie is accepted only together with this header, so a foreign page cannot trigger a Command (a request without it is not_authenticated).
  • Accept-Language: de or en: the language the app shows. It chooses the language of detail, next_step, warning text, readiness texts and outgoing mail. Without it the Account’s stored sprache applies, then English.
  • Decuma-Mandant: <uuid> on every Mandant-scoped call (scope “Mandant” in the App contract).
  • Session: a successful session.sign_in with X-Decuma-Client: web sets the cookie decuma_sitzung (HttpOnly, SameSite=Strict, Path=/, Secure except under decuma dev, Max-Age until the session expires) and leaves token out of the body. session.sign_out, session.end_all, account.delete and account.reset_password clear it.
  • A repeated Idempotency-Key with the same payload returns the first result unchanged and runs nothing, plus the warning dublette (“this request arrived before”) unless the first result carries one. Access is checked first; a counted limit of the installation (Policy::limit, ADR 0054) does not refuse the repeat.
  • A refusal is application/problem+json: {type, title, status, code, detail, next_step, next_command}; next_command is the Command the English next step names (null when it names none), the same in every language, for an agent. Codes and statuses: validation 422, not_authenticated 401, not_allowed and needs_human 403, unknown_command and not_found 404, idempotency_conflict and conflict 409, internal 500. The app renders detail and next_step as they arrive.
  • A successful Command or query may carry warnings: [{code, text, next_command?}] in its result object (a result that is not an object comes as {result, warnings}); next_command is the Command or query the English text names, the same in every language, for an agent; the German text is read by people and names no Command or field. One mechanism of the executor adds them for every Command and query on REST, MCP and the CLI (a warning a result carries as a field already is not repeated). The app shows them with one component (Warnungen); the Fristen screen shows annual_return_question as its note with a link to Steuern > Einstellungen.
Route Use
GET / and static files the embedded app (app/dist); Content-Security-Policy: default-src 'self'; img-src 'self' data: blob:; frame-src 'self' blob:; style-src 'self' 'unsafe-inline'; frame-ancestors 'none'; base-uri 'none'; files under assets/ are cached as immutable, everything else no-cache; without a build of the app / is a one-line placeholder
GET /bank/callback the app (index.html), where a bank sends the account holder back with state and code or error (ADR 0058). The app reads the query once, removes it from the address (history.replaceState), never shows or logs it, and calls bank_connection.complete
GET /health {status, time}
GET /v1/openapi.json the OpenAPI document of this instance
GET /v1/files/{ref} download of a file reference (download_url of mandant.export). Same credentials and headers as a Mandant query (X-Decuma-Client: web, the cookie, Decuma-Mandant); the app fetches it and saves the blob. Bound to the session or key that asked for it; expires at gueltig_bis.
POST /v1/files and GET /v1/files/{hash} upload and download of a Beleg’s file (Books 1); both are in the OpenAPI document. CLI: a base64 field (contentEncoding: base64) takes @PATH, decuma download <hash or ref> --to <path> downloads
GET /dev/post decuma dev only: the mail sink, [{an, betreff, text, link}], oldest first
PUT /dev/clock decuma dev only: {time} moves the instance clock

mandant.list, api_key.list and session.list take one parameter schema (Listenabfrage) and answer one shape (Liste):

  • Payload, every field optional: text (substring, case-insensitive, over the list’s text columns), von and bis (dates YYYY-MM-DD, inclusive, over the list’s date column), filter ({column: [values]}, the list’s categorical columns), sortierung (column ascending or -column descending), seite (from 1, default 1), pro_seite (default 50, at most 500), format (json default, or csv).
  • Result: {zeilen: [...], gesamt, alle, seite, pro_seite, csv}: zeilen is the page, gesamt the number of rows after the filters, alle before them (“n von m”), csv with format: "csv" every filtered row in the sorted order as CSV text (null otherwise). A technical list refuses csv with validation.
List text date categorical sortable CSV
mandant.list anzeigename erstellt_am mandantenart anzeigename, mandantenart, erstellt_am yes
api_key.list bezeichnung erstellt_am status (aktiv, widerrufen, abgelaufen) bezeichnung, erstellt_am, gueltig_bis no
session.list adresse erstellt_am erstellt_am, laeuft_ab_am no