@epostak/sdk 1.0.0 → 1.1.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.
Files changed (46) hide show
  1. package/README.md +94 -396
  2. package/dist/client.d.ts +30 -8
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +28 -11
  5. package/dist/client.js.map +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/resources/account.d.ts +25 -0
  9. package/dist/resources/account.d.ts.map +1 -1
  10. package/dist/resources/account.js +25 -0
  11. package/dist/resources/account.js.map +1 -1
  12. package/dist/resources/documents.d.ts +265 -1
  13. package/dist/resources/documents.d.ts.map +1 -1
  14. package/dist/resources/documents.js +265 -1
  15. package/dist/resources/documents.js.map +1 -1
  16. package/dist/resources/extract.d.ts +58 -0
  17. package/dist/resources/extract.d.ts.map +1 -1
  18. package/dist/resources/extract.js +64 -2
  19. package/dist/resources/extract.js.map +1 -1
  20. package/dist/resources/firms.d.ts +104 -0
  21. package/dist/resources/firms.d.ts.map +1 -1
  22. package/dist/resources/firms.js +104 -0
  23. package/dist/resources/firms.js.map +1 -1
  24. package/dist/resources/peppol.d.ts +68 -1
  25. package/dist/resources/peppol.d.ts.map +1 -1
  26. package/dist/resources/peppol.js +68 -1
  27. package/dist/resources/peppol.js.map +1 -1
  28. package/dist/resources/reporting.d.ts +28 -0
  29. package/dist/resources/reporting.d.ts.map +1 -1
  30. package/dist/resources/reporting.js +28 -0
  31. package/dist/resources/reporting.js.map +1 -1
  32. package/dist/resources/webhooks.d.ts +207 -2
  33. package/dist/resources/webhooks.d.ts.map +1 -1
  34. package/dist/resources/webhooks.js +224 -3
  35. package/dist/resources/webhooks.js.map +1 -1
  36. package/dist/types.d.ts +499 -19
  37. package/dist/types.d.ts.map +1 -1
  38. package/dist/utils/errors.d.ts +26 -4
  39. package/dist/utils/errors.d.ts.map +1 -1
  40. package/dist/utils/errors.js +26 -4
  41. package/dist/utils/errors.js.map +1 -1
  42. package/dist/utils/request.d.ts +42 -2
  43. package/dist/utils/request.d.ts.map +1 -1
  44. package/dist/utils/request.js +105 -30
  45. package/dist/utils/request.js.map +1 -1
  46. package/package.json +1 -1
package/dist/types.d.ts CHANGED
@@ -1,473 +1,953 @@
1
+ /**
2
+ * Peppol Invoice Response status code per BIS 3.0 spec.
3
+ * - `"AP"` — Accepted: the buyer accepts the invoice
4
+ * - `"RE"` — Rejected: the buyer rejects the invoice
5
+ * - `"UQ"` — Under Query: the buyer has questions about the invoice
6
+ */
1
7
  export type InvoiceResponseCode = "AP" | "RE" | "UQ";
8
+ /**
9
+ * Webhook event types that can trigger notifications.
10
+ * Subscribe to specific events when creating a webhook endpoint.
11
+ */
2
12
  export type WebhookEvent = "document.created" | "document.sent" | "document.received" | "document.validated";
13
+ /**
14
+ * Direction of a document relative to the authenticated firm.
15
+ * - `"inbound"` — received from a trading partner
16
+ * - `"outbound"` — sent to a trading partner
17
+ */
3
18
  export type DocumentDirection = "inbound" | "outbound";
19
+ /**
20
+ * Conversion direction for the `/documents/convert` endpoint.
21
+ * - `"json_to_ubl"` — convert structured JSON to UBL 2.1 XML
22
+ * - `"ubl_to_json"` — parse UBL 2.1 XML into structured JSON
23
+ */
4
24
  export type ConvertDirection = "json_to_ubl" | "ubl_to_json";
25
+ /**
26
+ * Processing status of an inbound document in your inbox.
27
+ * - `"RECEIVED"` — document arrived but has not been acknowledged yet
28
+ * - `"ACKNOWLEDGED"` — document was acknowledged (marked as processed)
29
+ */
5
30
  export type InboxStatus = "RECEIVED" | "ACKNOWLEDGED";
31
+ /** A single invoice line item used when sending or creating a document. */
6
32
  export interface LineItem {
33
+ /** Human-readable description of the goods or service (e.g. "IT consulting") */
7
34
  description: string;
35
+ /** Quantity of units delivered or performed */
8
36
  quantity: number;
9
- /** UN/CEFACT unit code, e.g. HUR = hours, C62 = pieces, KGM = kg */
37
+ /** UN/CEFACT unit code, e.g. `"HUR"` = hours, `"C62"` = pieces, `"KGM"` = kilograms */
10
38
  unit?: string;
39
+ /** Price per single unit, excluding VAT */
11
40
  unitPrice: number;
12
- /** VAT rate in percent, e.g. 23 */
41
+ /** VAT rate as a percentage (e.g. `23` for the standard Slovak 23% rate) */
13
42
  vatRate: number;
14
- /** Optional discount in percent */
43
+ /** Optional discount as a percentage applied to this line (e.g. `10` for 10% off) */
15
44
  discount?: number;
16
45
  }
46
+ /** A line item as returned by the API in document responses (includes computed totals). */
17
47
  export interface LineItemResponse {
48
+ /** Human-readable description of the goods or service */
18
49
  description: string;
50
+ /** Quantity of units */
19
51
  quantity: number;
52
+ /** UN/CEFACT unit code (e.g. `"HUR"`, `"C62"`, `"KGM"`) */
20
53
  unit?: string;
54
+ /** Price per single unit, excluding VAT */
21
55
  unitPrice: number;
56
+ /** VAT rate as a percentage */
22
57
  vatRate: number;
58
+ /** VAT category code from UBL (e.g. `"S"` for standard rate, `"Z"` for zero-rated) */
23
59
  vatCategory?: string;
60
+ /** Computed total for this line (quantity * unitPrice - discount), excluding VAT */
24
61
  lineTotal: number;
25
62
  }
