Repository navigation
Expand file tree
/
Copy pathopenapi.yaml
More file actions
7563 lines (7332 loc) · 416 KB
/
Copy pathopenapi.yaml
File metadata and controls
7563 lines (7332 loc) · 416 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.1.0
info:
title: Ledgerline API
version: 1.743.0
license:
name: Proprietary
description: >
Plaintext-relational personal cloud API for the Ledgerline mobile client.
**Architecture:** every module is a relational table exposed over per-record
REST (soft-delete trash + optimistic-concurrency `version`). ALL user content is
plaintext at rest since v1.516.0 — confidentiality at rest is an infrastructure
concern (LUKS full-disk encryption + encrypted backups). Only OPERATIONAL SECRETS
(SMTP / backup / Paperless credentials, backup passphrases) remain encrypted at
rest via the Laravel `encrypted` cast (APP_KEY) and are never serialised into any
response. The client sends and receives plaintext over TLS. Binary files (invoice
PDFs, receipts) are stored as plaintext bytes and streamed by id. (The former
zero-knowledge / vault / sealed-store model was fully removed in the v1.5xx pivot.)
**Authentication:** obtain a Sanctum bearer token via the device pairing
exchange (QR code scan + owner approval in the web UI), then include it as
`Authorization: Bearer <token>` on every request. All routes except the two
pairing endpoints require the `device` Sanctum ability. Sanctum's absolute
token lifetime is shortened to 60 days for the internet-facing deployment
(v1.562.0); re-pair / re-login to renew (idle + remote-wipe revocation apply
on top). Login also requires a verified email address before a bearer is
minted (403 `{status:"verify-email"}`), and a blocked account fails auth
generically (no enumeration).
**Rate limiting (enforced, v1.562.0):** since the app is served publicly via
the NetBird proxy (`https://home.pinlo.me`), the former LAN-only no-op
throttling was reversed — every throttled route now genuinely returns
**429** with a `Retry-After` header. Named web limiters: login 5/min,
two-factor challenge 5/min (TOTP is no longer online-brute-forceable),
fortify 20/min, auth-pair 30/min, dav 120/min, share-unlock 10/min, invite
10/min. The `/api/v1` endpoints carry inline per-minute throttles (e.g.
`/auth/login` 10/min, the `/auth/{reset,forgot,register}` broker routes
6/min, `/invite/*` 20/min, `/backup/jobs/{job}/run` 10/min,
`/finance/transactions/bulk` 120/min); handle 429 by backing off for
`Retry-After` seconds.
**Web-only surfaces (intentionally no /api/v1 twin):** per-user Paperless
CONFIGURATION (URL/token/enabled + connection test) and the workspace-admin
settings — notification channels (mail/ntfy/webhook) edit/update/test, system
settings + error resolution, the `max_connected_devices` security setting, and
the self-registration toggle — are managed in the web UI only. (Backup, users,
groups, security-log and the company profile ARE mirrored on the API.)
**Forced 2FA (workspace policy):** when an admin enables `force_2fa`, EVERY
authenticated `/api/v1` request from an account without a confirmed second
factor returns **403** `{status:"two_factor_required"}` (see the
`TwoFactorRequired` response), except the enrollment/escape endpoints
(`/me`, `/auth/logout`, `/preferences`, `/locale`, `/theme`,
`/user/two-factor*`). Clients should route the user to 2FA enrollment on
that status. This is a workspace-wide gate applied by middleware, not a
per-operation flag.
**Response security headers (v1.562.0):** responses carry a tightened header
set for the internet-facing deployment — `Content-Security-Policy` with
`frame-ancestors 'self'` + `X-Frame-Options: SAMEORIGIN` (framing default
reversed from `*`), a broadened `Permissions-Policy` denylist, and stripped
`Server`/`X-Powered-By`. These are transport headers, not JSON — clients need
no changes.
servers:
- url: /api/v1
description: Current stable API base path
security:
- bearerAuth: []
tags:
- name: Auth
description: Device pairing exchange and session management
- name: Passkeys
description: >
WebAuthn passkeys / hardware security keys (YubiKey, Nitrokey, platform
authenticators) via web-auth/webauthn-lib. Public login pair mints a
device bearer token; management endpoints require the authenticated user
plus a current-password step-up to register. Public-key only at rest
(none-attestation).
- name: Me/Device
description: Authenticated user info, avatar, and device heartbeat
- name: Finance
- name: Devices
description: Connected device listing, revocation, and remote-wipe management
- name: Notifications
description: In-app notification bell — list recent items, mark read
- name: Account
description: GDPR data export, account deletion, and session revocation
- name: Preferences
description: User preferences — locale and colour-scheme
- name: Groups
description: >
Admin group management (requires the admin role on top of the device token).
A group is a reusable limit template (device cap + module allow-list) plus a
shareable flag; membership is many-to-many. Limits and membership are non-secret
metadata.
- name: Company
description: >
Per-user company profile and invoice defaults (the Finance module's business
identity + numbering/appearance settings). This is the user's OWN business
identity that prints on every invoice — non-secret, served in the clear like the
avatar (it is the business's own identity, never customer data).
The invoice records, payment methods and imported bank transactions themselves
live in the relational finance tables (see the Finance tag).
- name: Status
description: Application availability / health check (the site-root /up up-check).
- name: TwoFactor
description: >
Self-service TOTP two-factor + app-password management for a paired device
(Sanctum bearer). Mirrors the web Fortify flow, which is browser-only.
- name: DevicePairings
description: >
Owner-side device pairing: an already-paired device generates a code, polls
it, and approves/rejects the new device's claim. Owner-scoped.
- name: Users
description: >
Admin user management (requires the admin role on top of the device token —
`can:manage-global-settings`). No credentials (password hashes, 2FA secrets)
are ever returned. Non-admins get 403.
- name: Backup
description: >
Admin backup management (admin role + device token). Credential hygiene is
enforced: destination `config` (cloud credentials) and job `passphrase` are
NEVER present in any response. A database job with encrypt=false is refused
(422) — a DB dump contains all data (plaintext) plus the encrypted operational
secrets, and must never leave the box unencrypted.
- name: SecurityLog
description: >
Admin, read-only, metadata-only audit trail (admin role + device token). Rows
never contain tokens/keys/ciphertext.
- name: SecurityPortal
description: >
Admin security portal (admin role + device token): verbose HTTP request log
with CSV/JSON export, IP block-list CRUD, per-user block toggle, and a
cross-user session/device overview.
- name: Paperless
description: >
Per-user Paperless-ngx integration: cached term quick-picks, live term
creation, cache sync, and document forwarding. `POST /paperless/documents` is
a transient-cleartext boundary (like POST /invoices/ocr): the client posts the
raw document bytes, the server forwards them to the user's own Paperless
instance and stores/logs nothing. Per-user Paperless CONFIGURATION (URL / token
/ enabled flag) is managed via GET/PUT /paperless/config + POST
/paperless/config/test; the API token is never returned (has_token bool).
- name: Settings
description: >
Admin workspace settings (requires the admin role on top of the device token —
`can:manage-global-settings`): outgoing notifications (SMTP/NTFY/webhook) with a
test send, the paired-device cap, the Files upload/orphan-grace limits, and the
read-only System/maintenance overview. Operative secrets (SMTP password, ntfy
token, webhook secret) are NEVER returned — a GET reports has_* booleans and a
blank submission preserves the stored secret. Non-admins get 403.
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: Sanctum
description: >
First-party Sanctum token with ability `device`. Obtained via the
pairing exchange. Include as `Authorization: Bearer <token>`.
responses:
Unauthorized:
description: Unauthenticated — missing, invalid, or expired bearer token.
Forbidden:
description: >
Forbidden — the Sanctum token lacks the required `device` ability, the
Finance module is disabled for this account (module:finance gate), or (on
admin routes) the caller is not an admin (manage-global-settings).
TwoFactorRequired:
description: >
Two-factor enrollment required. When the workspace has `force_2fa`
enabled (admin security policy), EVERY authenticated `/api/v1` request
from an account without a confirmed second factor returns this, EXCEPT
the enrollment/escape endpoints (`/me`, `/auth/logout`, `/preferences`,
`/locale`, `/theme`, `/user/two-factor*`). Enroll a second factor to
clear it. Body `status` is `two_factor_required` (distinct from the
generic Forbidden). Enforced by the EnsureTwoFactorEnrolled middleware.
content:
application/json:
schema:
type: object
properties:
status: { type: string, enum: [two_factor_required] }
message: { type: string }
NotFound:
description: Not found, or not owned by the caller (owner-scoped; existence is not leaked).
ValidationError:
description: Validation failed.
content:
application/json:
schema: { $ref: "#/components/schemas/ValidationError" }
FinanceV2QuoteUnprocessable:
description: Quote input validation or a stable quote-domain rejection.
content:
application/json:
schema: { $ref: "#/components/schemas/FinanceV2QuoteUnprocessable" }
VersionConflict:
description: >
Optimistic-concurrency conflict — the stored `version` no longer matches the
`version` sent. Re-fetch the row, merge, and retry.
content:
application/json:
schema: { $ref: "#/components/schemas/VersionConflict" }
RateLimited:
description: >
Too many requests — the route's per-minute rate limit was exceeded.
Rate limiting is genuinely enforced again on the internet-facing
deployment (v1.562.0); it was inert under the former LAN-only build.
Back off and retry after the `Retry-After` interval.
headers:
Retry-After:
description: Seconds to wait before retrying (standard throttle header).
schema: { type: integer }
schemas:
WebauthnCredential:
type: object
description: A registered passkey / hardware key (public-key only, owner-scoped).
properties:
id: { type: integer }
name: { type: [string, "null"] }
last_used_at: { type: [string, "null"], format: date-time }
created_at: { type: [string, "null"], format: date-time }
ValidationError:
type: object
description: >
Laravel validation-failure body (HTTP 422). `errors` maps each failed field
to its messages.
required: [message, errors]
properties:
message: { type: string }
errors:
type: object
additionalProperties: { type: array, items: { type: string } }
VersionConflict:
type: object
description: >
Optimistic-concurrency conflict body. `version` is the current stored
version the client should rebase onto.
required: [error, version]
properties:
error: { type: string, enum: [version_conflict] }
version: { type: integer }
FinanceError:
type: object
description: "Business-rule rejection body: a machine-readable `error` code (HTTP 422)."
required: [error]
properties:
error: { type: string }
TransactionReceipt:
type: object
description: >
A receipt entry embedded in a bank transaction's `receipts[]`. File receipts
are created only via POST /finance/transactions/{transaction}/receipts;
`blob_path` is the SERVER-owned on-disk path (never accepted from the client).
Fileless entries (invoice links / Eigenbeleg metadata) may be added via the
transaction PUT.
required: [id, name, kind, tags, locked, trashed]
properties:
id: { type: string, description: "UUID assigned server-side." }
blob_path: { type: [string, "null"], description: "Server-owned storage path under invoices/ (read-only; response only)." }
name: { type: string }
mime: { type: [string, "null"] }
kind: { type: string, example: receipt, description: "e.g. receipt | invoice | eigenbeleg." }
category: { type: [string, "null"] }
tags: { type: array, items: { type: string } }
contactId: { type: [string, "null"] }
partnerId: { type: [integer, "null"] }
sig: { type: [string, "null"], description: "Content signature ({size}:{sha256 of head+tail}), the same one finance_receipts.sig carries. Lets the receipt inbox recognise a document that is already filed at a booking instead of uploading a second copy." }
vat: { type: [string, "null"] }
locked: { type: boolean, description: "A locked receipt (e.g. an auto-linked invoice) cannot be deleted." }
trashed: { type: boolean }
removed_from_server: { type: boolean, description: "The origin copy has been deleted; the archived copy is the only one left." }
PaperlessConfig:
type: object
description: >
Per-user Paperless connection config. The API token is never returned;
`has_token` reports whether one is stored.
required: [paperless_enabled, paperless_url, has_token, counts]
properties:
paperless_enabled: { type: boolean }
paperless_url: { type: [string, "null"], format: uri }
has_token: { type: boolean }
counts:
type: object
required: [tag, document_type, correspondent]
properties:
tag: { type: integer }
document_type: { type: integer }
correspondent: { type: integer }
NotificationConfig:
type: object
description: >
Workspace notification config with secrets masked. Secret values
(smtp_password / ntfy_token / webhook_secret) are represented only by
has_* booleans and are never returned.
required:
[mail_enabled, has_smtp_password, ntfy_enabled, has_ntfy_token, webhook_enabled, has_webhook_secret]
properties:
mail_enabled: { type: boolean }
smtp_host: { type: [string, "null"] }
smtp_port: { type: [integer, "null"] }
smtp_encryption: { type: [string, "null"], enum: [tls, ssl, null] }
smtp_username: { type: [string, "null"] }
smtp_from_address: { type: [string, "null"], format: email }
smtp_from_name: { type: [string, "null"] }
has_smtp_password: { type: boolean }
ntfy_enabled: { type: boolean }
ntfy_url: { type: [string, "null"], format: uri }
ntfy_topic: { type: [string, "null"] }
has_ntfy_token: { type: boolean }
webhook_enabled: { type: boolean }
webhook_url: { type: [string, "null"], format: uri }
has_webhook_secret: { type: boolean }
NotificationConfigWrite:
type: object
description: >
Notification config update. Only submitted fields are persisted. Secret
fields (smtp_password/ntfy_token/webhook_secret) preserve the stored value
when omitted or blank.
properties:
mail_enabled: { type: boolean }
smtp_host: { type: [string, "null"], maxLength: 255, description: "SSRF-guarded (v1.562.0): a host resolving to a link-local / cloud-metadata / internal range is rejected with 422 (parity with ntfy_url/webhook_url)." }
smtp_port: { type: [integer, "null"], minimum: 1, maximum: 65535 }
smtp_encryption: { type: [string, "null"], enum: [tls, ssl, null] }
smtp_username: { type: [string, "null"], maxLength: 255 }
smtp_password: { type: [string, "null"], maxLength: 255, description: "Blank/omitted keeps the stored secret." }
smtp_from_address: { type: [string, "null"], format: email, maxLength: 255 }
smtp_from_name: { type: [string, "null"], maxLength: 255 }
ntfy_enabled: { type: boolean }
ntfy_url: { type: [string, "null"], format: uri, maxLength: 255 }
ntfy_topic: { type: [string, "null"], maxLength: 255 }
ntfy_token: { type: [string, "null"], maxLength: 255, description: "Blank/omitted keeps the stored secret." }
webhook_enabled: { type: boolean }
webhook_url: { type: [string, "null"], format: uri, maxLength: 255 }
webhook_secret: { type: [string, "null"], maxLength: 255, description: "Blank/omitted keeps the stored secret." }
SecurityPolicy:
type: object
description: "Workspace security policy: device cap, password policy and force-2FA."
properties:
max_connected_devices: { type: integer }
pw_min_length: { type: [integer, "null"] }
pw_require_mixed_case: { type: boolean }
pw_require_numbers: { type: boolean }
pw_require_symbols: { type: boolean }
pw_check_breaches: { type: boolean }
force_2fa: { type: boolean }
SystemOverview:
type: object
description: "Read-only operational overview (metadata only — no secrets)."
required: [tasks, status, trend, errors, audit]
properties:
tasks:
type: array
items:
type: object
properties:
name: { type: string }
expression: { type: string }
lastAt: { type: [string, "null"] }
lastOk: { type: [boolean, "null"] }
status:
type: object
description: "SystemStatus snapshot (version/queue/storage/errors/backup/scheduler/disk)."
additionalProperties: true
trend:
type: object
description: "Storage trend over ~30 days ({points, deltaBytes, deltaDays})."
additionalProperties: true
errors:
type: array
items:
type: object
properties:
id: { type: integer }
level: { type: [string, "null"] }
exception: { type: [string, "null"] }
message: { type: [string, "null"] }
file: { type: [string, "null"] }
line: { type: [integer, "null"] }
count: { type: integer }
first_seen_at: { type: [string, "null"] }
last_seen_at: { type: [string, "null"] }
resolved_at: { type: [string, "null"] }
audit:
type: array
items:
type: object
properties:
id: { type: integer }
action: { type: string }
actor: { type: [string, "null"] }
ip: { type: [string, "null"] }
meta: { type: [object, "null"], additionalProperties: true }
created_at: { type: [string, "null"] }
CompanyProfile:
type: object
description: >
Per-user company profile + invoice defaults (the business identity that prints
on invoices). Non-secret. All fields are optional; on PUT, only the fields sent
are updated. `has_logo` is read-only (response only).
properties:
company_name: { type: [string, "null"], maxLength: 200 }
company_address: { type: [string, "null"], maxLength: 1000 }
company_email: { type: [string, "null"], format: email, maxLength: 200 }
company_phone: { type: [string, "null"], maxLength: 100 }
company_tax_id: { type: [string, "null"], maxLength: 100 }
company_vat_id: { type: [string, "null"], maxLength: 100 }
company_iban: { type: [string, "null"], maxLength: 60 }
company_bic: { type: [string, "null"], maxLength: 20 }
company_bank_name: { type: [string, "null"], maxLength: 200 }
invoice_number_format: { type: [string, "null"], maxLength: 40, description: "e.g. YYYY-NNNN. Locked client-side once the current year has invoices (GoBD)." }
invoice_next_number: { type: [integer, "null"], minimum: 1, maximum: 100000000, description: "Numbering floor; the actual next number is derived per year from the invoices." }
invoice_default_vat_rate: { type: [number, "null"], minimum: 0, maximum: 100 }
small_business: { type: boolean, description: "§19 Kleinunternehmer — when true, invoices show no VAT and the VAT return reports zero output VAT." }
invoice_payment_terms_days: { type: [integer, "null"], minimum: 0, maximum: 365 }
invoice_footer_text: { type: [string, "null"], maxLength: 2000 }
invoice_accent_color: { type: [string, "null"], pattern: "^#[0-9a-fA-F]{6}$" }
invoice_heading_color: { type: [string, "null"], pattern: "^#[0-9a-fA-F]{6}$" }
invoice_template: { type: [string, "null"], enum: [editorial, modern, elegant, klassisch, schlicht] }
invoice_payment_methods: { type: [string, "null"], maxLength: 500 }
invoice_payment_terms_text: { type: [string, "null"], maxLength: 1000 }
company_website: { type: [string, "null"], maxLength: 255 }
company_contacts: { type: array, maxItems: 20, items: { type: object, properties: { name: { type: [string, "null"] }, role: { type: [string, "null"] }, email: { type: [string, "null"] }, phone: { type: [string, "null"] } } } }
invoice_font: { type: [string, "null"], maxLength: 80 }
invoice_vat_ist: { type: boolean, description: "Ist-Versteuerung (cash-basis VAT) toggle." }
has_logo: { type: boolean, readOnly: true, description: "Whether a company logo is stored (GET /company/logo)." }
Group:
type: object
description: >
A user group: a reusable limit template plus a shareable flag. Limits are
nullable (null = the group sets no cap for that dimension). Non-secret
metadata.
properties:
id: { type: integer }
name: { type: string, maxLength: 100 }
max_connected_devices: { type: [integer, "null"], description: "Device cap (null = no group cap)." }
shareable: { type: boolean, description: "Members may offer this group as a share target." }
modules:
type: [array, "null"]
description: >
Allow-list of enabled module keys for members of this group (null = all
modules). A member's effective modules are the union across their groups
(a group with null grants all); a per-user allow-list overrides. Enforced
server-side and surfaced at /me as user.modules.
items: { type: string, enum: [finance] }
members:
type: array
items:
type: object
properties:
id: { type: integer }
name: { type: string }
email: { type: string }
DisplayPreferences:
type: object
description: >
Global, non-secret DISPLAY preferences — 12/24h clock, date format and a
timezone override. Presentation only. Returned in GET /me and set via
POST /preferences; the client applies them to its own rendering.
properties:
time_format: { type: string, enum: [24h, 12h] }
timezone: { type: [string, "null"], description: "Hard IANA timezone override (e.g. Europe/Berlin); null follows the browser/system zone." }
date_format: { type: string, enum: [system, dmy, dmy_dot, mdy, ymd], description: "Date-format preset; 'system' uses the locale's regional format." }
notifications:
type: object
description: "Per-category push prefs, keyed by notification category (e.g. server/finance_bank_csv/reminder). Absent category = push enabled."
additionalProperties:
type: object
properties:
push: { type: boolean, description: "false suppresses push for this category (the centre row is still created)." }
MeUser:
type: object
description: >
The authenticated user's profile. Returned as the `user` object by GET /me
and by POST /auth/pair/collect (when `status: approved`). All fields are
non-secret metadata — no credentials (password hash, 2FA secret) are included.
required: [id, name, email, locale, groups, modules, has_avatar, two_factor, preferences, theme]
properties:
id: { type: integer }
name: { type: string }
email: { type: string, format: email }
locale:
type: string
description: "The user's UI locale (one of the configured languages, e.g. en, de, ru)."
groups:
type: array
description: >
Derived from the first-party role: `["admin"]` for admins, `[]` otherwise.
The historical claim shape is kept so existing mobile clients need no
change — there is no separate `role` field.
items: { type: string }
modules:
type: array
description: >
The application module keys this account may use (per-user / per-group
toggles). A native client should hide the tabs for modules NOT listed
here; the API also enforces it — a disabled module's store endpoints
return 403.
items: { type: string, enum: [finance] }
has_avatar:
type: boolean
description: "Whether a non-secret avatar is stored. True → fetch it via GET /api/v1/avatar (Bearer)."
two_factor:
type: boolean
description: "Whether TOTP two-factor authentication is confirmed for the account."
preferences:
allOf:
- $ref: "#/components/schemas/DisplayPreferences"
description: "Non-secret display preferences (units + 12/24h clock); set via POST /api/v1/preferences."
theme:
type: string
enum: [light, dark, system]
description: "Current UI theme (set via POST /api/v1/theme)."
OkResponse:
type: object
description: Acknowledgement response.
required: [ok]
properties:
ok:
type: boolean
example: true
Invoice:
type: object
description: >
Invoice (relational table invoices). All columns are plaintext at rest since
v1.516.0 (confidentiality is an infra concern: LUKS + encrypted backups).
customer/lines/versions are JSON columns; money + number/date drive stats +
GoBD numbering. number/seq/year/type=credit_note/cancels_invoice_id/pdf_path/
version/version_seq are server-managed and never mass-assigned via CRUD.
properties:
id: { type: integer }
user_id: { type: integer, description: "Owner (stamped server-side; read-only)." }
number: { type: [string, "null"] }
seq: { type: [integer, "null"] }
year: { type: [integer, "null"] }
status: { type: string, enum: [draft, final, sent, paid] }
type: { type: string, enum: [invoice, credit_note], description: "Document kind. A credit note (Storno/Gutschrift) reverses a finalized invoice and carries its own GoBD number." }
cancels_invoice_id: { type: [integer, "null"], description: "For a credit note, the id of the invoice it cancels (server-set, never mass-assigned)." }
issue_date: { type: [string, "null"] }
due_date: { type: [string, "null"] }
currency: { type: string }
vat_rate: { type: [string, "null"] }
gross: { type: [string, "null"] }
net: { type: [string, "null"] }
vat: { type: [string, "null"] }
discount_type: { type: [string, "null"], enum: [percent, amount, null], description: "Global invoice-level discount kind (Rabatt) on the net taxable base." }
discount_value: { type: [string, "null"], description: "Discount value: a percentage when discount_type=percent, else an absolute amount." }
skonto_percent: { type: [string, "null"], description: "Early-payment Skonto percentage printed on the invoice." }
skonto_days: { type: [integer, "null"], description: "Early-payment Skonto window in days from the issue date." }
imported: { type: boolean }
paid_at: { type: [string, "null"], format: date-time }
sent_at: { type: [string, "null"], format: date-time, description: "When the invoice PDF was emailed to the customer." }
reminded_at: { type: [string, "null"], format: date-time, description: "When a payment reminder (dunning) was last sent." }
reminder_count: { type: integer, description: "Dunning level (Mahnstufe) — how many customer reminders have gone out." }
payment_account: { type: [string, "null"] }
partner_id: { type: [integer, "null"] }
pdf_path: { type: [string, "null"] }
customer: { type: [object, "null"], additionalProperties: true, description: "Denormalised customer snapshot (nullable). May carry `invoiceEmail` (dedicated Rechnungs-E-Mail, preferred over `email` when emailing/dunning) alongside name/attn/address/email/vatId/partnerId." }
lines: { type: [array, "null"], items: { type: object, additionalProperties: true } }
note: { type: [string, "null"] }
versions:
type: [array, "null"]
description: "GoBD correction trail. Pass a version's `seq` as `version_seq` to the PDF ops to read/attach that version's own PDF."
items:
type: object
properties:
seq: { type: integer, description: "Version sequence — pass as version_seq to the PDF ops." }
label: { type: [string, "null"] }
pdf: { type: [string, "null"], description: "Stored blob path of this version's own PDF (read-only)." }
additionalProperties: true
version_seq: { type: integer }
version: { type: integer }
created_at: { type: string, format: date-time }
updated_at: { type: string, format: date-time }
deleted_at: { type: [string, "null"], format: date-time }
FinancePartner:
type: object
description: "Geschäftspartner (relational finance_partners). All columns plaintext at rest since v1.516.0."
properties:
id: { type: integer }
user_id: { type: integer, description: "Owner (stamped server-side; read-only)." }
name: { type: string }
category: { type: [string, "null"] }
url: { type: [string, "null"] }
logo: { type: [string, "null"] }
note: { type: [string, "null"] }
address: { type: [string, "null"] }
email: { type: [string, "null"] }
invoice_email: { type: [string, "null"], description: "Dedicated invoice email (Rechnungs-E-Mail); invoices are sent here when set, else the general email." }
phone: { type: [string, "null"] }
vat_id: { type: [string, "null"] }
hourly_rate: { type: [string, "null"], description: "Default hourly rate as a decimal string (decimal:2 cast); prefills invoice line items for this partner." }
customer_number: { type: [string, "null"], description: "Assigned by the server on create from the `customer_number_format` template, unless the caller supplies one (migrating from another system). Only for a party we sell to — a supplier has no use for ours. Binned partners keep their number out of circulation." }
kind: { type: [string, "null"], enum: [customer, supplier, both, lead, null], description: "What the partner is to us. The column existed unused since the pivot and carries this meaning from v1.782.0." }
payment_terms_days: { type: [integer, "null"], description: "Prefills a new document's due date." }
discount_percent: { type: [string, "null"], description: "Standing discount; prefills a new document." }
delivery_address: { type: [string, "null"], description: "Where goods go, when that is not where the invoice goes." }
archived_at: { type: [string, "null"], format: date-time, description: "Hidden from the pickers but not gone; its documents still point at it." }
currency: { type: [string, "null"], description: "ISO 4217 code used when invoicing this partner." }
contacts: { type: array, items: { type: object, additionalProperties: true } }
version: { type: integer }
created_at: { type: string, format: date-time }
updated_at: { type: string, format: date-time }
deleted_at: { type: [string, "null"], format: date-time }
PaymentMethod:
type: object
description: "Payment method (relational payment_methods; all columns plaintext since v1.516.0)."
properties:
id: { type: integer }
user_id: { type: integer, description: "Owner (stamped server-side; read-only)." }
type: { type: string, enum: [bank, card, paypal, cash, other] }
name: { type: string }
scope: { type: string, enum: [business, private], description: "Business or private. An account always states its scope; its bookings inherit it. Existing accounts read as business." }
holder: { type: [string, "null"] }
note: { type: [string, "null"] }
business: { type: boolean }
url: { type: [string, "null"] }
icon: { type: [string, "null"] }
iban: { type: [string, "null"] }
bic: { type: [string, "null"] }
bank: { type: [string, "null"] }
account_no: { type: [string, "null"] }
card_number: { type: [string, "null"] }
card_network: { type: [string, "null"] }
card_expiry: { type: [string, "null"] }
paypal_email: { type: [string, "null"] }
version: { type: integer }
created_at: { type: string, format: date-time }
updated_at: { type: string, format: date-time }
deleted_at: { type: [string, "null"], format: date-time }
FinanceProject:
type: object
description: "Cost project (relational finance_projects, nestable via parent_id) and the unit of planning: tasks and logged hours hang off it."
properties:
id: { type: integer }
user_id: { type: integer, description: "Owner (stamped server-side; read-only)." }
parent_id: { type: [integer, "null"] }
name: { type: string }
kind: { type: string, enum: [business, private] }
note: { type: [string, "null"] }
expenses: { type: [array, "null"], items: { $ref: "#/components/schemas/ProjectExpense" }, description: "Hand-typed ledger rows (nullable). Stored verbatim as JSON — the server validates only that it is an array of at most 5000 items." }
status: { type: string, enum: [planned, active, on_hold, done, cancelled], description: "on_hold and cancelled are the two states that are neither progress nor completion." }
starts_on: { type: [string, "null"], format: date }
due_on: { type: [string, "null"], format: date }
budget_net: { type: [string, "null"], description: "What it may cost, net. Compared against the ledger; nothing is enforced — a project over budget is information, not an error." }
partner_id: { type: [integer, "null"], description: "Whose project it is. Also supplies the hourly rate frozen onto new time entries." }
quote_id: { type: [integer, "null"], description: "The quote it came from, when it came from one. Server-owned." }
version: { type: integer }
created_at: { type: string, format: date-time }
updated_at: { type: string, format: date-time }
deleted_at: { type: [string, "null"], format: date-time }
ProjectExpense:
type: object
description: |
One hand-typed row of a project's ledger, stored inside
`finance_projects.expenses`. The column is free-form JSON: the server
persists it as sent and only reads `date`, `amount`, `direction` and
`category` for the EÜR, so a client MUST round-trip unknown keys rather
than dropping them.
`direction: 'in'` is a Zubuchung (a refund/credit booked on the project)
and REDUCES the expense total in `GET /finance/reports/euer`;
`direction: 'out'` (and a legacy row that carries no `direction` at all)
is a Abbuchung and adds to it. `amount` is unsigned — the sign lives in
`direction`.
properties:
id: { type: string, description: "Client-generated row id (stable across edits; used to update/delete a single row)." }
direction: { type: string, enum: [out, in], default: out, description: "out = spend (Abbuchung), in = credit (Zubuchung)." }
amount: { type: number, description: "Unsigned amount, gross." }
date: { type: [string, "null"], format: date, description: "Booking date (YYYY-MM-DD); the EÜR buckets by its year." }
title: { type: [string, "null"], description: "Short label shown in the ledger (Bezeichnung), e.g. \"Excavator rental\"." }
note: { type: [string, "null"], description: "Longer free-text description (Beschreibung)." }
category: { type: [string, "null"], description: "Free-text expense category — matched by name against the managed finance categories (for the Sachkonto) and used as the EÜR grouping label." }
payment_method_id: { type: [integer, "null"], description: "Which account the money moved through (informational; not validated server-side)." }
FinancePartnerNote:
type: object
description: "One entry in a partner's contact log. `occurred_at` is when it happened; `created_at` is when it was typed, which can be days later."
properties:
id: { type: integer }
user_id: { type: integer }
finance_partner_id: { type: integer }
kind: { type: string, enum: [call, meeting, mail, note] }
body: { type: string }
occurred_at: { type: string, format: date-time }
created_at: { type: [string, "null"], format: date-time }
updated_at: { type: [string, "null"], format: date-time }
FinanceProduct:
type: object
description: "A sellable article. `stock_qty` is a denormalised read of the movement ledger, written only alongside a movement; treat it as reporting, not as an input."
properties:
id: { type: integer }
user_id: { type: integer }
kind: { type: string, enum: [service, hardware] }
sku: { type: [string, "null"], description: "Article number. Unique among an owner's live articles; a binned one frees it." }
name: { type: string }
description: { type: [string, "null"] }
unit: { type: [string, "null"], description: "Free text — hour, piece, day, flat rate. Every trade names its units differently." }
price_net: { type: string, description: "Decimal as string (decimal:2 cast)." }
purchase_price: { type: [string, "null"], description: "What it cost us. Used to show a margin; never printed on a document that leaves the house." }
vat_rate: { type: [string, "null"], description: "null = fall back to the company default rate." }
supplier_id: { type: [integer, "null"] }
category: { type: [string, "null"] }
active: { type: boolean }
track_stock: { type: boolean }
stock_qty: { type: string, description: "Decimal as string (decimal:3). Fractional on purpose: 2.5 hours, 0.5 metres." }
stock_min: { type: [string, "null"], description: "Reorder level. null = never warn." }
note: { type: [string, "null"] }
version: { type: integer }
created_at: { type: [string, "null"], format: date-time }
updated_at: { type: [string, "null"], format: date-time }
deleted_at: { type: [string, "null"], format: date-time }
FinanceProductInput:
type: object
description: "Create/update body. Stock fields are absent on purpose — see the stock endpoint."
properties:
kind: { type: string, enum: [service, hardware] }
sku: { type: [string, "null"], maxLength: 64 }
name: { type: string, maxLength: 300 }
description: { type: [string, "null"], maxLength: 5000 }
unit: { type: [string, "null"], maxLength: 32 }
price_net: { type: [number, "null"] }
purchase_price: { type: [number, "null"] }
vat_rate: { type: [number, "null"], minimum: 0, maximum: 100 }
supplier_id: { type: [integer, "null"], description: "Must be one of the caller's own partners." }
category: { type: [string, "null"], maxLength: 160 }
active: { type: [boolean, "null"] }
track_stock: { type: [boolean, "null"] }
note: { type: [string, "null"], maxLength: 5000 }
version: { type: [integer, "null"], description: "Send it to get a 409 instead of a blind overwrite." }
FinanceStockMovement:
type: object
description: "One movement of goods. Append-only: no update, no delete, no soft delete — a stock figure is only trustworthy if the steps behind it cannot be rewritten."
properties:
id: { type: integer }
user_id: { type: integer }
finance_product_id: { type: integer }
qty: { type: string, description: "Signed decimal as string. In positive, out negative." }
reason: { type: string, enum: [purchase, sale, correction, return, initial] }
ref_type: { type: [string, "null"], enum: [invoice, quote, manual, null], description: "What caused it. A loose reference, not a foreign key, so deleting a document cannot erase the fact that goods moved." }
ref_id: { type: [string, "null"] }
note: { type: [string, "null"] }
occurred_at: { type: string, format: date-time }
created_at: { type: [string, "null"], format: date-time }
FinanceDocumentLine:
type: object
description: "One line of a quote or invoice. The SAME shape on both, which is what makes converting a quote a copy rather than a translation, and lets the cent-exact totals mathematics stay one implementation."
properties:
desc: { type: string }
qty: { type: number }
unit: { type: [string, "null"] }
unitPrice: { type: number }
vatRate: { type: [number, "null"] }
kind: { type: [string, "null"], enum: [service, hardware, null] }
productId: { type: [integer, "null"], description: "The catalogue article this line came from. What lets a finalised invoice move stock." }
FinanceProjectTask:
type: object
description: "A piece of work under a project. A milestone is the same row with `is_milestone` set — a date that matters with no work in it."
properties:
id: { type: integer }
user_id: { type: integer }
finance_project_id: { type: integer }
title: { type: string }
description: { type: [string, "null"] }
status: { type: string, enum: [open, in_progress, done] }
starts_on: { type: [string, "null"], format: date }
due_on: { type: [string, "null"], format: date }
estimate_hours: { type: [string, "null"], description: "Hours quoted for this piece of work, decimal as string." }
is_milestone: { type: boolean }
sort: { type: integer, description: "Hand-ordered: task order is a judgement, not a date." }
finance_product_id: { type: [integer, "null"], description: "The catalogue article the quote line came from, when it came from one." }
version: { type: integer }
created_at: { type: [string, "null"], format: date-time }
updated_at: { type: [string, "null"], format: date-time }
deleted_at: { type: [string, "null"], format: date-time }
FinanceProjectTaskInput:
type: object
properties:
title: { type: string, maxLength: 300 }
description: { type: [string, "null"], maxLength: 20000 }
status: { type: [string, "null"], enum: [open, in_progress, done, null] }
starts_on: { type: [string, "null"], format: date }
due_on: { type: [string, "null"], format: date }
estimate_hours: { type: [number, "null"] }
is_milestone: { type: [boolean, "null"] }
sort: { type: [integer, "null"] }
version: { type: [integer, "null"] }
FinanceTimeEntry:
type: object
description: "Hours worked. `hourly_rate` is frozen here rather than read from the partner at invoicing time, so a later rate change cannot rewrite what past work was worth. `invoiced_invoice_id` is set once and never cleared — that is the protection against billing the same hour twice."
properties:
id: { type: integer }
user_id: { type: integer }
finance_project_id: { type: integer }
finance_project_task_id: { type: [integer, "null"], description: "Optional: not everything worth logging was planned." }
date: { type: string, format: date }
hours: { type: string }
description: { type: [string, "null"] }
billable: { type: boolean }
hourly_rate: { type: [string, "null"] }
invoiced_invoice_id: { type: [integer, "null"] }
version: { type: integer }
created_at: { type: [string, "null"], format: date-time }
updated_at: { type: [string, "null"], format: date-time }
deleted_at: { type: [string, "null"], format: date-time }
FinanceTimeEntryInput:
type: object
properties:
finance_project_task_id: { type: [integer, "null"], description: "Must belong to the same project." }
date: { type: [string, "null"], format: date, description: "Defaults to today." }
hours: { type: number, minimum: -24, maximum: 24, description: "Zero is refused: it states nothing." }
description: { type: [string, "null"], maxLength: 20000 }
billable: { type: [boolean, "null"], default: true }
hourly_rate: { type: [number, "null"], description: "Defaults to the customer's rate at the time of logging." }
version: { type: [integer, "null"] }
FinanceQuote:
type: object
description: "A quote (Angebot). Editable only while `status` is draft. `expired` is derived from `valid_until`, never stored — a date does not need a nightly job to become true."
properties:
id: { type: integer }
user_id: { type: integer }
number: { type: [string, "null"], description: "Assigned by the server on send. Never settable by a client." }
seq: { type: [integer, "null"] }
year: { type: [integer, "null"] }
status: { type: string, enum: [draft, sent, accepted, declined] }
partner_id: { type: [integer, "null"] }
customer: { type: [object, "null"], additionalProperties: true, description: "Snapshot of the addressee, kept alongside partner_id so editing the partner cannot rewrite a quote already sent." }
title: { type: [string, "null"] }
issue_date: { type: [string, "null"], format: date }
valid_until: { type: [string, "null"], format: date }
currency: { type: string }
lines: { type: [array, "null"], items: { $ref: "#/components/schemas/FinanceDocumentLine" } }
discount_type: { type: [string, "null"], enum: [percent, amount, null] }
discount_value: { type: [string, "null"] }
net: { type: [string, "null"] }
vat: { type: [string, "null"] }
gross: { type: [string, "null"] }
intro_text: { type: [string, "null"] }
outro_text: { type: [string, "null"] }
note: { type: [string, "null"] }
sent_at: { type: [string, "null"], format: date-time }
accepted_at: { type: [string, "null"], format: date-time }
declined_at: { type: [string, "null"], format: date-time }
converted_invoice_id: { type: [integer, "null"] }
converted_project_id: { type: [integer, "null"] }
pdf_path: { type: [string, "null"] }
version: { type: integer }
created_at: { type: [string, "null"], format: date-time }
updated_at: { type: [string, "null"], format: date-time }
deleted_at: { type: [string, "null"], format: date-time }
FinanceQuoteInput:
type: object
description: "Create/update body. `number`/`seq`/`year`/`status` are absent on purpose: the server owns them, so a client cannot mint or reuse a number."
properties:
title: { type: [string, "null"], maxLength: 300 }
partner_id: { type: [integer, "null"], description: "Must be one of the caller's own partners." }
customer: { type: [object, "null"], additionalProperties: true }
issue_date: { type: [string, "null"], format: date }
valid_until: { type: [string, "null"], format: date }
currency: { type: [string, "null"], maxLength: 8 }
lines: { type: [array, "null"], maxItems: 200, items: { $ref: "#/components/schemas/FinanceDocumentLine" } }
discount_type: { type: [string, "null"], enum: [percent, amount, null] }
discount_value: { type: [number, "null"] }
net: { type: [number, "null"] }
vat: { type: [number, "null"] }
gross: { type: [number, "null"] }
intro_text: { type: [string, "null"], maxLength: 5000 }
outro_text: { type: [string, "null"], maxLength: 5000 }
note: { type: [string, "null"], maxLength: 5000 }
version: { type: [integer, "null"] }
FinanceCategory:
type: object
description: "Receipt category (relational finance_categories, unique per user; no soft deletes)."
properties:
id: { type: integer }
user_id: { type: integer, description: "Owner (stamped server-side; read-only)." }
name: { type: string }
color: { type: [string, "null"], description: "Hex colour #RRGGBB, or null.", example: "#7066f5" }
icon: { type: [string, "null"], description: "Monochrome icon name (heroicons-outline), or null.", example: "hashtag" }
account_no: { type: [string, "null"], description: "Owner-entered Sachkonto/chart-of-accounts code (e.g. SKR03/04) for this category, or null. Free text — the server never assigns or validates a specific number.", example: "4930" }
created_at: { type: [string, "null"], format: date-time }
updated_at: { type: [string, "null"], format: date-time }
VatReturn:
type: object
description: "VAT advance return (Umsatzsteuer-Voranmeldung) figures for a year."
required: [year, net, vat, gross, count, byRate, quarters]
properties:
year: { type: integer }
net: { type: number }
vat: { type: number }
gross: { type: number }
count: { type: integer }
byRate:
type: array
items:
type: object
properties: { rate: { type: number }, net: { type: number }, vat: { type: number } }
quarters:
type: array
items:
type: object
properties: { q: { type: integer }, net: { type: number }, vat: { type: number } }
FinanceKpis:
type: object
description: "Headline revenue KPIs for a year incl. year-over-year net growth."
required: [year, net, count, avg, customers, prevNet]
properties:
year: { type: integer }
net: { type: number }
count: { type: integer }
avg: { type: number }
customers: { type: integer }
prevNet: { type: number }
growthPct: { type: [number, "null"] }
RevenueByCustomer:
type: object
description: "Net/gross revenue for one customer in a year."
properties:
name: { type: string }
net: { type: number }
gross: { type: number }
count: { type: integer }
InvoiceAging:
type: object
description: >
Aging of OPEN invoices (status='sent', not trashed) bucketed by days past
the due date vs today: current (not yet due / no due date), 1-30, 31-60,
60+. Read-only; each bucket carries count + gross sum + the invoice list.
required: [buckets, openCount, openGross]
properties:
openCount: { type: integer }
openGross: { type: number }
buckets:
type: object
properties:
current: { $ref: "#/components/schemas/AgingBucket" }
"1_30": { $ref: "#/components/schemas/AgingBucket" }
"31_60": { $ref: "#/components/schemas/AgingBucket" }
"60_plus": { $ref: "#/components/schemas/AgingBucket" }
AgingBucket:
type: object
required: [count, gross, invoices]
properties:
count: { type: integer }
gross: { type: number }
invoices:
type: array
items:
type: object
properties:
id: { type: integer }
number: { type: [string, "null"] }
customer: { type: string }
gross: { type: number }
due_date: { type: [string, "null"] }
days_overdue: { type: integer }
AccountVatSummary:
type: object
description: "VAT summary of one account's transactions: output/input VAT + payable, by rate."
required: [income, expense, outputVat, inputVat, payable, privateSum, undecided]
properties:
income: { type: array, items: { type: object, properties: { rate: { type: string }, net: { type: number }, vat: { type: number } } } }
expense: { type: array, items: { type: object, properties: { rate: { type: string }, net: { type: number }, vat: { type: number } } } }
outputVat: { type: number }
inputVat: { type: number }
payable: { type: number }
privateSum: { type: number }
undecided: { type: integer }
VatAdvanceReturn:
type: object
description: >
Unified USt-Voranmeldung: output VAT (from realized invoices) minus input
VAT / Vorsteuer (from ALL of the user's bank transactions) = payable
(Zahllast), for a year and optional quarter. For a §19 Kleinunternehmer