@invowerk-dev/sdk 0.0.0-bootstrap.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1301 @@
1
+ export type ClientOptions = {
2
+ baseUrl: 'https://api.invowerk.dev' | (string & {});
3
+ };
4
+ /**
5
+ * Body_render_invoice
6
+ */
7
+ export type BodyRenderInvoice = {
8
+ /**
9
+ * File
10
+ *
11
+ * The invoice XML as a multipart file part.
12
+ */
13
+ file?: Blob | File | null;
14
+ };
15
+ /**
16
+ * Buyer
17
+ *
18
+ * The buyer (BG-7).
19
+ */
20
+ export type Buyer = {
21
+ /**
22
+ * Name
23
+ *
24
+ * Buyer name (BT-44).
25
+ */
26
+ name: string;
27
+ /**
28
+ * Buyer postal address (BG-8).
29
+ */
30
+ address: PostalAddress;
31
+ /**
32
+ * Electronic Address
33
+ *
34
+ * Buyer electronic address (BT-49).
35
+ */
36
+ electronic_address?: string | null;
37
+ };
38
+ /**
39
+ * ContentClass
40
+ *
41
+ * Reminder that the content of an invoice cannot be checked by machine.
42
+ *
43
+ * It never contains findings. A clean result means the invoice is well-formed
44
+ * and follows the rules. It does not mean that prices, amounts or the
45
+ * delivered service are correct.
46
+ */
47
+ export type ContentClass = {
48
+ /**
49
+ * Status
50
+ *
51
+ * Always 'not_machine_checkable'.
52
+ */
53
+ status?: string;
54
+ /**
55
+ * Note
56
+ *
57
+ * Fixed note: a format check cannot judge whether the content is correct.
58
+ */
59
+ note: string;
60
+ };
61
+ /**
62
+ * ConvertResponse
63
+ *
64
+ * The answer of POST /v1/convert?format=json: the XML and the check result.
65
+ */
66
+ export type ConvertResponse = {
67
+ /**
68
+ * Xml
69
+ *
70
+ * The converted e-invoice as XML.
71
+ */
72
+ xml: string;
73
+ /**
74
+ * Syntax
75
+ *
76
+ * The syntax of the XML: 'ubl' or 'cii'.
77
+ */
78
+ syntax: string;
79
+ /**
80
+ * Flavor
81
+ *
82
+ * The rule set of the XML: 'en16931' or 'xrechnung'.
83
+ */
84
+ flavor: string;
85
+ /**
86
+ * The result of invowerk's own check of the XML.
87
+ */
88
+ self_validation: ConvertSelfValidation;
89
+ };
90
+ /**
91
+ * ConvertSelfValidation
92
+ *
93
+ * The result of invowerk's own check of the converted XML.
94
+ *
95
+ * It shows that the XML passed the check before it was returned. An invalid
96
+ * result returns HTTP 500 instead.
97
+ */
98
+ export type ConvertSelfValidation = {
99
+ /**
100
+ * Valid
101
+ *
102
+ * Always true. An invalid result returns HTTP 500 instead.
103
+ */
104
+ valid: boolean;
105
+ /**
106
+ * Finding Count
107
+ *
108
+ * Number of findings of the check; all of them are non-fatal.
109
+ */
110
+ finding_count: number;
111
+ };
112
+ /**
113
+ * CreditsInfo
114
+ *
115
+ * Your credit balance for the current billing period. `granted` is what
116
+ * your plan included, `balance` what is still unspent, and `period_end` the
117
+ * date (ISO 8601) your allowance refills. Present only on plans that are
118
+ * priced in credits.
119
+ */
120
+ export type CreditsInfo = {
121
+ /**
122
+ * Balance
123
+ */
124
+ balance: number;
125
+ /**
126
+ * Granted
127
+ */
128
+ granted: number;
129
+ /**
130
+ * Period End
131
+ */
132
+ period_end?: string | null;
133
+ };
134
+ /**
135
+ * DocumentTotals
136
+ *
137
+ * The document totals (BG-22).
138
+ */
139
+ export type DocumentTotals = {
140
+ /**
141
+ * Line Total
142
+ *
143
+ * Sum of the line net amounts (BT-106).
144
+ */
145
+ line_total: number | string;
146
+ /**
147
+ * Tax Exclusive
148
+ *
149
+ * Invoice total without VAT (BT-109).
150
+ */
151
+ tax_exclusive: number | string;
152
+ /**
153
+ * Tax Inclusive
154
+ *
155
+ * Invoice total with VAT (BT-112).
156
+ */
157
+ tax_inclusive: number | string;
158
+ /**
159
+ * Payable
160
+ *
161
+ * Amount due for payment (BT-115). Defaults to the total with VAT.
162
+ */
163
+ payable?: number | string | null;
164
+ };
165
+ /**
166
+ * ERechnungDe
167
+ *
168
+ * The result mapped onto the categories of the BMF letter of 15.10.2025
169
+ * (Germany).
170
+ *
171
+ * It describes the format check only. It is not a tax assessment (see
172
+ * ``note``).
173
+ */
174
+ export type ERechnungDe = {
175
+ /**
176
+ * Status
177
+ *
178
+ * 'e_rechnung' (no errors), 'e_rechnung_mit_fehlern' (rule errors), 'keine_e_rechnung' (not a structured e-invoice) or 'nicht_pruefbar' (the file could not be checked).
179
+ */
180
+ status: string;
181
+ /**
182
+ * Reason
183
+ *
184
+ * Why this status applies, in German, naming the finding.
185
+ */
186
+ reason: string;
187
+ /**
188
+ * Basis
189
+ *
190
+ * The BMF letter or UStAE passage for the category; null for 'nicht_pruefbar'.
191
+ */
192
+ basis?: string | null;
193
+ /**
194
+ * Note
195
+ *
196
+ * Fixed German note, the same on every answer: invowerk checks the technical format, not whether content and amounts are correct or what tax consequences an error has.
197
+ */
198
+ note: string;
199
+ };
200
+ /**
201
+ * ErrorClasses
202
+ *
203
+ * The findings grouped by where the problem is. ``findings`` has the same
204
+ * findings as one list.
205
+ */
206
+ export type ErrorClasses = {
207
+ /**
208
+ * Format
209
+ *
210
+ * Problems with the file or XML structure: unknown format, malformed XML, a forbidden DOCTYPE, XML schema (XSD) errors.
211
+ */
212
+ format?: Array<Finding>;
213
+ /**
214
+ * Business Rules
215
+ *
216
+ * Failed rules of the applied rule set (EN 16931, XRechnung, ZUGFeRD / Factur-X or Peppol BIS).
217
+ */
218
+ business_rules?: Array<Finding>;
219
+ /**
220
+ * Carrier
221
+ *
222
+ * Problems with the PDF of a ZUGFeRD / Factur-X invoice: PDF/A conformance and how the XML is embedded (BR-HYBRID-* rules). Always empty for an XML file.
223
+ */
224
+ carrier?: Array<Finding>;
225
+ /**
226
+ * Always the not_machine_checkable reminder. Never contains findings.
227
+ */
228
+ content: ContentClass;
229
+ };
230
+ /**
231
+ * Evidence
232
+ *
233
+ * Which file was checked, when, and with which software. Keep it with a
234
+ * saved report: the SHA-256 ties the report to one file.
235
+ */
236
+ export type Evidence = {
237
+ /**
238
+ * Document Sha256
239
+ *
240
+ * Hex SHA-256 of the exact bytes you sent (compare with `sha256sum <file>`).
241
+ */
242
+ document_sha256: string;
243
+ /**
244
+ * Document Bytes
245
+ *
246
+ * Size in bytes of what you sent.
247
+ */
248
+ document_bytes: number;
249
+ /**
250
+ * Checked At
251
+ *
252
+ * UTC time of the check, ISO 8601 to the second, e.g. '2026-09-24T10:15:00Z'.
253
+ */
254
+ checked_at: string;
255
+ /**
256
+ * The software versions.
257
+ */
258
+ validator: ValidatorVersions;
259
+ };
260
+ /**
261
+ * ExplainResponse
262
+ *
263
+ * The answer of GET /v1/explain: one explanation per requested code.
264
+ *
265
+ * Pass several codes with repeated ``?code=`` parameters. If any code is
266
+ * unknown, the call returns HTTP 404 and names it; there is no partial
267
+ * answer.
268
+ */
269
+ export type ExplainResponse = {
270
+ /**
271
+ * Lang
272
+ *
273
+ * Language of all explanations: 'de' or 'en'.
274
+ */
275
+ lang: string;
276
+ /**
277
+ * Explanations
278
+ *
279
+ * One explanation per requested code, in request order, duplicates removed.
280
+ */
281
+ explanations: Array<RuleExplanation>;
282
+ };
283
+ /**
284
+ * Finding
285
+ *
286
+ * One problem found in the invoice.
287
+ *
288
+ * ``error_class`` says where the problem is: in the file or XML structure
289
+ * (``format``), in a rule of the applied rule set (``business_rules``) or in
290
+ * the PDF around the invoice data (``carrier``). ``explain_url`` links the
291
+ * German explanation page for the code. ``explain`` holds the explanation
292
+ * itself when you call with ``?explain=true``.
293
+ */
294
+ export type Finding = {
295
+ /**
296
+ * Rule Id
297
+ *
298
+ * Code of the rule that failed, e.g. 'BR-DE-21', or 'XSD' for a schema error.
299
+ */
300
+ rule_id: string;
301
+ /**
302
+ * Error Class
303
+ *
304
+ * Where the problem is: 'format' (file or XML structure), 'business_rules' (a rule of the applied rule set) or 'carrier' (the PDF around the XML).
305
+ */
306
+ error_class: string;
307
+ /**
308
+ * Severity
309
+ *
310
+ * 'fatal' (the invoice fails the check), 'warning' or 'information'.
311
+ */
312
+ severity: string;
313
+ /**
314
+ * Xpath
315
+ *
316
+ * Where the problem is in the XML (an XPath or a schema line), if known.
317
+ */
318
+ xpath?: string | null;
319
+ /**
320
+ * Message
321
+ *
322
+ * The message of the failed rule or check.
323
+ */
324
+ message: string;
325
+ /**
326
+ * Explain Url
327
+ *
328
+ * Path of the German explanation page /codes/<CODE>, if invowerk has one.
329
+ */
330
+ explain_url?: string | null;
331
+ /**
332
+ * Explain
333
+ *
334
+ * Explanation of the rule (meaning, causes, fixes) in the requested language. Set only with ?explain=true and if invowerk has an entry for the code.
335
+ */
336
+ explain?: {
337
+ [key: string]: unknown;
338
+ } | null;
339
+ };
340
+ /**
341
+ * Flavor
342
+ *
343
+ * The rule set the invoice follows: plain EN 16931, or XRechnung (German rules).
344
+ */
345
+ export type Flavor = 'en16931' | 'xrechnung';
346
+ /**
347
+ * GenerateRequest
348
+ *
349
+ * The request body of POST /v1/generate: an EN 16931 invoice, keyed on
350
+ * Business Terms (BT-*).
351
+ *
352
+ * All amounts are your own figures. invowerk writes them into the XML and
353
+ * checks the result against EN 16931 (and XRechnung, if selected). It does not
354
+ * compute or correct them.
355
+ */
356
+ export type GenerateRequest = {
357
+ /**
358
+ * XML syntax of the invoice: 'ubl' or 'cii'.
359
+ */
360
+ syntax?: Syntax;
361
+ /**
362
+ * Rule set: 'en16931' (plain EN 16931) or 'xrechnung' (German rules).
363
+ */
364
+ flavor?: Flavor;
365
+ /**
366
+ * Invoice Number
367
+ *
368
+ * Invoice number (BT-1).
369
+ */
370
+ invoice_number: string;
371
+ /**
372
+ * Issue Date
373
+ *
374
+ * Issue date, 'YYYY-MM-DD' (BT-2).
375
+ */
376
+ issue_date: string;
377
+ /**
378
+ * Currency
379
+ *
380
+ * Currency code, ISO 4217, e.g. 'EUR' (BT-5).
381
+ */
382
+ currency?: string;
383
+ /**
384
+ * Invoice Type Code
385
+ *
386
+ * Invoice type code from UNTDID 1001; '380' is a commercial invoice (BT-3).
387
+ */
388
+ invoice_type_code?: string;
389
+ /**
390
+ * Buyer Reference
391
+ *
392
+ * Buyer reference, in Germany often the Leitweg-ID (BT-10). Required for flavor 'xrechnung' (BR-DE-15), optional for plain EN 16931.
393
+ */
394
+ buyer_reference?: string | null;
395
+ /**
396
+ * Due Date
397
+ *
398
+ * Payment due date, 'YYYY-MM-DD' (BT-9).
399
+ */
400
+ due_date?: string | null;
401
+ /**
402
+ * Payment Iban
403
+ *
404
+ * IBAN of the payee account for a bank transfer (BT-84).
405
+ */
406
+ payment_iban?: string | null;
407
+ seller: Seller;
408
+ buyer: Buyer;
409
+ /**
410
+ * Lines
411
+ *
412
+ * One or more invoice lines (BG-25).
413
+ */
414
+ lines: Array<InvoiceLine>;
415
+ /**
416
+ * Tax Breakdown
417
+ *
418
+ * One or more VAT breakdowns, one per VAT category and rate (BG-23).
419
+ */
420
+ tax_breakdown: Array<TaxBreakdown>;
421
+ totals: DocumentTotals;
422
+ };
423
+ /**
424
+ * GenerateResponse
425
+ *
426
+ * The answer of POST /v1/generate?format=json: the XML and the check result.
427
+ */
428
+ export type GenerateResponse = {
429
+ /**
430
+ * Xml
431
+ *
432
+ * The generated e-invoice as XML.
433
+ */
434
+ xml: string;
435
+ /**
436
+ * Syntax
437
+ *
438
+ * The syntax of the XML: 'ubl' or 'cii'.
439
+ */
440
+ syntax: string;
441
+ /**
442
+ * Flavor
443
+ *
444
+ * The rule set of the XML: 'en16931' or 'xrechnung'.
445
+ */
446
+ flavor: string;
447
+ /**
448
+ * The result of invowerk's own check of the XML.
449
+ */
450
+ self_validation: SelfValidation;
451
+ };
452
+ /**
453
+ * HintInfo
454
+ *
455
+ * One hint: an extra observation by invowerk. Hints never change the result.
456
+ */
457
+ export type HintInfo = {
458
+ /**
459
+ * Code
460
+ *
461
+ * The hint code, e.g. 'IW-IBAN'.
462
+ */
463
+ code: string;
464
+ /**
465
+ * Severity
466
+ *
467
+ * 'warning' or 'information'. A hint is never fatal.
468
+ */
469
+ severity: string;
470
+ /**
471
+ * Message
472
+ *
473
+ * The observation, in the requested language.
474
+ */
475
+ message: string;
476
+ /**
477
+ * Bt Refs
478
+ *
479
+ * The EN 16931 Business Terms the hint is about.
480
+ */
481
+ bt_refs?: Array<string>;
482
+ /**
483
+ * Explain Url
484
+ *
485
+ * Path of the German page /codes/<CODE> that explains the hint.
486
+ */
487
+ explain_url?: string | null;
488
+ };
489
+ /**
490
+ * InvoiceLine
491
+ *
492
+ * One invoice line (BG-25).
493
+ */
494
+ export type InvoiceLine = {
495
+ /**
496
+ * Name
497
+ *
498
+ * Item name (BT-153).
499
+ */
500
+ name: string;
501
+ /**
502
+ * Net Price
503
+ *
504
+ * Net price per unit (BT-146).
505
+ */
506
+ net_price: number | string;
507
+ /**
508
+ * Quantity
509
+ *
510
+ * Invoiced quantity (BT-129).
511
+ */
512
+ quantity: number | string;
513
+ /**
514
+ * Unit Code
515
+ *
516
+ * Unit code from UN/ECE Recommendation 20; 'C62' means 'one' (BT-130).
517
+ */
518
+ unit_code?: string;
519
+ /**
520
+ * Line Net Amount
521
+ *
522
+ * Line net amount, quantity × net price, as you state it (BT-131).
523
+ */
524
+ line_net_amount: number | string;
525
+ /**
526
+ * Tax Category
527
+ *
528
+ * VAT category code of the line, e.g. 'S' for standard rate (BT-151).
529
+ */
530
+ tax_category?: string;
531
+ /**
532
+ * Tax Rate
533
+ *
534
+ * VAT rate of the line in percent, e.g. 19.00 (BT-152).
535
+ */
536
+ tax_rate?: number | string;
537
+ };
538
+ /**
539
+ * MeResponse
540
+ *
541
+ * The `GET /v1/me` payload: who the request is authenticated as, what is
542
+ * left of your request and credit allowances, and which features your plan
543
+ * includes.
544
+ */
545
+ export type MeResponse = {
546
+ /**
547
+ * Tier
548
+ *
549
+ * The plan this request is served on.
550
+ */
551
+ tier: string;
552
+ /**
553
+ * Is Keyed
554
+ *
555
+ * Whether the request carried a valid API key. Without an `X-API-Key`, the call runs anonymously at the rate limit for calls without a key.
556
+ */
557
+ is_keyed: boolean;
558
+ rate_limit: RateLimitInfo;
559
+ /**
560
+ * Null on plans that are not priced in credits.
561
+ */
562
+ credits?: CreditsInfo | null;
563
+ /**
564
+ * Features
565
+ *
566
+ * The features your plan includes.
567
+ */
568
+ features: Array<string>;
569
+ };
570
+ /**
571
+ * ParseDetection
572
+ *
573
+ * What invowerk detected about the source document, from its bytes.
574
+ */
575
+ export type ParseDetection = {
576
+ /**
577
+ * Syntax
578
+ *
579
+ * Syntax of the source document: 'ubl' or 'cii'.
580
+ */
581
+ syntax: string;
582
+ /**
583
+ * Flavor
584
+ *
585
+ * Rule set of the source, read from its CustomizationID: 'xrechnung', 'peppol_bis', 'factur_x', 'en16931' or 'unknown'.
586
+ */
587
+ flavor: string;
588
+ /**
589
+ * Customization Id
590
+ *
591
+ * The CustomizationID (specification identifier, BT-24) of the source, if any.
592
+ */
593
+ customization_id: string | null;
594
+ };
595
+ /**
596
+ * ParseResponse
597
+ *
598
+ * The answer of POST /v1/parse: the invoice as JSON and what invowerk detected.
599
+ */
600
+ export type ParseResponse = {
601
+ /**
602
+ * Model
603
+ *
604
+ * The invoice as JSON keyed on Business Terms. It has the schema of the POST /v1/generate request body (GenerateRequest), so you can edit it and create the invoice again.
605
+ */
606
+ model: {
607
+ [key: string]: unknown;
608
+ };
609
+ /**
610
+ * What invowerk detected: syntax, rule set and CustomizationID.
611
+ */
612
+ detection: ParseDetection;
613
+ /**
614
+ * Source
615
+ *
616
+ * Where the XML came from: 'xml' (you sent XML) or 'pdf-embedded' (taken from a ZUGFeRD / Factur-X PDF).
617
+ */
618
+ source: string;
619
+ };
620
+ /**
621
+ * PostalAddress
622
+ *
623
+ * A postal address (BG-5 seller, BG-8 buyer).
624
+ *
625
+ * EN 16931 requires only the country. XRechnung also requires city and post
626
+ * code for the seller. invowerk does not check that the address exists.
627
+ */
628
+ export type PostalAddress = {
629
+ /**
630
+ * City
631
+ *
632
+ * City (BT-37 seller, BT-52 buyer).
633
+ */
634
+ city?: string | null;
635
+ /**
636
+ * Post Code
637
+ *
638
+ * Post code (BT-38 seller, BT-53 buyer).
639
+ */
640
+ post_code?: string | null;
641
+ /**
642
+ * Country Code
643
+ *
644
+ * Country code, ISO 3166-1 alpha-2, e.g. 'DE' (BT-40 seller, BT-55 buyer).
645
+ */
646
+ country_code: string;
647
+ };
648
+ /**
649
+ * RateLimitInfo
650
+ *
651
+ * How many requests you may still make in the current window. These are the
652
+ * same numbers as the `X-RateLimit-*` response headers. `limit` is the size of the
653
+ * window, `remaining` what is left of it, and `reset` how many seconds until
654
+ * it refills (not a timestamp). All three are `null` in the rare case the
655
+ * counter cannot be read; treat that as "unknown", not zero.
656
+ */
657
+ export type RateLimitInfo = {
658
+ /**
659
+ * Limit
660
+ */
661
+ limit?: number | null;
662
+ /**
663
+ * Remaining
664
+ */
665
+ remaining?: number | null;
666
+ /**
667
+ * Reset
668
+ */
669
+ reset?: number | null;
670
+ };
671
+ /**
672
+ * RenderResponse
673
+ *
674
+ * The answer of POST /v1/render?format=json: the HTML and what invowerk detected.
675
+ */
676
+ export type RenderResponse = {
677
+ /**
678
+ * Html
679
+ *
680
+ * The rendered invoice as a complete HTML document.
681
+ */
682
+ html: string;
683
+ /**
684
+ * Lang
685
+ *
686
+ * The label language used: 'de' or 'en'.
687
+ */
688
+ lang: string;
689
+ /**
690
+ * Flavor
691
+ *
692
+ * The detected rule set, e.g. 'xrechnung', 'peppol_bis' or 'unknown'.
693
+ */
694
+ flavor: string;
695
+ /**
696
+ * Syntax
697
+ *
698
+ * The detected XML syntax, e.g. 'ubl_invoice' or 'cii'.
699
+ */
700
+ syntax: string;
701
+ };
702
+ /**
703
+ * RuleExplanation
704
+ *
705
+ * The explanation of one rule code in the requested language.
706
+ *
707
+ * It explains the format rule and how to fix the invoice data. It is not tax
708
+ * advice. ``explain_url`` links the German page for the code.
709
+ */
710
+ export type RuleExplanation = {
711
+ /**
712
+ * Code
713
+ *
714
+ * The rule code, e.g. 'BR-DE-21'.
715
+ */
716
+ code: string;
717
+ /**
718
+ * Lang
719
+ *
720
+ * Language of the explanation: 'de' or 'en'.
721
+ */
722
+ lang: string;
723
+ /**
724
+ * Severity
725
+ *
726
+ * Severity of the rule: 'fatal', 'warning' or 'information'.
727
+ */
728
+ severity: string;
729
+ /**
730
+ * Standard
731
+ *
732
+ * Source of the rule: 'EN16931', 'XRechnung', 'ZUGFeRD' or 'invowerk' (IW-* hints).
733
+ */
734
+ standard: string;
735
+ /**
736
+ * Bt Refs
737
+ *
738
+ * The EN 16931 Business Terms the rule is about, e.g. 'BT-10'.
739
+ */
740
+ bt_refs: Array<string>;
741
+ /**
742
+ * Title
743
+ *
744
+ * Short title of the rule.
745
+ */
746
+ title: string;
747
+ /**
748
+ * Meaning
749
+ *
750
+ * What the rule requires.
751
+ */
752
+ meaning: string;
753
+ /**
754
+ * Causes
755
+ *
756
+ * Common reasons why the rule fails.
757
+ */
758
+ causes: Array<string>;
759
+ /**
760
+ * Fixes
761
+ *
762
+ * How to fix the invoice data.
763
+ */
764
+ fixes: Array<string>;
765
+ /**
766
+ * Xpath Hints
767
+ *
768
+ * XPaths of the fields the rule checks.
769
+ */
770
+ xpath_hints: Array<string>;
771
+ /**
772
+ * Explain Url
773
+ *
774
+ * Path of the German explanation page /codes/<CODE>.
775
+ */
776
+ explain_url: string;
777
+ };
778
+ /**
779
+ * ScenarioInfo
780
+ *
781
+ * The rule set that was applied: its configuration and scenario.
782
+ */
783
+ export type ScenarioInfo = {
784
+ /**
785
+ * Config
786
+ *
787
+ * 'kosit-xrechnung' (the KoSIT configuration for XRechnung and EN 16931) or 'zugferd' (the FeRD rules for ZUGFeRD / Factur-X).
788
+ */
789
+ config: string;
790
+ /**
791
+ * Name
792
+ *
793
+ * The scenario name as the configuration states it.
794
+ */
795
+ name: string;
796
+ };
797
+ /**
798
+ * SelfValidation
799
+ *
800
+ * The result of invowerk's own check of the generated XML.
801
+ *
802
+ * Only in the ?format=json answer. It shows that the XML passed the check
803
+ * before it was returned.
804
+ */
805
+ export type SelfValidation = {
806
+ /**
807
+ * Valid
808
+ *
809
+ * Always true. An invalid result returns HTTP 500 instead.
810
+ */
811
+ valid: boolean;
812
+ /**
813
+ * Lane
814
+ *
815
+ * Which check ran; always 'local' (invowerk's own check).
816
+ */
817
+ lane: string;
818
+ /**
819
+ * Finding Count
820
+ *
821
+ * Number of findings of the check; all of them are non-fatal.
822
+ */
823
+ finding_count: number;
824
+ };
825
+ /**
826
+ * Seller
827
+ *
828
+ * The seller (BG-4).
829
+ */
830
+ export type Seller = {
831
+ /**
832
+ * Name
833
+ *
834
+ * Seller name, the registered name (BT-27).
835
+ */
836
+ name: string;
837
+ /**
838
+ * Seller postal address (BG-5).
839
+ */
840
+ address: PostalAddress;
841
+ /**
842
+ * Vat Id
843
+ *
844
+ * Seller VAT ID, e.g. 'DE123456789' (BT-31). Needed when a line has VAT category 'S' (BR-S-02).
845
+ */
846
+ vat_id?: string | null;
847
+ /**
848
+ * Contact Name
849
+ *
850
+ * Seller contact name; required for XRechnung (BT-41).
851
+ */
852
+ contact_name?: string | null;
853
+ /**
854
+ * Contact Phone
855
+ *
856
+ * Seller contact phone; required for XRechnung (BT-42).
857
+ */
858
+ contact_phone?: string | null;
859
+ /**
860
+ * Contact Email
861
+ *
862
+ * Seller contact email; required for XRechnung (BT-43).
863
+ */
864
+ contact_email?: string | null;
865
+ /**
866
+ * Electronic Address
867
+ *
868
+ * Seller electronic address, e.g. an email address (BT-34).
869
+ */
870
+ electronic_address?: string | null;
871
+ };
872
+ /**
873
+ * Syntax
874
+ *
875
+ * The XML syntax of the invoice: UBL or CII.
876
+ */
877
+ export type Syntax = 'cii' | 'ubl';
878
+ /**
879
+ * TaxBreakdown
880
+ *
881
+ * One VAT breakdown: the totals for one VAT category and rate (BG-23).
882
+ */
883
+ export type TaxBreakdown = {
884
+ /**
885
+ * Taxable Amount
886
+ *
887
+ * Taxable amount of the category (BT-116).
888
+ */
889
+ taxable_amount: number | string;
890
+ /**
891
+ * Tax Amount
892
+ *
893
+ * VAT amount of the category (BT-117).
894
+ */
895
+ tax_amount: number | string;
896
+ /**
897
+ * Category
898
+ *
899
+ * VAT category code, e.g. 'S' for standard rate (BT-118).
900
+ */
901
+ category?: string;
902
+ /**
903
+ * Rate
904
+ *
905
+ * VAT rate of the category in percent (BT-119).
906
+ */
907
+ rate?: number | string;
908
+ };
909
+ /**
910
+ * ValidationResponse
911
+ *
912
+ * The result of POST /v1/validate. Always HTTP 200: a failed check is data,
913
+ * not an error.
914
+ */
915
+ export type ValidationResponse = {
916
+ /**
917
+ * Valid
918
+ *
919
+ * The overall result. For the XML, the KoSIT validator decides when it answered (verdict_source 'official'); otherwise invowerk's own check decides (no fatal finding). A fatal problem with the PDF of a ZUGFeRD / Factur-X invoice always makes it false.
920
+ */
921
+ valid: boolean;
922
+ /**
923
+ * Verdict Source
924
+ *
925
+ * 'official' when the KoSIT validator decided the XML result, 'local' when invowerk's own check did (ZUGFeRD or Peppol rules, or KoSIT did not answer).
926
+ */
927
+ verdict_source: string;
928
+ /**
929
+ * Local Verdict
930
+ *
931
+ * invowerk's own result, 'valid' or 'invalid': 'invalid' when any format, business rule or PDF finding is fatal.
932
+ */
933
+ local_verdict: string;
934
+ /**
935
+ * Disagreement
936
+ *
937
+ * True when the KoSIT validator and invowerk's own check reach different results for the XML. The KoSIT result decides; the findings explain the difference.
938
+ */
939
+ disagreement: boolean;
940
+ /**
941
+ * Lane
942
+ *
943
+ * 'official' when invowerk asked the KoSIT validator (even if it did not answer), else 'local'.
944
+ */
945
+ lane: string;
946
+ /**
947
+ * Official Verdict
948
+ *
949
+ * The KoSIT validator's result: 'valid', 'invalid' or 'unavailable' (it did not answer). Null when it was not asked, e.g. for ZUGFeRD or Peppol.
950
+ */
951
+ official_verdict?: string | null;
952
+ /**
953
+ * The rule set that was applied, or null when no rule set matched.
954
+ */
955
+ scenario?: ScenarioInfo | null;
956
+ /**
957
+ * Pdfa Verdict
958
+ *
959
+ * PDF/A check of a ZUGFeRD / Factur-X PDF with veraPDF: 'valid', 'invalid' or 'unavailable'. Null when not checked (always for XML). Null does not mean the PDF is fine.
960
+ */
961
+ pdfa_verdict?: string | null;
962
+ /**
963
+ * Detection
964
+ *
965
+ * What invowerk detected from the bytes: kind, syntax, flavor, customization_id, is_hybrid_pdf. For a PDF it describes the embedded XML.
966
+ */
967
+ detection: {
968
+ [key: string]: unknown;
969
+ };
970
+ /**
971
+ * The findings grouped by where the problem is.
972
+ */
973
+ errors: ErrorClasses;
974
+ /**
975
+ * Findings
976
+ *
977
+ * All format, business rule and PDF findings as one ordered list.
978
+ */
979
+ findings?: Array<Finding>;
980
+ /**
981
+ * Rulesets
982
+ *
983
+ * The rule set versions used for this check, as {name: version}.
984
+ */
985
+ rulesets?: {
986
+ [key: string]: string;
987
+ };
988
+ /**
989
+ * SHA-256 and size of the file, time of the check, software versions.
990
+ */
991
+ evidence: Evidence;
992
+ /**
993
+ * The result mapped onto the e-invoice categories of the German BMF. Describes the format only, not a tax assessment.
994
+ */
995
+ e_rechnung_de: ERechnungDe;
996
+ /**
997
+ * Hints
998
+ *
999
+ * Extra observations by invowerk (IW-* codes), e.g. a wrong IBAN check digit. They never change valid, verdict_source or e_rechnung_de.
1000
+ */
1001
+ hints?: Array<HintInfo>;
1002
+ };
1003
+ /**
1004
+ * ValidatorVersions
1005
+ *
1006
+ * The software versions that produced the result.
1007
+ */
1008
+ export type ValidatorVersions = {
1009
+ /**
1010
+ * Invowerk
1011
+ *
1012
+ * The invowerk version, or 'unknown'.
1013
+ */
1014
+ invowerk: string;
1015
+ /**
1016
+ * Appkit
1017
+ *
1018
+ * The version of the platform invowerk runs on, or 'unknown'.
1019
+ */
1020
+ appkit: string;
1021
+ };
1022
+ /**
1023
+ * Problem
1024
+ *
1025
+ * The RFC 9457 error body. Every error response uses it.
1026
+ */
1027
+ export type Problem = {
1028
+ /**
1029
+ * Type
1030
+ *
1031
+ * Problem type URI (RFC 9457).
1032
+ */
1033
+ type?: string;
1034
+ /**
1035
+ * Title
1036
+ *
1037
+ * Short human-readable summary of the status.
1038
+ */
1039
+ title: string;
1040
+ /**
1041
+ * Status
1042
+ *
1043
+ * The HTTP status code, repeated in the body.
1044
+ */
1045
+ status: number;
1046
+ /**
1047
+ * Detail
1048
+ *
1049
+ * What went wrong with this request.
1050
+ */
1051
+ detail: string;
1052
+ /**
1053
+ * Instance
1054
+ *
1055
+ * The request path that produced the error.
1056
+ */
1057
+ instance: string;
1058
+ /**
1059
+ * Code
1060
+ *
1061
+ * Stable machine-readable error code. Branch on this, not on the text.
1062
+ */
1063
+ code: string;
1064
+ /**
1065
+ * Request Id
1066
+ *
1067
+ * Correlation id for this request; quote it when asking for support.
1068
+ */
1069
+ request_id?: string | null;
1070
+ /**
1071
+ * Errors
1072
+ *
1073
+ * Per-field validation failures. Present on 422 only.
1074
+ */
1075
+ errors?: Array<{
1076
+ [key: string]: unknown;
1077
+ }> | null;
1078
+ /**
1079
+ * Upgrade Url
1080
+ *
1081
+ * Where to add credits or move to a larger plan. Present on 402/403/429.
1082
+ */
1083
+ upgrade_url?: string | null;
1084
+ };
1085
+ export type GetMeData = {
1086
+ body?: never;
1087
+ path?: never;
1088
+ query?: never;
1089
+ url: '/v1/me';
1090
+ };
1091
+ export type GetMeResponses = {
1092
+ /**
1093
+ * Successful Response
1094
+ */
1095
+ 200: MeResponse;
1096
+ };
1097
+ export type GetMeResponse = GetMeResponses[keyof GetMeResponses];
1098
+ export type ParseInvoiceData = {
1099
+ /**
1100
+ * The invoice: XML (UBL or CII, e.g. XRechnung) or a ZUGFeRD / Factur-X PDF, as the raw body or as a multipart file part. At most 20 MB.
1101
+ */
1102
+ body: {
1103
+ /**
1104
+ * The invoice file (XML or PDF).
1105
+ */
1106
+ file: Blob | File;
1107
+ };
1108
+ path?: never;
1109
+ query?: never;
1110
+ url: '/v1/parse';
1111
+ };
1112
+ export type ParseInvoiceResponses = {
1113
+ /**
1114
+ * Successful Response
1115
+ */
1116
+ 200: ParseResponse;
1117
+ };
1118
+ export type ParseInvoiceResponse = ParseInvoiceResponses[keyof ParseInvoiceResponses];
1119
+ export type ConvertInvoiceData = {
1120
+ /**
1121
+ * The invoice: XML (UBL or CII, e.g. XRechnung) or a ZUGFeRD / Factur-X PDF, as the raw body or as a multipart file part. At most 20 MB.
1122
+ */
1123
+ body: {
1124
+ /**
1125
+ * The invoice file (XML or PDF).
1126
+ */
1127
+ file: Blob | File;
1128
+ };
1129
+ path?: never;
1130
+ query: {
1131
+ /**
1132
+ * The XML syntax to convert to: 'cii' or 'ubl'.
1133
+ */
1134
+ target_syntax: Syntax;
1135
+ /**
1136
+ * Target Flavor
1137
+ *
1138
+ * Optional rule set of the result: 'en16931' or 'xrechnung'. Without it the flavor of the source is kept.
1139
+ */
1140
+ target_flavor?: Flavor | null;
1141
+ /**
1142
+ * Format
1143
+ *
1144
+ * 'json' returns {xml, syntax, flavor, self_validation}; omitted returns raw application/xml.
1145
+ */
1146
+ format?: string | null;
1147
+ };
1148
+ url: '/v1/convert';
1149
+ };
1150
+ export type ConvertInvoiceErrors = {
1151
+ /**
1152
+ * Validation Error
1153
+ */
1154
+ 422: Problem;
1155
+ /**
1156
+ * The converted XML failed invowerk's own check. No document is returned and the credits are refunded.
1157
+ */
1158
+ 500: Problem;
1159
+ };
1160
+ export type ConvertInvoiceError = ConvertInvoiceErrors[keyof ConvertInvoiceErrors];
1161
+ export type ConvertInvoiceResponses = {
1162
+ /**
1163
+ * The converted XML (default) or the JSON object (?format=json).
1164
+ */
1165
+ 200: ConvertResponse;
1166
+ };
1167
+ export type ConvertInvoiceResponse = ConvertInvoiceResponses[keyof ConvertInvoiceResponses];
1168
+ export type GenerateInvoiceData = {
1169
+ body: GenerateRequest;
1170
+ path?: never;
1171
+ query?: {
1172
+ /**
1173
+ * Format
1174
+ *
1175
+ * 'json' returns {xml, syntax, flavor, self_validation}; omitted returns raw application/xml.
1176
+ */
1177
+ format?: string | null;
1178
+ };
1179
+ url: '/v1/generate';
1180
+ };
1181
+ export type GenerateInvoiceErrors = {
1182
+ /**
1183
+ * Validation Error
1184
+ */
1185
+ 422: Problem;
1186
+ /**
1187
+ * The generated XML failed invowerk's own check. No document is returned and the credits are refunded.
1188
+ */
1189
+ 500: Problem;
1190
+ };
1191
+ export type GenerateInvoiceError = GenerateInvoiceErrors[keyof GenerateInvoiceErrors];
1192
+ export type GenerateInvoiceResponses = {
1193
+ /**
1194
+ * The generated XML (default) or the JSON object (?format=json).
1195
+ */
1196
+ 200: GenerateResponse;
1197
+ };
1198
+ export type GenerateInvoiceResponse = GenerateInvoiceResponses[keyof GenerateInvoiceResponses];
1199
+ export type ExplainCodesData = {
1200
+ body?: never;
1201
+ path?: never;
1202
+ query: {
1203
+ /**
1204
+ * Code
1205
+ *
1206
+ * One or more codes; repeat the parameter: ?code=BR-DE-21&code=IW-IBAN.
1207
+ */
1208
+ code: Array<string>;
1209
+ /**
1210
+ * Lang
1211
+ *
1212
+ * Language of the explanation, `de` or `en`. Without it, the Accept-Language header decides, otherwise German.
1213
+ */
1214
+ lang?: string | null;
1215
+ };
1216
+ url: '/v1/explain';
1217
+ };
1218
+ export type ExplainCodesErrors = {
1219
+ /**
1220
+ * Validation Error
1221
+ */
1222
+ 422: Problem;
1223
+ };
1224
+ export type ExplainCodesError = ExplainCodesErrors[keyof ExplainCodesErrors];
1225
+ export type ExplainCodesResponses = {
1226
+ /**
1227
+ * Successful Response
1228
+ */
1229
+ 200: ExplainResponse;
1230
+ };
1231
+ export type ExplainCodesResponse = ExplainCodesResponses[keyof ExplainCodesResponses];
1232
+ export type RenderInvoiceData = {
1233
+ body?: BodyRenderInvoice;
1234
+ path?: never;
1235
+ query?: {
1236
+ /**
1237
+ * Lang
1238
+ *
1239
+ * Label language, 'de' or 'en'. Default: Accept-Language, then 'de'.
1240
+ */
1241
+ lang?: string | null;
1242
+ /**
1243
+ * Format
1244
+ *
1245
+ * 'json' returns {html, lang, flavor, syntax}; omitted returns raw text/html.
1246
+ */
1247
+ format?: string | null;
1248
+ };
1249
+ url: '/v1/render';
1250
+ };
1251
+ export type RenderInvoiceErrors = {
1252
+ /**
1253
+ * Validation Error
1254
+ */
1255
+ 422: Problem;
1256
+ };
1257
+ export type RenderInvoiceError = RenderInvoiceErrors[keyof RenderInvoiceErrors];
1258
+ export type RenderInvoiceResponses = {
1259
+ /**
1260
+ * The rendered HTML (default) or the JSON object (?format=json).
1261
+ */
1262
+ 200: RenderResponse;
1263
+ };
1264
+ export type RenderInvoiceResponse = RenderInvoiceResponses[keyof RenderInvoiceResponses];
1265
+ export type ValidateInvoiceData = {
1266
+ /**
1267
+ * The invoice: XML (UBL or CII, e.g. XRechnung) or a ZUGFeRD / Factur-X PDF, as the raw body or as a multipart file part. At most 20 MB.
1268
+ */
1269
+ body: {
1270
+ /**
1271
+ * The invoice file (XML or PDF).
1272
+ */
1273
+ file: Blob | File;
1274
+ };
1275
+ path?: never;
1276
+ query?: {
1277
+ /**
1278
+ * Explain
1279
+ */
1280
+ explain?: boolean;
1281
+ /**
1282
+ * Lang
1283
+ */
1284
+ lang?: string;
1285
+ };
1286
+ url: '/v1/validate';
1287
+ };
1288
+ export type ValidateInvoiceErrors = {
1289
+ /**
1290
+ * Validation Error
1291
+ */
1292
+ 422: Problem;
1293
+ };
1294
+ export type ValidateInvoiceError = ValidateInvoiceErrors[keyof ValidateInvoiceErrors];
1295
+ export type ValidateInvoiceResponses = {
1296
+ /**
1297
+ * Successful Response
1298
+ */
1299
+ 200: ValidationResponse;
1300
+ };
1301
+ export type ValidateInvoiceResponse = ValidateInvoiceResponses[keyof ValidateInvoiceResponses];