63
+ /** Postal address of a business party (supplier or customer). */
26
64
  export interface PartyAddress {
65
+ /** Street name and number (e.g. "Hlavna 42") */
27
66
  street?: string;
67
+ /** City or municipality name */
28
68
  city?: string;
69
+ /** Postal / ZIP code */
29
70
  zip?: string;
71
+ /** ISO 3166-1 alpha-2 country code (e.g. `"SK"`, `"CZ"`, `"DE"`) */
30
72
  country?: string;
31
73
  }
74
+ /** A business party (supplier or customer) involved in a document exchange. */
32
75
  export interface Party {
76
+ /** Legal name of the business entity */
33
77
  name?: string;
78
+ /** Slovak business registration number (ICO) — 8-digit identifier assigned by the Statistical Office */
34
79
  ico?: string;
80
+ /** Tax identification number (DIC) — used for income tax purposes in Slovakia */
35
81
  dic?: string;
82
+ /** VAT identification number (IC DPH) — Slovak VAT number, prefixed with `"SK"` */
36
83
  icDph?: string;
84
+ /** Postal address of the business */
37
85
  address?: PartyAddress;
86
+ /** Peppol participant identifier (e.g. `"0245:1234567890"`) */
38
87
  peppolId?: string;
39
88
  }
89
+ /**
90
+ * Request body for sending an invoice using structured JSON fields.
91
+ * The API generates UBL XML automatically from these fields.
92
+ */
40
93
  export interface SendDocumentJsonRequest {
94
+ /** Peppol participant ID of the receiver (e.g. `"0245:1234567890"`) */
41
95
  receiverPeppolId: string;
96
+ /** Invoice number — auto-generated if omitted */
42
97
  invoiceNumber?: string;
98
+ /** Issue date in `YYYY-MM-DD` format — defaults to today */
43
99
  issueDate?: string;
100
+ /** Payment due date in `YYYY-MM-DD` format */
44
101
  dueDate?: string;
102
+ /** ISO 4217 currency code (e.g. `"EUR"`, `"CZK"`) — defaults to `"EUR"` */
45
103
  currency?: string;
104
+ /** Free-text note included in the invoice (e.g. payment terms, thank-you message) */
46
105
  note?: string;
106
+ /** IBAN bank account number for payment */
47
107
  iban?: string;
108
+ /** Payment method (e.g. `"credit_transfer"`, `"direct_debit"`) */
48
109
  paymentMethod?: string;
110
+ /** Variable symbol (variabilny symbol) — Slovak payment reference used to match payments */
49
111
  variableSymbol?: string;
112
+ /** Buyer reference / purchase order number required by some buyers */
50
113
  buyerReference?: string;
114
+ /** Legal name of the receiver (overrides Peppol directory lookup) */
51
115
  receiverName?: string;
116
+ /** Receiver's ICO — Slovak business registration number (8 digits) */
52
117
  receiverIco?: string;
118
+ /** Receiver's DIC — tax identification number */
53
119
  receiverDic?: string;
120
+ /** Receiver's IC DPH — VAT identification number */
54
121
  receiverIcDph?: string;
122
+ /** Receiver's street address as a single string */
55
123
  receiverAddress?: string;
124
+ /** Receiver's ISO 3166-1 alpha-2 country code (e.g. `"SK"`) */
56
125
  receiverCountry?: string;
126
+ /** Invoice line items — at least one is required */
57
127
  items: LineItem[];
58
128
  }
129
+ /**
130
+ * Request body for sending a pre-built UBL XML invoice directly.
131
+ * Use this when you generate your own UBL 2.1 XML.
132
+ */
59
133
  export interface SendDocumentXmlRequest {
134
+ /** Peppol participant ID of the receiver (e.g. `"0245:1234567890"`) */
60
135
  receiverPeppolId: string;
136
+ /** Complete UBL 2.1 Invoice XML document as a string */
61
137
  xml: string;
62
138
  }
139
+ /**
140
+ * Union type for sending a document — either structured JSON fields
141
+ * or raw UBL XML. The API detects the variant by the presence of `xml` vs `items`.
142
+ */
63
143
  export type SendDocumentRequest = SendDocumentJsonRequest | SendDocumentXmlRequest;
144
+ /** Response returned after successfully sending a document via Peppol. */
64
145
  export interface SendDocumentResponse {
146
+ /** Unique document ID in the ePosťak system */
65
147
  documentId: string;
148
+ /** Peppol AS4 message ID for tracking delivery */
66
149
  messageId: string;
150
+ /** Status is always `"SENT"` on success */
67
151
  status: "SENT";
68
152
  }
153
+ /**
154
+ * Request body for updating a draft document. Only draft documents can be updated.
155
+ * Pass `null` to clear an optional field. Omit a field to leave it unchanged.
156
+ */
69
157
  export interface UpdateDocumentRequest {
158
+ /** Invoice number */
70
159
  invoiceNumber?: string;
160
+ /** Issue date in `YYYY-MM-DD` format */
71
161
  issueDate?: string;
162
+ /** Payment due date in `YYYY-MM-DD` format, or `null` to clear */
72
163
  dueDate?: string | null;
164
+ /** ISO 4217 currency code (e.g. `"EUR"`) */
73
165
  currency?: string;
166
+ /** Free-text note, or `null` to clear */
74
167
  note?: string | null;
168
+ /** IBAN bank account number, or `null` to clear */
75
169
  iban?: string | null;
170
+ /** Variable symbol (variabilny symbol), or `null` to clear */
76
171
  variableSymbol?: string | null;
172
+ /** Buyer reference / purchase order number, or `null` to clear */
77
173
  buyerReference?: string | null;
174
+ /** Legal name of the receiver */
78
175
  receiverName?: string;
176
+ /** Receiver's ICO (Slovak business registration number), or `null` to clear */
79
177
  receiverIco?: string | null;
178
+ /** Receiver's DIC (tax identification number), or `null` to clear */
80
179
  receiverDic?: string | null;
180
+ /** Receiver's IC DPH (VAT identification number), or `null` to clear */
81
181
  receiverIcDph?: string | null;
182
+ /** Receiver's street address, or `null` to clear */
82
183
  receiverAddress?: string | null;
184
+ /** Receiver's ISO 3166-1 alpha-2 country code, or `null` to clear */
83
185
  receiverCountry?: string | null;
186
+ /** Receiver's Peppol participant ID, or `null` to clear */
84
187
  receiverPeppolId?: string | null;
188
+ /** Replacement line items — replaces all existing lines when provided */
85
189
  items?: LineItem[];
86
190
  }
191
+ /** Aggregated monetary totals for a document. All amounts are in the document's currency. */
87
192
  export interface DocumentTotals {
193
+ /** Total amount excluding VAT */
88
194
  withoutVat: number;
195
+ /** Total VAT amount */
89
196
  vat: number;
197
+ /** Total amount including VAT (the payable amount) */
90
198
  withVat: number;
91
199
  }
92
- /** Document as returned by the API (same shape for sent and received). */
200
+ /**
201
+ * Full document representation as returned by the API.
202
+ * Used for both sent (outbound) and received (inbound) documents.
203
+ */
93
204
  export interface InboxDocument {
205
+ /** Unique document ID in the ePosťak system (UUID) */
94
206
  id: string;
207
+ /** Invoice number (e.g. `"FV-2026-0042"`) */
95
208
  number: string;
209
+ /** Current processing status (e.g. `"SENT"`, `"DELIVERED"`, `"RECEIVED"`, `"ACKNOWLEDGED"`) */
96
210
  status: string;
211
+ /** Whether this document was sent or received by the authenticated firm */
97
212
  direction: DocumentDirection;
213
+ /** UBL document type (e.g. `"Invoice"`, `"CreditNote"`) */
98
214
  docType: string;
215
+ /** Issue date in `YYYY-MM-DD` format */
99
216
  issueDate: string;
217
+ /** Payment due date in `YYYY-MM-DD` format, or `null` if not specified */
100
218
  dueDate: string | null;
219
+ /** ISO 4217 currency code (e.g. `"EUR"`) */
101
220
  currency: string;
221
+ /** The party that issued the document (seller) */
102
222
  supplier: Party;
223
+ /** The party that receives the document (buyer) */
103
224
  customer: Party;
225
+ /** Individual line items on the document */
104
226
  lines: LineItemResponse[];
227
+ /** Aggregated monetary totals */
105
228
  totals: DocumentTotals;
229
+ /** Peppol AS4 message ID, or `null` for draft documents */
106
230
  peppolMessageId: string | null;
231
+ /** ISO 8601 timestamp when the document was created */
107
232
  createdAt: string;
233
+ /** ISO 8601 timestamp when the document was last updated */
108
234
  updatedAt: string;
109
235
  }
236
+ /** Query parameters for listing documents in your inbox. */
110
237
  export interface InboxListParams {
238
+ /** Number of documents to skip (for pagination). Defaults to `0`. */
111
239
  offset?: number;
240
+ /** Maximum number of documents to return (for pagination). Defaults to `20`. */
112
241
  limit?: number;
242
+ /** Filter by processing status (`"RECEIVED"` or `"ACKNOWLEDGED"`) */
113
243
  status?: InboxStatus;
114
- /** ISO 8601 timestamp — only return documents created after this date */
244
+ /** ISO 8601 timestamp — only return documents created after this date (e.g. `"2026-01-01T00:00:00Z"`) */
115
245
  since?: string;
116
246
  }
247
+ /** Paginated list of inbox documents. */
117
248
  export interface InboxListResponse {
249
+ /** Array of documents in the current page */
118
250
  documents: InboxDocument[];
251
+ /** Total number of documents matching the query */
119
252
  total: number;
253
+ /** The limit that was applied */
120
254
  limit: number;
255
+ /** The offset that was applied */
121
256
  offset: number;
122
257
  }
258
+ /** Detail view of a single inbox document, including the raw UBL XML payload. */
123
259
  export interface InboxDocumentDetailResponse {
260
+ /** Full document object */
124
261
  document: InboxDocument;
125
- /** UBL XML content, null if not available */
262
+ /** Raw UBL XML content of the document, or `null` if not available */
126
263
  payload: string | null;
127
264
  }
265
+ /** Response returned after acknowledging (marking as processed) an inbox document. */
128
266
  export interface AcknowledgeResponse {
267
+ /** ID of the acknowledged document */
129
268
  documentId: string;
269
+ /** Status is always `"ACKNOWLEDGED"` on success */
130
270
  status: "ACKNOWLEDGED";
271
+ /** ISO 8601 timestamp when the document was acknowledged */
131
272
  acknowledgedAt: string;
132
273
  }
274
+ /**
275
+ * Query parameters for the integrator cross-firm inbox endpoint.
276
+ * Only available with integrator API keys (`sk_int_*`).
277
+ */
133
278
  export interface InboxAllParams {
279
+ /** Number of documents to skip (for pagination). Defaults to `0`. */
134
280
  offset?: number;
281
+ /** Maximum number of documents to return. Defaults to `20`. */
135
282
  limit?: number;
283
+ /** Filter by processing status */
136
284
  status?: InboxStatus;
137
285
  /** ISO 8601 timestamp — only return documents created after this date */
138
286
  since?: string;
139
- /** Filter to a specific firm UUID */
287
+ /** Filter to a specific firm UUID — useful when polling for one client's documents */
140
288
  firm_id?: string;
141
289
  }
290
+ /**
291
+ * Document from the integrator cross-firm inbox.
292
+ * Uses snake_case field names (unlike single-firm endpoints which use camelCase).
293
+ */
142
294
  export interface InboxAllDocument {
295
+ /** UUID of the firm that owns this document */
143
296
  firm_id: string;
297
+ /** Name of the firm that owns this document */
144
298
  firm_name: string | null;
299
+ /** Unique document ID (UUID) */
145
300
  id: string;
301
+ /** Invoice number, or `null` if not yet assigned */
146
302
  number: string | null;
303
+ /** Current processing status */
147
304
  status: string;
305
+ /** Document direction (`"inbound"` or `"outbound"`) */
148
306
  direction: string;
307
+ /** UBL document type (e.g. `"Invoice"`) */
149
308
  doc_type: string;
309
+ /** Issue date in `YYYY-MM-DD` format */
150
310
  issue_date: string | null;
311
+ /** Payment due date in `YYYY-MM-DD` format */
151
312
  due_date: string | null;
313
+ /** ISO 4217 currency code */
152
314
  currency: string;
315
+ /** Supplier (seller) summary */
153
316
  supplier: {
317
+ /** Legal name of the supplier */
154
318
  name: string | null;
319
+ /** Supplier's ICO (Slovak business registration number) */
155
320
  ico: string | null;
321
+ /** Supplier's Peppol participant ID */
156
322
  peppol_id: string | null;
157
323
  };
324
+ /** Customer (buyer) summary */
158
325
  customer: {
326
+ /** Legal name of the customer */
159
327
  name: string | null;
328
+ /** Customer's ICO (Slovak business registration number) */
160
329
  ico: string | null;
330
+ /** Customer's Peppol participant ID */
161
331
  peppol_id: string | null;
162
332
  };
333
+ /** Aggregated monetary totals */
163
334
  totals: {
335
+ /** Total excluding VAT */
164
336
  without_vat: number | null;
337
+ /** Total VAT amount */
165
338
  vat: number | null;
339
+ /** Total including VAT */
166
340
  with_vat: number | null;
167
341
  };
342
+ /** Peppol AS4 message ID */
168
343
  peppol_message_id: string | null;
344
+ /** ISO 8601 timestamp when the document was created */
169
345
  created_at: string;
170
346
  }
347
+ /** Paginated response from the integrator cross-firm inbox. */
171
348
  export interface InboxAllResponse {
349
+ /** Array of documents across all managed firms */
172
350
  documents: InboxAllDocument[];
351
+ /** Total number of documents matching the query */
173
352
  total: number;
353
+ /** The limit that was applied */
174
354
  limit: number;
355
+ /** The offset that was applied */
175
356
  offset: number;
176
357
  }
358
+ /** A single entry in a document's status change history. */
177
359
  export interface StatusHistoryEntry {
360
+ /** Status at this point in time (e.g. `"SENT"`, `"DELIVERED"`, `"FAILED"`) */
178
361
  status: string;
362
+ /** ISO 8601 timestamp when the status changed */
179
363
  timestamp: string;
364
+ /** Human-readable detail about the transition, or `null` */
180
365
  detail: string | null;
181
366
  }
367
+ /** Full status and lifecycle information for a document. */
182
368
  export interface DocumentStatusResponse {
369
+ /** Document ID (UUID) */
183
370
  id: string;
371
+ /** Current status of the document */
184
372
  status: string;
373
+ /** UBL document type (e.g. `"Invoice"`, `"CreditNote"`), or `null` if unknown */
185
374
  documentType: string | null;
375
+ /** Peppol participant ID of the sender */
186
376
  senderPeppolId: string | null;
377
+ /** Peppol participant ID of the receiver */
187
378
  receiverPeppolId: string | null;
379
+ /** Ordered list of status transitions from creation to current state */
188
380
  statusHistory: StatusHistoryEntry[];
381
+ /** Validation result (warnings, errors) from Peppol validation, or `null` */
189
382
  validationResult: Record<string, unknown> | null;
383
+ /** ISO 8601 timestamp when the document was delivered to the receiver, or `null` */
190
384
  deliveredAt: string | null;
385
+ /** ISO 8601 timestamp when the document was acknowledged by the receiver, or `null` */
191
386
  acknowledgedAt: string | null;
387
+ /** Buyer's Invoice Response status (`"AP"`, `"RE"`, `"UQ"`), or `null` if not yet responded */
192
388
  invoiceResponseStatus: InvoiceResponseCode | null;
389
+ /** AS4 message ID assigned by the Peppol access point, or `null` */
193
390
  as4MessageId: string | null;
391
+ /** ISO 8601 timestamp when the document was created */
194
392
  createdAt: string;
393
+ /** ISO 8601 timestamp when the document was last updated */
195
394
  updatedAt: string;
196
395
  }
396
+ /**
397
+ * Delivery evidence and proof-of-receipt for a sent document.
398
+ * Contains AS4 receipts, Message Level Response (MLR), and Invoice Response data.
399
+ */
197
400
  export interface DocumentEvidenceResponse {
401
+ /** Document ID (UUID) */
198
402
  documentId: string;
403
+ /** AS4 receipt from the receiving access point (proof of network delivery), or `null` */
199
404
  as4Receipt: Record<string, unknown> | null;
405
+ /** Peppol Message Level Response document (delivery confirmation at the business level), or `null` */
200
406
  mlrDocument: Record<string, unknown> | null;
407
+ /** Invoice Response from the buyer (accept/reject/query), or `null` if not yet responded */
201
408
  invoiceResponse: {
409
+ /** Response status code, or `null` */
202
410
  status: InvoiceResponseCode | null;
411
+ /** Full Invoice Response document */
203
412
  document: Record<string, unknown>;
204
413
  } | null;
414
+ /** ISO 8601 timestamp when the document was delivered, or `null` */
205
415
  deliveredAt: string | null;
416
+ /** ISO 8601 timestamp when the document was sent, or `null` */
206
417
  sentAt: string | null;
207
418
  }
419
+ /** Request body for responding to a received invoice (accept, reject, or query). */
208
420
  export interface InvoiceRespondRequest {
209
- /** AP = accepted, RE = rejected, UQ = under query */
421
+ /** Response status: `"AP"` = accepted, `"RE"` = rejected, `"UQ"` = under query */
210
422
  status: InvoiceResponseCode;
423
+ /** Optional note explaining the response (e.g. reason for rejection) */
211
424
  note?: string;
212
425
  }
426
+ /** Response returned after successfully sending an Invoice Response to the supplier. */
213
427
  export interface InvoiceRespondResponse {
428
+ /** ID of the document that was responded to */
214
429
  documentId: string;
430
+ /** The response status that was sent */
215
431
  responseStatus: InvoiceResponseCode;
432
+ /** ISO 8601 timestamp when the response was sent */
216
433
  respondedAt: string;
217
434
  }
435
+ /** Result of validating a document before sending — checks Peppol BIS 3.0 compliance. */
218
436
  export interface ValidationResult {
437
+ /** `true` if the document passes all validation rules */
219
438
  valid: boolean;
439
+ /** Non-fatal warnings (e.g. missing optional fields) */
220
440
  warnings: string[];
221
- /** Generated UBL XML, only present for JSON mode requests */
441
+ /** Generated UBL XML preview — only present when validating JSON input, `null` for XML input */
222
442
  ubl: string | null;
223
443
  }
444
+ /** Request body for the preflight check — verifies a Peppol receiver exists and supports the document type. */
224
445
  export interface PreflightRequest {
446
+ /** Peppol participant ID to check (e.g. `"0245:1234567890"`) */
225
447
  receiverPeppolId: string;
448
+ /** Peppol document type identifier to check support for (defaults to standard Invoice) */
226
449
  documentTypeId?: string;
227
450
  }
451
+ /** Result of a preflight check against the Peppol SMP. */
228
452
  export interface PreflightResult {
453
+ /** The Peppol participant ID that was checked */
229
454
  receiverPeppolId: string;
455
+ /** `true` if the participant is registered in the Peppol network */
230
456
  registered: boolean;
457
+ /** `true` if the participant's SMP indicates support for the requested document type */
231
458
  supportsDocumentType: boolean;
459
+ /** URL of the participant's SMP record, or `null` if not registered */
232
460
  smpUrl: string | null;
233
461
  }
462
+ /** Request body for converting between JSON and UBL XML formats. */
234
463
  export interface ConvertRequest {
464
+ /** Conversion direction */
235
465
  direction: ConvertDirection;
236
- /** JSON document data (for json_to_ubl) */
466
+ /** Structured document data (required when `direction` is `"json_to_ubl"`) */
237
467
  data?: Record<string, unknown>;
238
- /** UBL XML string (for ubl_to_json) */
468
+ /** UBL XML string (required when `direction` is `"ubl_to_json"`) */
239
469
  xml?: string;
240
470
  }
471
+ /** Result of a format conversion. */
241
472
  export interface ConvertResult {
473
+ /** The conversion direction that was performed */
242
474
  direction: ConvertDirection;
243
- /** UBL XML string for json_to_ubl, parsed object for ubl_to_json */
475
+ /** UBL XML string when direction is `"json_to_ubl"`, or parsed JSON object when `"ubl_to_json"` */
244
476
  result: string | Record<string, unknown>;
245
477
  }
478
+ /** A document type capability advertised by a Peppol participant via their SMP record. */
246
479
  export interface SmpParticipantCapability {
480
+ /** Peppol document type identifier (e.g. `"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##..."`) */
247
481
  documentTypeId: string;
482
+ /** Peppol process identifier (e.g. `"urn:fdc:peppol.eu:2017:poacc:billing:01:1.0"`) */
248
483
  processId: string;
484
+ /** AS4 transport profile identifier (e.g. `"peppol-transport-as4-v2_0"`) */
249
485
  transportProfile: string;
250
486
  }
487
+ /** Peppol participant details retrieved from the SMP (Service Metadata Publisher). */
251
488
  export interface PeppolParticipant {
489
+ /** Peppol participant ID (e.g. `"0245:1234567890"`) */
252
490
  peppolId: string;
491
+ /** Registered business name, or `null` if not available in the Business Card */
253
492
  name: string | null;
493
+ /** ISO 3166-1 alpha-2 country code, or `null` */
254
494
  country: string | null;
495
+ /** List of document types and processes this participant supports */
255
496
  capabilities: SmpParticipantCapability[];
256
497
  }
498
+ /** Query parameters for searching the Peppol Business Card directory. */
257
499
  export interface DirectorySearchParams {
500
+ /** Free-text search query (matches business name, identifiers, etc.) */
258
501
  q?: string;
502
+ /** ISO 3166-1 alpha-2 country code to filter results (e.g. `"SK"`, `"CZ"`) */
259
503
  country?: string;
504
+ /** Page number (1-based). Defaults to `1`. */
260
505
  page?: number;
506
+ /** Number of results per page. Defaults to `20`. */
261
507
  page_size?: number;
262
508
  }
509
+ /** A single entry from the Peppol Business Card directory. */
263
510
  export interface DirectoryEntry {
511
+ /** Peppol participant ID */
264
512
  peppolId: string;
513
+ /** Registered business name */
265
514
  name: string;
515
+ /** ISO 3166-1 alpha-2 country code */
266
516
  country: string;
517
+ /** ISO 8601 timestamp when the participant was registered, or `null` */
267
518
  registeredAt: string | null;
268
519
  }
520
+ /** Paginated search results from the Peppol Business Card directory. */
269
521
  export interface DirectorySearchResult {
522
+ /** Array of matching directory entries */
270
523
  results: DirectoryEntry[];
524
+ /** Total number of results matching the query */
271
525
  total: number;
526
+ /** Current page number (1-based) */
272
527
  page: number;
528
+ /** Number of results per page */
273
529
  page_size: number;
274
530
  }
531
+ /**
532
+ * Company information from Slovak business registers (ORSR, FinStat)
533
+ * combined with Peppol registration status.
534
+ */
275
535
  export interface CompanyLookup {
536
+ /** Slovak business registration number (ICO) — 8 digits */
276
537
  ico: string;
538
+ /** Legal name of the company */
277
539
  name: string;
540
+ /** Tax identification number (DIC), or `null` if not available */
278
541
  dic: string | null;
542
+ /** VAT identification number (IC DPH), or `null` if the company is not VAT-registered */
279
543
  icDph: string | null;
544
+ /** Registered address of the company */
280
545
  address?: PartyAddress;
546
+ /** Peppol participant ID if the company is registered on Peppol, otherwise `null` */
281
547
  peppolId: string | null;
282
548
  }
549
+ /** Summary of a firm managed by the integrator account. */
283
550
  export interface FirmSummary {
551
+ /** Firm UUID */
284
552
  id: string;
553
+ /** Legal name of the firm */
285
554
  name: string;
555
+ /** Slovak business registration number (ICO), or `null` */
286
556
  ico: string | null;
557
+ /** Peppol participant ID, or `null` if not yet registered */
287
558
  peppolId: string | null;
559
+ /** Peppol registration status (e.g. `"active"`, `"pending"`, `"none"`) */
288
560
  peppolStatus: string;
289
561
  }
562
+ /** A Peppol identifier (scheme + value) registered for a firm. */
290
563
  export interface FirmPeppolIdentifier {
564
+ /** Peppol identifier scheme (e.g. `"0245"` for Slovak DIČ) */
291
565
  scheme: string;
566
+ /** The identifier value within the scheme (e.g. the ICO number) */
292
567
  identifier: string;
293
568
  }
569
+ /** Detailed firm information including tax IDs, address, and Peppol identifiers. */
294
570
  export interface FirmDetail extends FirmSummary {
571
+ /** Tax identification number (DIC), or `null` */
295
572
  dic: string | null;
573
+ /** VAT identification number (IC DPH), or `null` */
296
574
  icDph: string | null;
575
+ /** Registered address of the firm */
297
576
  address?: PartyAddress;
577
+ /** All Peppol identifiers registered for this firm */
298
578
  peppolIdentifiers: FirmPeppolIdentifier[];
579
+ /** ISO 8601 timestamp when the firm was created in the system */
299
580
  createdAt: string;
300
581
  }
582
+ /** Wrapper response for the firms list endpoint. */
301
583
  export interface FirmsListResponse {
584
+ /** Array of firm summaries */
302
585
  firms: FirmSummary[];
303
586
  }
587
+ /** Query parameters for listing a firm's documents. */
304
588
  export interface FirmDocumentsParams {
589
+ /** Number of documents to skip (for pagination). Defaults to `0`. */
305
590
  offset?: number;
591
+ /** Maximum number of documents to return. Defaults to `20`. */
306
592
  limit?: number;
593
+ /** Filter by document direction (`"inbound"` or `"outbound"`) */
307
594
  direction?: DocumentDirection;
308
595
  }
596
+ /** Response after registering a new Peppol identifier for a firm. */
309
597
  export interface PeppolIdentifierResponse {
598
+ /** Full Peppol participant ID (e.g. `"0245:1234567890"`) */
310
599
  peppolId: string;
600
+ /** Peppol identifier scheme */
311
601
  scheme: string;
602
+ /** Identifier value within the scheme */
312
603
  identifier: string;
604
+ /** ISO 8601 timestamp when the identifier was registered */
313
605
  registeredAt: string;
314
606
  }
607
+ /**
608
+ * Request to assign a firm to the integrator account by its ICO.
609
+ * Once assigned, the integrator can send/receive documents on behalf of this firm.
610
+ */
315
611
  export interface AssignFirmRequest {
316
- /** Slovak ICO (8 digits) */
612
+ /** Slovak business registration number (ICO) — exactly 8 digits */
317
613
  ico: string;
318
614
  }
615
+ /** Response after successfully assigning a firm to the integrator account. */
319
616
  export interface AssignFirmResponse {
617
+ /** The assigned firm's details */
320
618
  firm: {
619
+ /** Firm UUID */
321
620
  id: string;
621
+ /** Legal name of the firm */
322
622
  name: string | null;
623
+ /** Slovak ICO */
323
624
  ico: string | null;
625
+ /** Peppol participant ID, or `null` if not registered */
324
626
  peppol_id: string | null;
627
+ /** Peppol registration status */
325
628
  peppol_status: string;
326
629
  };
630
+ /** Assignment status — always `"active"` on success */
327
631
  status: "active";
328
632
  }
633
+ /**
634
+ * Request to assign multiple firms at once by their ICOs.
635
+ * Maximum 50 ICOs per batch request.
636
+ */
329
637
  export interface BatchAssignFirmsRequest {
330
- /** Array of Slovak ICOs (8 digits each, max 50) */
638
+ /** Array of Slovak ICOs (8 digits each, max 50 per request) */
331
639
  icos: string[];
332
640
  }
641
+ /** Result for a single firm in a batch assignment — may succeed or fail independently. */
333
642
  export interface BatchAssignFirmResult {
643
+ /** The ICO that was processed */
334
644
  ico: string;
645
+ /** Firm details if assignment succeeded */
335
646
  firm?: {
647
+ /** Firm UUID */
336
648
  id: string;
649
+ /** Legal name */
337
650
  name: string | null;
651
+ /** Slovak ICO */
338
652
  ico: string | null;
653
+ /** Peppol participant ID */
339
654
  peppol_id: string | null;
655
+ /** Peppol registration status */
340
656
  peppol_status: string;
341
657
  };
658
+ /** `"active"` for newly assigned, `"already_assigned"` if previously assigned */
342
659
  status?: "active" | "already_assigned";
660
+ /** Error code if assignment failed for this ICO */
343
661
  error?: string;
662
+ /** Human-readable error message */
344
663
  message?: string;
345
664
  }
665
+ /** Response from a batch firm assignment operation. */
346
666
  export interface BatchAssignFirmsResponse {
667
+ /** Individual results for each ICO in the request */
347
668
  results: BatchAssignFirmResult[];
348
669
  }
670
+ /** Request body for creating a new webhook subscription. */
349
671
  export interface CreateWebhookRequest {
672
+ /** HTTPS URL where webhook payloads will be POSTed */
350
673
  url: string;
674
+ /** Event types to subscribe to — defaults to all events if omitted */
351
675
  events?: WebhookEvent[];
352
676
  }
677
+ /** Request body for updating an existing webhook subscription. Omit fields to leave unchanged. */
353
678
  export interface UpdateWebhookRequest {
679
+ /** New HTTPS URL for the webhook */
354
680
  url?: string;
681
+ /** Updated list of event types to subscribe to */
355
682
  events?: WebhookEvent[];
683
+ /** Set to `false` to pause the webhook without deleting it */
356
684
  isActive?: boolean;
357
685
  }
686
+ /** A webhook subscription. */
358
687
  export interface Webhook {
688
+ /** Webhook UUID */
359
689
  id: string;
690
+ /** HTTPS URL where payloads are delivered */
360
691
  url: string;
692
+ /** Event types this webhook is subscribed to */
361
693
  events: WebhookEvent[];
694
+ /** Whether the webhook is currently active and receiving events */
362
695
  isActive: boolean;
696
+ /** ISO 8601 timestamp when the webhook was created */
363
697
  createdAt: string;
364
698
  }
699
+ /**
700
+ * Webhook details including the signing secret.
701
+ * The `secret` is only returned once at creation time — store it securely.
702
+ */
365
703
  export interface WebhookDetail extends Webhook {
366
- /** HMAC-SHA256 signing secret — only returned on creation */
704
+ /** HMAC-SHA256 signing secret for verifying webhook payloads — only returned on creation */
367
705
  secret?: string;
368
706
  }
707
+ /** A single webhook delivery attempt record. */
369
708
  export interface WebhookDelivery {
709
+ /** Delivery UUID */
370
710
  id: string;
711
+ /** ID of the parent webhook */
371
712
  webhookId: string;
713
+ /** Event type that triggered this delivery (e.g. `"document.received"`) */
372
714
  event: string;
715
+ /** Delivery status (e.g. `"success"`, `"failed"`, `"pending"`) */
373
716
  status: string;
717
+ /** Number of delivery attempts made (includes retries) */
374
718
  attempts: number;
719
+ /** HTTP status code returned by the webhook URL, or `null` if the request failed */
375
720
  responseStatus: number | null;
721
+ /** ISO 8601 timestamp when the delivery was created */
376
722
  createdAt: string;
377
723
  }
724
+ /** Webhook details with recent delivery history. */
378
725
  export interface WebhookWithDeliveries extends Webhook {
726
+ /** Recent delivery attempts for this webhook */
379
727
  deliveries: WebhookDelivery[];
380
728
  }
729
+ /** Wrapper response for the webhook list endpoint. */
381
730
  export interface WebhookListResponse {
731
+ /** Array of webhook subscriptions */
382
732
  data: Webhook[];
383
733
  }
734
+ /** Response from sending a test event to a webhook endpoint. */
735
+ export interface WebhookTestResponse {
736
+ /** Whether the test delivery was successful */
737
+ success: boolean;
738
+ /** HTTP status code returned by the webhook URL, or `null` if the request failed */
739
+ statusCode: number | null;
740
+ /** Round-trip response time in milliseconds */
741
+ responseTime: number;
742
+ /** The webhook UUID that was tested */
743
+ webhookId: string;
744
+ /** The event type used for the test */
745
+ event: string;
746
+ /** Error message if the test delivery failed */
747
+ error?: string;
748
+ }
749
+ /** A single delivery record with full detail (used in paginated delivery history). */
750
+ export interface WebhookDeliveryDetail {
751
+ /** Delivery UUID */
752
+ id: string;
753
+ /** ID of the parent webhook */
754
+ webhookId: string;
755
+ /** Event type that triggered this delivery */
756
+ event: string;
757
+ /** Delivery status */
758
+ status: "SUCCESS" | "FAILED" | "PENDING" | "RETRYING";
759
+ /** Number of delivery attempts made */
760
+ attempts: number;
761
+ /** HTTP status code returned by the webhook URL */
762
+ responseStatus: number | null;
763
+ /** Truncated response body from the webhook URL */
764
+ responseBody: string | null;
765
+ /** ISO 8601 timestamp of the last delivery attempt */
766
+ lastAttemptAt: string | null;
767
+ /** ISO 8601 timestamp of the next scheduled retry, or `null` if not retrying */
768
+ nextRetryAt: string | null;
769
+ /** ISO 8601 timestamp when the delivery was created */
770
+ createdAt: string;
771
+ }
772
+ /** Query parameters for fetching paginated webhook delivery history. */
773
+ export interface WebhookDeliveriesParams {
774
+ /** Maximum number of deliveries to return (1-100). Defaults to `20`. */
775
+ limit?: number;
776
+ /** Number of deliveries to skip for pagination. Defaults to `0`. */
777
+ offset?: number;
778
+ /** Filter by delivery status */
779
+ status?: "SUCCESS" | "FAILED" | "PENDING" | "RETRYING";
780
+ /** Filter by event type (e.g. `"document.received"`) */
781
+ event?: string;
782
+ }
783
+ /** Paginated response of webhook delivery history. */
784
+ export interface WebhookDeliveriesResponse {
785
+ /** Array of delivery records */
786
+ deliveries: WebhookDeliveryDetail[];
787
+ /** Total number of deliveries matching the filter */
788
+ total: number;
789
+ /** Number of deliveries returned */
790
+ limit: number;
791
+ /** Offset used for pagination */
792
+ offset: number;
793
+ }
794
+ /**
795
+ * Query parameters for pulling events from the webhook queue.
796
+ * Use the pull queue as an alternative to push webhooks when your server
797
+ * cannot receive inbound HTTPS requests.
798
+ */
384
799
  export interface WebhookQueueParams {
385
- /** Max items to return (1100, default 20) */
800
+ /** Maximum number of items to return (1-100). Defaults to `20`. */
386
801
  limit?: number;
387
- /** Filter by event type, e.g. 'document.received' */
802
+ /** Filter by event type (e.g. `"document.received"`) — returns only matching events */
388
803
  event_type?: string;
389
804
  }
805
+ /** A single event item from the webhook pull queue. */
390
806
  export interface WebhookQueueItem {
807
+ /** Event ID — use this to acknowledge the event after processing */
391
808
  id: string;
809
+ /** Event type (e.g. `"document.received"`, `"document.sent"`) */
392
810
  type: string;
811
+ /** ISO 8601 timestamp when the event was created */
393
812
  created_at: string;
813
+ /** Event payload containing the document data and metadata */
394
814
  payload: Record<string, unknown>;
395
815
  }
816
+ /** Response from pulling events from the webhook queue. */
396
817
  export interface WebhookQueueResponse {
818
+ /** Array of unacknowledged events */
397
819
  items: WebhookQueueItem[];
820
+ /** `true` if there are more events available beyond the current batch */
398
821
  has_more: boolean;
399
822
  }
823
+ /**
824
+ * Query parameters for the integrator cross-firm webhook queue.
825
+ * Only available with integrator API keys (`sk_int_*`).
826
+ */
400
827
  export interface WebhookQueueAllParams {
401
- /** Max items to return (1500, default 100) */
828
+ /** Maximum number of events to return (1-500). Defaults to `100`. */
402
829
  limit?: number;
403
- /** ISO 8601 timestamp — only return events created after this date */
830
+ /** ISO 8601 timestamp — only return events created after this date (for cursor-based polling) */
404
831
  since?: string;
405
832
  }
833
+ /** A single event from the integrator cross-firm webhook queue. */
406
834
  export interface WebhookQueueAllEvent {
835
+ /** Unique event ID — use this to acknowledge the event */
407
836
  event_id: string;
837
+ /** UUID of the firm this event belongs to */
408
838
  firm_id: string;
839
+ /** Event type (e.g. `"document.received"`) */
409
840
  event: string;
841
+ /** Event payload containing document data and metadata */
410
842
  payload: Record<string, unknown>;
843
+ /** ISO 8601 timestamp when the event was created */
411
844
  created_at: string;
412
845
  }
846
+ /** Response from the integrator cross-firm webhook queue. */
413
847
  export interface WebhookQueueAllResponse {
848
+ /** Array of events across all managed firms */
414
849
  events: WebhookQueueAllEvent[];
850
+ /** Number of events returned in this response */
415
851
  count: number;
416
852
  }
853
+ /** Query parameters for the reporting statistics endpoint. */
417
854
  export interface StatisticsParams {
855
+ /** Start of the reporting period in `YYYY-MM-DD` format. Defaults to 30 days ago. */
418
856
  from?: string;
857
+ /** End of the reporting period in `YYYY-MM-DD` format. Defaults to today. */
419
858
  to?: string;
420
859
  }
860
+ /** Aggregated document statistics for a given time period. */
421
861
  export interface Statistics {
862
+ /** The reporting period boundaries */
422
863
  period: {
864
+ /** Start date in `YYYY-MM-DD` format */
423
865
  from: string;
866
+ /** End date in `YYYY-MM-DD` format */
424
867
  to: string;
425
868
  };
869
+ /** Outbound (sent) document statistics */
426
870
  outbound: {
871
+ /** Total outbound documents in the period */
427
872
  total: number;
873
+ /** Successfully delivered documents */
428
874
  delivered: number;
875
+ /** Documents that failed to deliver */
429
876
  failed: number;
430
877
  };
878
+ /** Inbound (received) document statistics */
431
879
  inbound: {
880
+ /** Total inbound documents in the period */
432
881
  total: number;
882
+ /** Documents that have been acknowledged */
433
883
  acknowledged: number;
884
+ /** Documents still awaiting acknowledgment */
434
885
  pending: number;
435
886
  };
436
887
  }
888
+ /** Account information including firm details, subscription plan, and usage counters. */
437
889
  export interface Account {
890
+ /** The firm associated with this API key */
438
891
  firm: {
892
+ /** Legal name of the firm */
439
893
  name: string;
894
+ /** Slovak business registration number (ICO), or `null` */
440
895
  ico: string | null;
896
+ /** Peppol participant ID, or `null` if not registered */
441
897
  peppolId: string | null;
898
+ /** Peppol registration status (e.g. `"active"`, `"pending"`, `"none"`) */
442
899
  peppolStatus: string;
443
900
  };
901
+ /** Current subscription plan */
444
902
  plan: {
903
+ /** Plan name (e.g. `"starter"`, `"business"`, `"enterprise"`) */
445
904
  name: string;
905
+ /** Plan status — `"active"` or `"expired"` */
446
906
  status: "active" | "expired";
447
907
  };
908
+ /** Document usage counters for the current billing period */
448
909
  usage: {
910
+ /** Number of outbound (sent) documents */
449
911
  outbound: number;
912
+ /** Number of inbound (received) documents */
450
913
  inbound: number;
451
914
  };
452
915
  }
916
+ /** Result of AI-powered data extraction from a single PDF or image file. */
453
917
  export interface ExtractResult {
918
+ /** Extracted structured data (invoice fields, line items, parties, totals, etc.) */
454
919
  extraction: Record<string, unknown>;
920
+ /** Generated UBL 2.1 XML from the extracted data */
455
921
  ubl_xml: string;
922
+ /** Confidence score from 0 to 1 indicating extraction reliability */
456
923
  confidence: number;
924
+ /** Original file name of the uploaded document */
457
925
  file_name: string;
458
926
  }
927
+ /** Result for a single file within a batch extraction — may succeed or fail independently. */
459
928
  export interface BatchExtractItem {
929
+ /** Original file name */
460
930
  file_name: string;
931
+ /** Extracted structured data, present on success */
461
932
  extraction?: Record<string, unknown>;
933
+ /** Generated UBL XML, present on success */
462
934
  ubl_xml?: string;
935
+ /** Confidence score as a string, present on success */
463
936
  confidence?: string;
937
+ /** Error message if extraction failed for this file */
464
938
  error?: string;
465
939
  }
940
+ /** Result of a batch extraction operation across multiple files. */
466
941
  export interface BatchExtractResult {
942
+ /** Unique batch ID for reference */
467
943
  batch_id: string;
944
+ /** Total number of files in the batch */
468
945
  total: number;
946
+ /** Number of files successfully extracted */
469
947
  successful: number;
948
+ /** Number of files that failed extraction */
470
949
  failed: number;
950
+ /** Individual results for each file */
471
951
  results: BatchExtractItem[];
472
952
  }
473
953
  //# sourceMappingURL=types.d.ts.map