@facturino/node 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.
Files changed (178) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +204 -0
  3. package/dist/cjs/client.d.ts +24 -0
  4. package/dist/cjs/client.js +203 -0
  5. package/dist/cjs/errors.d.ts +76 -0
  6. package/dist/cjs/errors.js +128 -0
  7. package/dist/cjs/index.d.ts +59 -0
  8. package/dist/cjs/index.js +77 -0
  9. package/dist/cjs/package.json +3 -0
  10. package/dist/cjs/pagination.d.ts +24 -0
  11. package/dist/cjs/pagination.js +68 -0
  12. package/dist/cjs/resources/account.d.ts +58 -0
  13. package/dist/cjs/resources/account.js +48 -0
  14. package/dist/cjs/resources/archives.d.ts +16 -0
  15. package/dist/cjs/resources/archives.js +17 -0
  16. package/dist/cjs/resources/billing.d.ts +30 -0
  17. package/dist/cjs/resources/billing.js +45 -0
  18. package/dist/cjs/resources/companies.d.ts +47 -0
  19. package/dist/cjs/resources/companies.js +45 -0
  20. package/dist/cjs/resources/creditNotes.d.ts +64 -0
  21. package/dist/cjs/resources/creditNotes.js +62 -0
  22. package/dist/cjs/resources/customers.d.ts +17 -0
  23. package/dist/cjs/resources/customers.js +36 -0
  24. package/dist/cjs/resources/ereporting.d.ts +12 -0
  25. package/dist/cjs/resources/ereporting.js +23 -0
  26. package/dist/cjs/resources/events.d.ts +11 -0
  27. package/dist/cjs/resources/events.js +20 -0
  28. package/dist/cjs/resources/exports.d.ts +20 -0
  29. package/dist/cjs/resources/exports.js +31 -0
  30. package/dist/cjs/resources/health.d.ts +13 -0
  31. package/dist/cjs/resources/health.js +18 -0
  32. package/dist/cjs/resources/invoices.d.ts +112 -0
  33. package/dist/cjs/resources/invoices.js +141 -0
  34. package/dist/cjs/resources/jobs.d.ts +10 -0
  35. package/dist/cjs/resources/jobs.js +24 -0
  36. package/dist/cjs/resources/payments.d.ts +16 -0
  37. package/dist/cjs/resources/payments.js +25 -0
  38. package/dist/cjs/resources/products.d.ts +15 -0
  39. package/dist/cjs/resources/products.js +32 -0
  40. package/dist/cjs/resources/quotes.d.ts +44 -0
  41. package/dist/cjs/resources/quotes.js +58 -0
  42. package/dist/cjs/resources/received-invoices.d.ts +14 -0
  43. package/dist/cjs/resources/received-invoices.js +29 -0
  44. package/dist/cjs/resources/recurringInvoices.d.ts +15 -0
  45. package/dist/cjs/resources/recurringInvoices.js +32 -0
  46. package/dist/cjs/resources/reference.d.ts +45 -0
  47. package/dist/cjs/resources/reference.js +57 -0
  48. package/dist/cjs/resources/reporting.d.ts +11 -0
  49. package/dist/cjs/resources/reporting.js +30 -0
  50. package/dist/cjs/resources/sandbox.d.ts +12 -0
  51. package/dist/cjs/resources/sandbox.js +21 -0
  52. package/dist/cjs/resources/usage.d.ts +20 -0
  53. package/dist/cjs/resources/usage.js +25 -0
  54. package/dist/cjs/resources/validate.d.ts +18 -0
  55. package/dist/cjs/resources/validate.js +23 -0
  56. package/dist/cjs/resources/webhookEndpoints.d.ts +20 -0
  57. package/dist/cjs/resources/webhookEndpoints.js +31 -0
  58. package/dist/cjs/types.d.ts +1178 -0
  59. package/dist/cjs/types.js +5 -0
  60. package/dist/cjs/webhooks.d.ts +14 -0
  61. package/dist/cjs/webhooks.js +63 -0
  62. package/dist/esm/client.d.ts +25 -0
  63. package/dist/esm/client.d.ts.map +1 -0
  64. package/dist/esm/client.js +200 -0
  65. package/dist/esm/client.js.map +1 -0
  66. package/dist/esm/errors.d.ts +77 -0
  67. package/dist/esm/errors.d.ts.map +1 -0
  68. package/dist/esm/errors.js +114 -0
  69. package/dist/esm/errors.js.map +1 -0
  70. package/dist/esm/index.d.ts +60 -0
  71. package/dist/esm/index.d.ts.map +1 -0
  72. package/dist/esm/index.js +61 -0
  73. package/dist/esm/index.js.map +1 -0
  74. package/dist/esm/pagination.d.ts +25 -0
  75. package/dist/esm/pagination.d.ts.map +1 -0
  76. package/dist/esm/pagination.js +65 -0
  77. package/dist/esm/pagination.js.map +1 -0
  78. package/dist/esm/resources/account.d.ts +59 -0
  79. package/dist/esm/resources/account.d.ts.map +1 -0
  80. package/dist/esm/resources/account.js +45 -0
  81. package/dist/esm/resources/account.js.map +1 -0
  82. package/dist/esm/resources/archives.d.ts +17 -0
  83. package/dist/esm/resources/archives.d.ts.map +1 -0
  84. package/dist/esm/resources/archives.js +14 -0
  85. package/dist/esm/resources/archives.js.map +1 -0
  86. package/dist/esm/resources/billing.d.ts +31 -0
  87. package/dist/esm/resources/billing.d.ts.map +1 -0
  88. package/dist/esm/resources/billing.js +42 -0
  89. package/dist/esm/resources/billing.js.map +1 -0
  90. package/dist/esm/resources/companies.d.ts +48 -0
  91. package/dist/esm/resources/companies.d.ts.map +1 -0
  92. package/dist/esm/resources/companies.js +42 -0
  93. package/dist/esm/resources/companies.js.map +1 -0
  94. package/dist/esm/resources/creditNotes.d.ts +65 -0
  95. package/dist/esm/resources/creditNotes.d.ts.map +1 -0
  96. package/dist/esm/resources/creditNotes.js +59 -0
  97. package/dist/esm/resources/creditNotes.js.map +1 -0
  98. package/dist/esm/resources/customers.d.ts +18 -0
  99. package/dist/esm/resources/customers.d.ts.map +1 -0
  100. package/dist/esm/resources/customers.js +33 -0
  101. package/dist/esm/resources/customers.js.map +1 -0
  102. package/dist/esm/resources/ereporting.d.ts +13 -0
  103. package/dist/esm/resources/ereporting.d.ts.map +1 -0
  104. package/dist/esm/resources/ereporting.js +20 -0
  105. package/dist/esm/resources/ereporting.js.map +1 -0
  106. package/dist/esm/resources/events.d.ts +12 -0
  107. package/dist/esm/resources/events.d.ts.map +1 -0
  108. package/dist/esm/resources/events.js +17 -0
  109. package/dist/esm/resources/events.js.map +1 -0
  110. package/dist/esm/resources/exports.d.ts +21 -0
  111. package/dist/esm/resources/exports.d.ts.map +1 -0
  112. package/dist/esm/resources/exports.js +28 -0
  113. package/dist/esm/resources/exports.js.map +1 -0
  114. package/dist/esm/resources/health.d.ts +14 -0
  115. package/dist/esm/resources/health.d.ts.map +1 -0
  116. package/dist/esm/resources/health.js +15 -0
  117. package/dist/esm/resources/health.js.map +1 -0
  118. package/dist/esm/resources/invoices.d.ts +113 -0
  119. package/dist/esm/resources/invoices.d.ts.map +1 -0
  120. package/dist/esm/resources/invoices.js +138 -0
  121. package/dist/esm/resources/invoices.js.map +1 -0
  122. package/dist/esm/resources/jobs.d.ts +11 -0
  123. package/dist/esm/resources/jobs.d.ts.map +1 -0
  124. package/dist/esm/resources/jobs.js +21 -0
  125. package/dist/esm/resources/jobs.js.map +1 -0
  126. package/dist/esm/resources/payments.d.ts +17 -0
  127. package/dist/esm/resources/payments.d.ts.map +1 -0
  128. package/dist/esm/resources/payments.js +22 -0
  129. package/dist/esm/resources/payments.js.map +1 -0
  130. package/dist/esm/resources/products.d.ts +16 -0
  131. package/dist/esm/resources/products.d.ts.map +1 -0
  132. package/dist/esm/resources/products.js +29 -0
  133. package/dist/esm/resources/products.js.map +1 -0
  134. package/dist/esm/resources/quotes.d.ts +45 -0
  135. package/dist/esm/resources/quotes.d.ts.map +1 -0
  136. package/dist/esm/resources/quotes.js +55 -0
  137. package/dist/esm/resources/quotes.js.map +1 -0
  138. package/dist/esm/resources/received-invoices.d.ts +15 -0
  139. package/dist/esm/resources/received-invoices.d.ts.map +1 -0
  140. package/dist/esm/resources/received-invoices.js +26 -0
  141. package/dist/esm/resources/received-invoices.js.map +1 -0
  142. package/dist/esm/resources/recurringInvoices.d.ts +16 -0
  143. package/dist/esm/resources/recurringInvoices.d.ts.map +1 -0
  144. package/dist/esm/resources/recurringInvoices.js +29 -0
  145. package/dist/esm/resources/recurringInvoices.js.map +1 -0
  146. package/dist/esm/resources/reference.d.ts +46 -0
  147. package/dist/esm/resources/reference.d.ts.map +1 -0
  148. package/dist/esm/resources/reference.js +54 -0
  149. package/dist/esm/resources/reference.js.map +1 -0
  150. package/dist/esm/resources/reporting.d.ts +12 -0
  151. package/dist/esm/resources/reporting.d.ts.map +1 -0
  152. package/dist/esm/resources/reporting.js +27 -0
  153. package/dist/esm/resources/reporting.js.map +1 -0
  154. package/dist/esm/resources/sandbox.d.ts +13 -0
  155. package/dist/esm/resources/sandbox.d.ts.map +1 -0
  156. package/dist/esm/resources/sandbox.js +18 -0
  157. package/dist/esm/resources/sandbox.js.map +1 -0
  158. package/dist/esm/resources/usage.d.ts +21 -0
  159. package/dist/esm/resources/usage.d.ts.map +1 -0
  160. package/dist/esm/resources/usage.js +22 -0
  161. package/dist/esm/resources/usage.js.map +1 -0
  162. package/dist/esm/resources/validate.d.ts +19 -0
  163. package/dist/esm/resources/validate.d.ts.map +1 -0
  164. package/dist/esm/resources/validate.js +20 -0
  165. package/dist/esm/resources/validate.js.map +1 -0
  166. package/dist/esm/resources/webhookEndpoints.d.ts +21 -0
  167. package/dist/esm/resources/webhookEndpoints.d.ts.map +1 -0
  168. package/dist/esm/resources/webhookEndpoints.js +28 -0
  169. package/dist/esm/resources/webhookEndpoints.js.map +1 -0
  170. package/dist/esm/types.d.ts +1179 -0
  171. package/dist/esm/types.d.ts.map +1 -0
  172. package/dist/esm/types.js +5 -0
  173. package/dist/esm/types.js.map +1 -0
  174. package/dist/esm/webhooks.d.ts +15 -0
  175. package/dist/esm/webhooks.d.ts.map +1 -0
  176. package/dist/esm/webhooks.js +60 -0
  177. package/dist/esm/webhooks.js.map +1 -0
  178. package/package.json +66 -0
@@ -0,0 +1,1179 @@
1
+ export interface FacturinoConfig {
2
+ /** API base URL. Defaults to https://facturino.com/api */
3
+ baseUrl?: string;
4
+ /** Max retries on 429/5xx (default: 3). */
5
+ maxRetries?: number;
6
+ /** Timeout in ms (default: 30000). */
7
+ timeout?: number;
8
+ /** API version header (default: "2026-03-01"). */
9
+ apiVersion?: string;
10
+ }
11
+ export interface RequestOptions {
12
+ idempotencyKey?: string;
13
+ }
14
+ export interface PaginationParams {
15
+ limit?: number;
16
+ starting_after?: string;
17
+ }
18
+ export interface PaginatedResponse<T> {
19
+ object: 'list';
20
+ url: string;
21
+ data: T[];
22
+ has_more: boolean;
23
+ next_cursor: string | null;
24
+ }
25
+ export interface ApiErrorBody {
26
+ error: {
27
+ type: string;
28
+ code: string;
29
+ message: string;
30
+ param?: string;
31
+ doc_url?: string;
32
+ request_id: string;
33
+ hint?: string;
34
+ };
35
+ }
36
+ export interface Address {
37
+ line1: string;
38
+ line2?: string;
39
+ postalCode: string;
40
+ city: string;
41
+ country: string;
42
+ }
43
+ /** A contact attached to a customer. */
44
+ export interface Contact {
45
+ firstName?: string;
46
+ lastName?: string;
47
+ email?: string;
48
+ phone?: string;
49
+ /**
50
+ * Role of the contact for this customer. The `billing` contact receives
51
+ * invoices by email by default.
52
+ */
53
+ role?: ContactRole;
54
+ }
55
+ export type ContactRole = 'billing' | 'technical' | 'main';
56
+ export interface LineItem {
57
+ id: string;
58
+ description: string;
59
+ quantity: string;
60
+ unit: Unit;
61
+ unitPrice: number;
62
+ discountPercent: number;
63
+ lineAmount: number;
64
+ vatRate: number;
65
+ vatCode: VatCode;
66
+ vatexCode?: VatexCode;
67
+ vatAmount: number;
68
+ lineTotal: number;
69
+ product: string | null;
70
+ }
71
+ export interface VatBreakdown {
72
+ rate: number;
73
+ code: VatCode;
74
+ vatexCode?: VatexCode;
75
+ base: number;
76
+ amount: number;
77
+ }
78
+ export interface Totals {
79
+ totalHT: number;
80
+ discountAmount: number;
81
+ vatBreakdown: VatBreakdown[];
82
+ totalVAT: number;
83
+ totalTTC: number;
84
+ amountDue: number;
85
+ amountPaid: number;
86
+ }
87
+ export interface CustomerRef {
88
+ ref: string;
89
+ snapshot: CustomerSnapshot;
90
+ }
91
+ export interface CustomerSnapshot {
92
+ name: string;
93
+ siret?: string;
94
+ vatNumber?: string;
95
+ address: Address;
96
+ }
97
+ export interface LifecycleEntry {
98
+ status: string;
99
+ timestamp: string;
100
+ source: 'user' | 'system' | 'pa';
101
+ details: string | null;
102
+ }
103
+ export type Currency = 'eur';
104
+ export type Unit = 'unit' | 'hour' | 'day' | 'month' | 'flat_rate' | 'kg' | 'm' | 'm2' | 'm3' | 'l';
105
+ export type VatCode = 'S' | 'Z' | 'E' | 'AE' | 'G' | 'IC' | 'K' | 'O' | 'VATEX-FR-FRANCHISE';
106
+ /**
107
+ * Specific VATEX exemption code (BT-121). Set it on a line when the exemption
108
+ * basis differs from the category default (e.g. Qualiopi training, margin
109
+ * scheme, Corsica/DOM, BTP reverse charge) — otherwise the category default
110
+ * applies (category E defaults to the 293 B franchise mention).
111
+ */
112
+ export type VatexCode = 'VATEX-EU-AE' | 'VATEX-EU-D' | 'VATEX-EU-F' | 'VATEX-EU-G' | 'VATEX-EU-IC' | 'VATEX-EU-O' | 'VATEX-FR-FRANCHISE' | 'VATEX-FR-CNWVAT' | 'VATEX-FR-AUTOLIQ' | 'VATEX-FR-261';
113
+ export type PaymentMethod = 'transfer' | 'card' | 'check' | 'cash' | 'direct_debit' | 'sepa';
114
+ export type InvoiceType = 'standard' | 'deposit' | 'credit_note' | 'corrective' | 'self_billing';
115
+ export type InvoiceStatus = 'draft' | 'finalized' | 'sending' | 'deposited' | 'transmitted' | 'rejected' | 'available' | 'received' | 'approved' | 'refused' | 'suspended' | 'partially_paid' | 'paid' | 'overdue';
116
+ export interface InvoiceDates {
117
+ issued: string;
118
+ due: string;
119
+ serviceStart: string | null;
120
+ serviceEnd: string | null;
121
+ finalizedAt: string | null;
122
+ sentAt: string | null;
123
+ }
124
+ export interface InvoicePaymentTerms {
125
+ terms: string;
126
+ termsDays: number;
127
+ method: PaymentMethod;
128
+ iban?: string;
129
+ bic?: string;
130
+ earlyPaymentDiscount?: string;
131
+ latePaymentRate: string;
132
+ collectionFee: string;
133
+ }
134
+ export interface InvoiceEinvoicing {
135
+ paId: string | null;
136
+ paStatus: string | null;
137
+ paTransactionId: string | null;
138
+ paErrorCode: string | null;
139
+ paIdempotencyKey: string | null;
140
+ peppolDeliveryId: string | null;
141
+ ereportingId: string | null;
142
+ sentAt: string | null;
143
+ trackingId: string | null;
144
+ }
145
+ export interface InvoicePortal {
146
+ token: string;
147
+ expiresAt: string;
148
+ firstViewedAt: string | null;
149
+ }
150
+ export interface InvoiceArchive {
151
+ hash: string | null;
152
+ previousHash: string | null;
153
+ archivedAt: string | null;
154
+ archivedFilePath?: string;
155
+ }
156
+ export interface InvoiceFiles {
157
+ pdfPath?: string;
158
+ facturxPath?: string;
159
+ xmlPath?: string;
160
+ }
161
+ export interface Invoice {
162
+ id: string;
163
+ object: 'invoice';
164
+ type: InvoiceType;
165
+ status: InvoiceStatus;
166
+ number: string | null;
167
+ currency: Currency;
168
+ customer: CustomerRef;
169
+ items: LineItem[];
170
+ totals: Totals;
171
+ dates: InvoiceDates;
172
+ paymentInfo: InvoicePaymentTerms;
173
+ einvoicing: InvoiceEinvoicing;
174
+ archive: InvoiceArchive | null;
175
+ files: InvoiceFiles;
176
+ portal: InvoicePortal | null;
177
+ notes: string | null;
178
+ legalMentions: string | null;
179
+ lifecycle: LifecycleEntry[];
180
+ metadata: Record<string, unknown>;
181
+ /** Populated only when requested via the `expand` retrieve parameter. */
182
+ expanded?: InvoiceExpanded;
183
+ livemode: boolean;
184
+ created: string;
185
+ updated: string;
186
+ }
187
+ /** Fields that can be inlined via the `expand` retrieve parameter. */
188
+ export type InvoiceExpandField = 'customer' | 'items.product' | 'credit_notes';
189
+ /** Expanded objects inlined on an invoice when requested via `expand`. */
190
+ export interface InvoiceExpanded {
191
+ customer?: Customer;
192
+ /** Credit notes issued against this invoice (with `expand=credit_notes`). */
193
+ credit_notes?: CreditNote[];
194
+ /** TTC total minus credited amounts, in integer cents (with `expand=credit_notes`). */
195
+ net_balance?: number;
196
+ }
197
+ /** Query parameters for {@link Invoices.get}. */
198
+ export interface InvoiceRetrieveParams {
199
+ /** Objects to inline in the response (e.g. `['customer', 'credit_notes']`). */
200
+ expand?: InvoiceExpandField[];
201
+ }
202
+ export interface InvoiceBuyerParam {
203
+ companyName: string;
204
+ siret?: string;
205
+ vatNumber?: string;
206
+ address: Address;
207
+ deliveryAddress?: Address;
208
+ }
209
+ export interface InvoiceCreateDates {
210
+ issued: string;
211
+ due: string;
212
+ serviceStart?: string;
213
+ serviceEnd?: string;
214
+ }
215
+ /** A deposit invoice (386) linked to this balance invoice; its TTC is deducted (BT-113). */
216
+ export interface InvoiceDepositParam {
217
+ invoiceId: string;
218
+ }
219
+ /** A payment-schedule instalment. `amount` in integer centimes; last instalment on the due date. */
220
+ export interface InvoiceScheduleParam {
221
+ amount: number;
222
+ dueDate: string;
223
+ label?: string;
224
+ }
225
+ export interface InvoiceCreateParams {
226
+ customerId: string;
227
+ type?: InvoiceType;
228
+ lines: InvoiceLineItemParam[];
229
+ buyer: InvoiceBuyerParam;
230
+ dates: InvoiceCreateDates;
231
+ payment: InvoicePaymentTerms;
232
+ notes?: string;
233
+ purchaseOrderNumber?: string;
234
+ /** Deposit invoices to deduct from the amount due (CGI art. 289). Max 20. */
235
+ deposits?: InvoiceDepositParam[];
236
+ /** Payment schedule (2 to 12 instalments) summing to the total. */
237
+ schedule?: InvoiceScheduleParam[];
238
+ metadata?: Record<string, unknown>;
239
+ /** Finalize the invoice in the same call (assigns its number). */
240
+ autoFinalize?: boolean;
241
+ /**
242
+ * Finalize then send in the same call: by email to the customer
243
+ * (`email`) and/or by deposit to the connected PA (`pa`).
244
+ */
245
+ autoSend?: {
246
+ email?: boolean;
247
+ pa?: boolean;
248
+ };
249
+ }
250
+ export interface InvoiceLineItemParam {
251
+ description: string;
252
+ quantity: string;
253
+ unit: Unit;
254
+ unitPrice: number;
255
+ vatRate: number;
256
+ vatCode: VatCode;
257
+ /** Optional specific VATEX exemption code (BT-121) when the basis differs from
258
+ * the category default. See {@link VatexCode}. */
259
+ vatexCode?: VatexCode;
260
+ discountPercent?: number;
261
+ product?: string | null;
262
+ }
263
+ export interface InvoiceUpdateParams {
264
+ buyer?: InvoiceBuyerParam;
265
+ lines?: InvoiceLineItemParam[];
266
+ dates?: Partial<InvoiceCreateDates>;
267
+ payment?: Partial<InvoicePaymentTerms>;
268
+ notes?: string;
269
+ purchaseOrderNumber?: string;
270
+ /** Replace the linked deposit invoices; an empty array unlinks them. */
271
+ deposits?: InvoiceDepositParam[];
272
+ /** Replace the payment schedule. */
273
+ schedule?: InvoiceScheduleParam[];
274
+ metadata?: Record<string, unknown>;
275
+ }
276
+ export interface InvoiceListParams extends PaginationParams {
277
+ status?: InvoiceStatus;
278
+ /** Filter to invoices issued from the given quote (id starting with `quo_`). */
279
+ convertedFrom?: string;
280
+ }
281
+ /**
282
+ * Record a supplier invoice received outside the platform (manual entry), so
283
+ * it appears in the inbound register alongside e-invoices delivered via the PA.
284
+ */
285
+ export interface IncomingInvoiceCreateParams {
286
+ senderName: string;
287
+ senderSiret?: string;
288
+ /** Total amount incl. VAT, in integer cents. */
289
+ amount: number;
290
+ /** The supplier's invoice number / reference. */
291
+ reference?: string;
292
+ notes?: string;
293
+ }
294
+ export interface InvoiceStatusResponse {
295
+ status: InvoiceStatus;
296
+ einvoicing: {
297
+ paStatus: string | null;
298
+ paId: string | null;
299
+ };
300
+ dates: {
301
+ due: string | null;
302
+ finalizedAt: string | null;
303
+ };
304
+ }
305
+ export interface InvoiceVerifyResponse {
306
+ id: string;
307
+ object: 'invoice';
308
+ verified: boolean;
309
+ archive: InvoiceArchive | null;
310
+ chain_length: number;
311
+ details: string;
312
+ }
313
+ export interface DocumentUrlResponse {
314
+ url: string;
315
+ expires_in: number;
316
+ }
317
+ export interface JobResponse {
318
+ id: string;
319
+ object: 'job';
320
+ type: string;
321
+ status: string;
322
+ invoiceId?: string;
323
+ /** Signed download URL — present once the job has a deliverable. */
324
+ download_url?: string;
325
+ /** Validity of `download_url`, in seconds. */
326
+ expires_in?: number;
327
+ /** Alias of `download_url` (callable response shape). */
328
+ url?: string;
329
+ /** ISO 8601 expiry of the signed URL. */
330
+ expiresAt?: string;
331
+ }
332
+ export interface PaymentLinkResponse {
333
+ object: 'payment_link';
334
+ url: string;
335
+ session_id: string;
336
+ }
337
+ export interface PaymentLinkCreateParams {
338
+ success_url?: string;
339
+ cancel_url?: string;
340
+ }
341
+ export interface PaymentTokenResponse {
342
+ object: 'payment_token';
343
+ token: string;
344
+ pay_url: string;
345
+ expires_at: string;
346
+ }
347
+ export interface Payment {
348
+ id: string;
349
+ object: 'payment';
350
+ amount: number;
351
+ method: PaymentMethod | 'other';
352
+ reference: string | null;
353
+ paidAt: string;
354
+ recorded_by: 'api' | 'ui';
355
+ created: string;
356
+ }
357
+ export interface PaymentCreateParams {
358
+ amount: number;
359
+ method: PaymentMethod | 'other';
360
+ reference?: string;
361
+ paidAt: string;
362
+ }
363
+ /** Result of cancelling a payment — the invoice is re-settled from the reversal. */
364
+ export interface PaymentCancelResult {
365
+ id: string;
366
+ object: 'payment';
367
+ status: 'cancelled';
368
+ /** Recomputed invoice status after the reversal. */
369
+ invoiceStatus: InvoiceStatus;
370
+ /** Recomputed amount due, in integer centimes. */
371
+ amountDue: number;
372
+ }
373
+ export interface Customer {
374
+ id: string;
375
+ object: 'customer';
376
+ name: string;
377
+ siret?: string;
378
+ siren?: string;
379
+ vatNumber?: string;
380
+ legalForm?: LegalForm | null;
381
+ naf?: NafCode | null;
382
+ address: Address;
383
+ deliveryAddress?: Address;
384
+ type: 'company' | 'individual';
385
+ contacts?: Contact[];
386
+ paymentTerms?: number;
387
+ tags?: string[];
388
+ notes?: string;
389
+ balance: number;
390
+ currency: Currency;
391
+ siretVerified: boolean;
392
+ vatVerified: boolean;
393
+ paIdentifier?: string;
394
+ preferredFormat?: 'facturx' | 'ubl' | 'cii';
395
+ receivingPaId?: string;
396
+ recipientServiceCode?: string;
397
+ active: boolean;
398
+ livemode: boolean;
399
+ created: string;
400
+ updated: string;
401
+ }
402
+ export interface CustomerCreateParams {
403
+ name: string;
404
+ type: 'company' | 'individual';
405
+ address: Address;
406
+ email?: string;
407
+ siret?: string;
408
+ siren?: string;
409
+ vatNumber?: string;
410
+ legalForm?: LegalFormInput;
411
+ naf?: NafCodeInput;
412
+ deliveryAddress?: Address;
413
+ contacts?: Contact[];
414
+ paymentTerms?: number;
415
+ tags?: string[];
416
+ notes?: string;
417
+ paIdentifier?: string;
418
+ preferredFormat?: 'facturx' | 'ubl' | 'cii';
419
+ receivingPaId?: string;
420
+ metadata?: Record<string, unknown>;
421
+ }
422
+ export interface CustomerUpdateParams {
423
+ name?: string;
424
+ type?: 'company' | 'individual';
425
+ address?: Address;
426
+ email?: string;
427
+ siret?: string;
428
+ vatNumber?: string;
429
+ legalForm?: LegalFormInput;
430
+ naf?: NafCodeInput;
431
+ deliveryAddress?: Address;
432
+ contacts?: Contact[];
433
+ paymentTerms?: number;
434
+ tags?: string[];
435
+ notes?: string;
436
+ paIdentifier?: string;
437
+ preferredFormat?: 'facturx' | 'ubl' | 'cii';
438
+ receivingPaId?: string;
439
+ }
440
+ export interface CustomerListParams extends PaginationParams {
441
+ status?: 'active' | 'inactive';
442
+ }
443
+ export interface CustomerLookupParams {
444
+ siret?: string;
445
+ query?: string;
446
+ }
447
+ /** Company details resolved from the INSEE Sirene registry (not a stored customer). */
448
+ export interface SireneCompany {
449
+ name: string;
450
+ siret: string;
451
+ siren: string;
452
+ vatNumber: string;
453
+ legalForm: LegalForm | null;
454
+ naf: NafCode | null;
455
+ address: Address;
456
+ active: boolean;
457
+ }
458
+ /**
459
+ * Result of a customer lookup. A SIRET lookup returns object `sirene_lookup`
460
+ * with `found`/`data`; a name query returns object `sirene_search` with
461
+ * `results`/`total` instead.
462
+ */
463
+ export interface SireneLookupResponse {
464
+ object: 'sirene_lookup' | 'sirene_search';
465
+ found?: boolean;
466
+ data?: SireneCompany | null;
467
+ results?: SireneCompany[];
468
+ total?: number;
469
+ warning?: string;
470
+ }
471
+ export interface Product {
472
+ id: string;
473
+ object: 'product';
474
+ name: string;
475
+ description?: string;
476
+ reference?: string;
477
+ category?: string;
478
+ unitPrice: number;
479
+ vatRate: number;
480
+ vatCode: VatCode;
481
+ unit: Unit;
482
+ tags: string[];
483
+ priceHistory: PriceHistoryEntry[];
484
+ active: boolean;
485
+ livemode: boolean;
486
+ created: string;
487
+ updated: string;
488
+ }
489
+ export interface PriceHistoryEntry {
490
+ price: number;
491
+ vatRate: number;
492
+ changedAt: string;
493
+ changedBy: string;
494
+ }
495
+ export interface ProductCreateParams {
496
+ name: string;
497
+ unitPrice: number;
498
+ vatRate: number;
499
+ vatCode: VatCode;
500
+ unit: Unit;
501
+ description?: string;
502
+ reference?: string;
503
+ category?: string;
504
+ }
505
+ export interface ProductUpdateParams {
506
+ name?: string;
507
+ unitPrice?: number;
508
+ vatRate?: number;
509
+ vatCode?: VatCode;
510
+ unit?: Unit;
511
+ description?: string;
512
+ reference?: string;
513
+ category?: string;
514
+ active?: boolean;
515
+ }
516
+ export interface ProductListParams extends PaginationParams {
517
+ status?: 'active' | 'inactive';
518
+ /** Prefix search on the product name. */
519
+ q?: string;
520
+ /** Filter by product category. */
521
+ category?: string;
522
+ /** Filter by active state. */
523
+ active?: boolean;
524
+ }
525
+ export type QuoteStatus = 'draft' | 'sent' | 'viewed' | 'accepted' | 'refused' | 'expired' | 'converted' | 'deleted';
526
+ export interface QuoteDates {
527
+ issued: string;
528
+ sent?: string;
529
+ validUntil: string;
530
+ }
531
+ export interface QuoteSignature {
532
+ signedAt?: string;
533
+ signerEmail?: string;
534
+ signerIp?: string;
535
+ documentHash?: string;
536
+ }
537
+ export interface Quote {
538
+ id: string;
539
+ object: 'quote';
540
+ customer: CustomerRef;
541
+ status: QuoteStatus;
542
+ number: string | null;
543
+ currency: Currency;
544
+ versionNumber: number;
545
+ parentQuoteId?: string;
546
+ isLatestVersion: boolean;
547
+ items: LineItem[];
548
+ totals: Totals;
549
+ dates: QuoteDates;
550
+ notes?: string;
551
+ viewedAt?: string;
552
+ viewCount: number;
553
+ acceptedAt?: string;
554
+ signature?: QuoteSignature;
555
+ convertedInvoiceId?: string;
556
+ files?: {
557
+ pdfPath?: string;
558
+ };
559
+ livemode: boolean;
560
+ created: string;
561
+ updated: string;
562
+ }
563
+ export interface QuoteCreateParams {
564
+ customerId: string;
565
+ lines: InvoiceLineItemParam[];
566
+ dates?: Partial<QuoteDates>;
567
+ validityDays?: number;
568
+ notes?: string;
569
+ metadata?: Record<string, unknown>;
570
+ }
571
+ export interface QuoteUpdateParams {
572
+ lines?: InvoiceLineItemParam[];
573
+ dates?: Partial<QuoteDates>;
574
+ validityDays?: number;
575
+ notes?: string;
576
+ metadata?: Record<string, unknown>;
577
+ }
578
+ export interface QuoteListParams extends PaginationParams {
579
+ status?: QuoteStatus;
580
+ }
581
+ export type CreditNoteType = 'total' | 'partial' | 'commercial' | 'financial';
582
+ export type CreditNoteStatus = 'draft' | 'finalized' | 'credit_deposited' | 'credit_transmitted' | 'credit_approved' | 'credit_refused';
583
+ export type CreditNoteReasonCode = 'defective_goods' | 'duplicate' | 'quality' | 'other';
584
+ export interface CreditNote {
585
+ id: string;
586
+ object: 'credit_note';
587
+ customer: CustomerRef;
588
+ relatedInvoiceId: string;
589
+ status: CreditNoteStatus;
590
+ creditNoteType: CreditNoteType;
591
+ number: string | null;
592
+ currency: Currency;
593
+ reasonCode: CreditNoteReasonCode;
594
+ reason?: string;
595
+ items: LineItem[];
596
+ totals: Totals;
597
+ dates: {
598
+ issued: string;
599
+ finalizedAt?: string;
600
+ sentAt?: string;
601
+ };
602
+ einvoicing?: {
603
+ paId: string | null;
604
+ paStatus: string | null;
605
+ depositedAt: string | null;
606
+ };
607
+ files?: {
608
+ pdfPath?: string;
609
+ facturxPath?: string;
610
+ };
611
+ notes?: string;
612
+ archive: {
613
+ hash: string | null;
614
+ previousHash: string | null;
615
+ archivedAt: string | null;
616
+ } | null;
617
+ livemode: boolean;
618
+ created: string;
619
+ updated: string;
620
+ }
621
+ export interface CreditNoteCreateParams {
622
+ customerId: string;
623
+ relatedInvoiceId: string;
624
+ creditNoteType: CreditNoteType;
625
+ reasonCode: CreditNoteReasonCode;
626
+ reason?: string;
627
+ items: InvoiceLineItemParam[];
628
+ dates?: {
629
+ issued: string;
630
+ };
631
+ notes?: string;
632
+ metadata?: Record<string, unknown>;
633
+ }
634
+ export interface CreditNoteUpdateParams {
635
+ items?: InvoiceLineItemParam[];
636
+ reason?: string;
637
+ notes?: string;
638
+ metadata?: Record<string, unknown>;
639
+ }
640
+ export interface CreditNoteListParams extends PaginationParams {
641
+ status?: CreditNoteStatus;
642
+ }
643
+ export type WebhookEventType = 'invoice.created' | 'invoice.finalized' | 'invoice.sending' | 'invoice.sent' | 'invoice.deposited' | 'invoice.transmitted' | 'invoice.available' | 'invoice.received' | 'invoice.approved' | 'invoice.refused' | 'invoice.rejected' | 'invoice.suspended' | 'invoice.paid' | 'invoice.partially_paid' | 'invoice.overdue' | 'invoice.payment_recorded' | 'invoice.viewed' | 'invoice.incoming.received' | 'received_invoice.available' | 'received_invoice.approved' | 'received_invoice.refused' | 'received_invoice.suspended' | 'quote.created' | 'quote.sent' | 'quote.viewed' | 'quote.accepted' | 'quote.refused' | 'quote.expired' | 'quote.converted' | 'credit_note.created' | 'credit_note.finalized' | 'credit_note.credit_deposited' | 'credit_note.credit_transmitted' | 'credit_note.credit_approved' | 'credit_note.credit_refused' | 'credit_note.sent' | 'customer.created' | 'customer.updated' | 'customer.deleted' | 'payment.created' | 'payment.updated' | 'payment.received' | 'payment.reconciled' | 'ereporting.submitted' | 'ereporting.accepted' | 'ereporting.rejected' | 'recurring_invoice.generated' | 'recurring_invoice.failed' | 'export.ready' | 'subscription.created' | 'subscription.cancelled' | 'subscription.renewed';
644
+ export interface WebhookEvent {
645
+ id: string;
646
+ object: 'event';
647
+ type: WebhookEventType;
648
+ apiVersion: string;
649
+ data: {
650
+ id: string;
651
+ object: string;
652
+ [key: string]: unknown;
653
+ };
654
+ request?: {
655
+ id?: string;
656
+ idempotencyKey?: string;
657
+ };
658
+ delivered: boolean;
659
+ livemode: boolean;
660
+ created: string;
661
+ updated: string;
662
+ }
663
+ export interface EventListParams extends PaginationParams {
664
+ type?: WebhookEventType;
665
+ }
666
+ export interface WebhookEndpoint {
667
+ id: string;
668
+ object: 'webhook_endpoint';
669
+ url: string;
670
+ secret: string;
671
+ events: WebhookEventType[];
672
+ description?: string;
673
+ livemode: boolean;
674
+ active: boolean;
675
+ created: string;
676
+ updated: string;
677
+ }
678
+ export interface WebhookEndpointCreateParams {
679
+ url: string;
680
+ events: WebhookEventType[];
681
+ description?: string;
682
+ }
683
+ export interface WebhookEndpointUpdateParams {
684
+ url?: string;
685
+ events?: WebhookEventType[];
686
+ description?: string;
687
+ active?: boolean;
688
+ }
689
+ export type RecurringFrequency = 'weekly' | 'monthly' | 'quarterly' | 'yearly' | 'custom';
690
+ export interface RecurringInvoice {
691
+ id: string;
692
+ object: 'recurring_invoice';
693
+ customerId: string;
694
+ currency: Currency;
695
+ frequency: RecurringFrequency;
696
+ customInterval: number | null;
697
+ customUnit: 'days' | 'weeks' | 'months' | null;
698
+ startDate: string;
699
+ nextGenerationDate: string;
700
+ endDate: string | null;
701
+ templateInvoice: {
702
+ items: LineItem[];
703
+ notes?: string;
704
+ paymentMethod?: PaymentMethod;
705
+ paymentTermsDays?: number;
706
+ currency: Currency;
707
+ };
708
+ autoFinalize: boolean;
709
+ autoSend: boolean;
710
+ lastGeneratedAt: string | null;
711
+ lastGeneratedInvoiceId: string | null;
712
+ generationCount: number;
713
+ active: boolean;
714
+ livemode: boolean;
715
+ created: string;
716
+ updated: string;
717
+ }
718
+ export interface RecurringInvoiceCreateParams {
719
+ customerId: string;
720
+ frequency: RecurringFrequency;
721
+ startDate: string;
722
+ nextGenerationDate: string;
723
+ endDate?: string;
724
+ customIntervalDays?: number;
725
+ templateInvoice: {
726
+ items: InvoiceLineItemParam[];
727
+ notes?: string;
728
+ paymentMethod?: PaymentMethod;
729
+ paymentTermsDays?: number;
730
+ };
731
+ autoFinalize?: boolean;
732
+ autoSend?: boolean;
733
+ }
734
+ export interface RecurringInvoiceUpdateParams {
735
+ frequency?: RecurringFrequency;
736
+ nextGenerationDate?: string;
737
+ endDate?: string;
738
+ customIntervalDays?: number;
739
+ templateInvoice?: {
740
+ items?: InvoiceLineItemParam[];
741
+ notes?: string;
742
+ paymentMethod?: PaymentMethod;
743
+ paymentTermsDays?: number;
744
+ };
745
+ autoFinalize?: boolean;
746
+ autoSend?: boolean;
747
+ }
748
+ export interface RecurringInvoiceListParams extends PaginationParams {
749
+ /** Filter by schedule state. Omit to return both active and paused schedules. */
750
+ status?: 'active' | 'inactive';
751
+ }
752
+ export interface BankDetails {
753
+ iban?: string;
754
+ bic?: string;
755
+ bankName?: string;
756
+ }
757
+ export interface InvoiceSettings {
758
+ prefix: string;
759
+ nextNumber: number;
760
+ defaultVatRate: string;
761
+ legalMentions?: string;
762
+ yearlyReset: boolean;
763
+ }
764
+ /** Credit-note numbering configuration for a company. */
765
+ export interface CreditNoteSettings {
766
+ /**
767
+ * Numbering strategy for credit notes. `separate` (default) gives credit
768
+ * notes their own number series; `unified` shares the invoice number series.
769
+ */
770
+ numberingMode?: CreditNoteNumberingMode;
771
+ }
772
+ export type CreditNoteNumberingMode = 'separate' | 'unified';
773
+ export interface Company {
774
+ id: string;
775
+ name: string;
776
+ siret: string;
777
+ siren: string;
778
+ vatNumber: string;
779
+ legalForm: LegalForm | null;
780
+ naf?: NafCode | null;
781
+ rcs?: string;
782
+ capitalSocial?: string;
783
+ tvaIntracom: string;
784
+ address: Address;
785
+ email?: string;
786
+ phone?: string;
787
+ website?: string;
788
+ logoPath?: string;
789
+ vatRegime: 'normal' | 'franchise' | 'simplified' | 'debit';
790
+ billingEmail?: string;
791
+ bankDetails: BankDetails;
792
+ defaultPaymentTerms: number;
793
+ defaultPaymentMethod: PaymentMethod;
794
+ invoiceSettings: InvoiceSettings;
795
+ creditNoteSettings?: CreditNoteSettings;
796
+ active: boolean;
797
+ onboardingCompleted: boolean;
798
+ created: string;
799
+ updated: string;
800
+ }
801
+ export interface CompanyUpdateParams {
802
+ name?: string;
803
+ address?: Address;
804
+ email?: string;
805
+ phone?: string;
806
+ website?: string;
807
+ vatRegime?: 'normal' | 'franchise' | 'simplified' | 'debit';
808
+ billingEmail?: string;
809
+ bankDetails?: BankDetails;
810
+ defaultPaymentTerms?: number;
811
+ defaultPaymentMethod?: PaymentMethod;
812
+ invoiceSettings?: Partial<InvoiceSettings>;
813
+ creditNoteSettings?: CreditNoteSettings;
814
+ }
815
+ export interface CgvResponse {
816
+ object: 'cgv';
817
+ url?: string;
818
+ updatedAt?: string | null;
819
+ deleted?: boolean;
820
+ }
821
+ export interface FecExportParams {
822
+ period_start?: string;
823
+ period_end?: string;
824
+ send_to_accountant?: boolean;
825
+ accountant_email?: string;
826
+ }
827
+ export interface InvoiceExportParams {
828
+ /** Lower bound on the invoice issue date (inclusive), YYYY-MM-DD. */
829
+ period_start?: string;
830
+ /** Upper bound on the invoice issue date (inclusive), YYYY-MM-DD. */
831
+ period_end?: string;
832
+ /** Restrict to these lifecycle statuses. Defaults to every non-draft status. */
833
+ statuses?: string[];
834
+ }
835
+ export type EReportingType = 'b2c' | 'international' | 'intra_eu' | 'payment';
836
+ export type EReportingStatus = 'draft' | 'submitted' | 'accepted' | 'rejected';
837
+ /** Input line: amounts in centimes, vatRate in centipercent */
838
+ export interface EReportingLine {
839
+ category: string;
840
+ amount: number;
841
+ vatRate: number;
842
+ vatAmount: number;
843
+ }
844
+ /** Response line: amounts in integer centimes, rates in centièmes de pourcent */
845
+ export interface EReportingLineResponse {
846
+ category: string;
847
+ amount: number;
848
+ vatRate: number;
849
+ vatAmount: number;
850
+ }
851
+ export interface EReporting {
852
+ id: string;
853
+ object: 'ereporting';
854
+ status: EReportingStatus;
855
+ type: EReportingType;
856
+ period: string;
857
+ totalHT: number;
858
+ totalTVA: number;
859
+ totalTTC: number;
860
+ lines: EReportingLineResponse[];
861
+ submittedAt?: string;
862
+ paResponseId?: string;
863
+ livemode: boolean;
864
+ created: string;
865
+ updated: string;
866
+ }
867
+ export interface EReportingCreateParams {
868
+ type: EReportingType;
869
+ period: string;
870
+ lines: EReportingLine[];
871
+ }
872
+ export interface EReportingListParams extends PaginationParams {
873
+ status?: EReportingStatus;
874
+ }
875
+ export type JobType = 'pdf' | 'facturx' | 'fec' | 'export' | 'rgpd_export' | 'audit_trail_pdf';
876
+ export type JobStatus = 'pending' | 'processing' | 'completed' | 'failed';
877
+ export interface Job {
878
+ id: string;
879
+ object: 'job';
880
+ type: JobType;
881
+ status: JobStatus;
882
+ invoiceId: string | null;
883
+ progress: number;
884
+ result: string | null;
885
+ error: string | null;
886
+ /** Signed download URL for a completed PDF/Factur-X/export job. */
887
+ url?: string;
888
+ /** ISO 8601 expiry of the signed `url`. */
889
+ expiresAt?: string;
890
+ created: string;
891
+ }
892
+ export interface SandboxResetResponse {
893
+ object: 'sandbox_reset';
894
+ deleted_count: number;
895
+ fixtures_created: number;
896
+ }
897
+ export interface SimulateStatusParams {
898
+ status: InvoiceStatus;
899
+ }
900
+ export interface SimulateStatusResponse {
901
+ id: string;
902
+ object: 'invoice';
903
+ status: InvoiceStatus;
904
+ simulated: boolean;
905
+ }
906
+ export type ReceivedInvoiceStatus = 'available' | 'received' | 'approved' | 'refused' | 'suspended';
907
+ export interface ReceivedInvoice {
908
+ id: string;
909
+ object: 'received_invoice';
910
+ livemode: boolean;
911
+ paInvoiceId: string;
912
+ sourcePA: string;
913
+ sourceFormat: string;
914
+ status: ReceivedInvoiceStatus;
915
+ /** 14-digit SIRET (empty when the seller exposes only a SIREN). */
916
+ senderSiret: string;
917
+ /** 9-digit SIREN — the CIUS-FR French seller identifier (BT-30). */
918
+ senderSiren: string;
919
+ senderName: string;
920
+ number: string;
921
+ issuedAt: string;
922
+ dueAt: string;
923
+ totalHT: number;
924
+ totalTVA: number;
925
+ totalTTC: number;
926
+ xmlPath: string;
927
+ pdfPath: string | null;
928
+ approvedAt: string | null;
929
+ refusedAt: string | null;
930
+ refusalReason: string | null;
931
+ reconciled: boolean;
932
+ reconciledPaymentId: string | null;
933
+ lifecycle: LifecycleEntry[];
934
+ metadata: Record<string, unknown>;
935
+ created: string;
936
+ updated: string;
937
+ }
938
+ export interface ReceivedInvoiceListParams extends PaginationParams {
939
+ status?: ReceivedInvoiceStatus;
940
+ }
941
+ export interface ReceivedInvoiceRefuseParams {
942
+ reason: string;
943
+ }
944
+ export interface ReceivedInvoiceRecordPaymentParams {
945
+ amount: number;
946
+ method?: string;
947
+ reference?: string;
948
+ paidAt?: string;
949
+ }
950
+ export interface ReceivedInvoiceActionResponse {
951
+ id: string;
952
+ object: 'received_invoice';
953
+ status?: ReceivedInvoiceStatus;
954
+ reconciled?: boolean;
955
+ }
956
+ export interface VatReportParams {
957
+ period_start: string;
958
+ period_end: string;
959
+ }
960
+ export interface VatReportBreakdown {
961
+ rate: string;
962
+ /** Taxable base for this rate, in integer cents. */
963
+ taxableAmount: number;
964
+ /** VAT due for this rate, in integer cents. */
965
+ vatAmount: number;
966
+ }
967
+ export interface VatReport {
968
+ object: 'vat_report';
969
+ period: {
970
+ start: string;
971
+ end: string;
972
+ };
973
+ vatBreakdown: VatReportBreakdown[];
974
+ /** Totals for the period, in integer cents. */
975
+ totalHT: number;
976
+ totalVAT: number;
977
+ totalTTC: number;
978
+ invoiceCount: number;
979
+ }
980
+ export interface RevenueReportParams {
981
+ period_start: string;
982
+ period_end: string;
983
+ group_by?: 'month' | 'quarter';
984
+ }
985
+ export interface RevenueReportBreakdownItem {
986
+ period: string;
987
+ revenue: {
988
+ invoiced: number;
989
+ credit_notes: number;
990
+ net: number;
991
+ };
992
+ payments: {
993
+ received: number;
994
+ outstanding: number;
995
+ };
996
+ invoice_count: number;
997
+ credit_note_count: number;
998
+ }
999
+ export interface RevenueReport {
1000
+ object: 'revenue_report';
1001
+ period: {
1002
+ start: string;
1003
+ end: string;
1004
+ };
1005
+ revenue: {
1006
+ invoiced: number;
1007
+ credit_notes: number;
1008
+ net: number;
1009
+ };
1010
+ payments: {
1011
+ received: number;
1012
+ outstanding: number;
1013
+ };
1014
+ invoice_count: number;
1015
+ credit_note_count: number;
1016
+ breakdown?: RevenueReportBreakdownItem[];
1017
+ }
1018
+ /**
1019
+ * Subscription plan attached to the authenticated account. `free` is the
1020
+ * default; paid plans unlock e-invoicing, PA connections, FEC export, and
1021
+ * more — see the rate-limits and pricing pages for the full matrix.
1022
+ */
1023
+ export type AccountPlan = 'free' | 'essential' | 'pro' | 'cabinet_50' | 'cabinet_200' | 'cabinet_500';
1024
+ /**
1025
+ * Result of `GET /v1/account`. Returns the authenticated user, the active
1026
+ * company, the current plan and the scopes attached to the API key in
1027
+ * use. Equivalent to Stripe's "who am I" introspection endpoint — use
1028
+ * it on integration startup to display the connected company and the
1029
+ * environment (`fac_test_` vs `fac_live_`).
1030
+ */
1031
+ export interface Account {
1032
+ object: 'account';
1033
+ userId: string;
1034
+ companyId: string;
1035
+ plan: AccountPlan;
1036
+ /** `true` when the key is a `fac_live_…`, `false` for sandbox. */
1037
+ livemode: boolean;
1038
+ /** Echo of the prefix of the key used (`fac_test_` or `fac_live_`). */
1039
+ apiKeyPrefix: string;
1040
+ /** Scopes attached to the key. Empty array on unrestricted keys. */
1041
+ permissions: string[];
1042
+ /** Snapshot of the active company. `null` when the user has none yet. */
1043
+ company: {
1044
+ id: string;
1045
+ name?: string;
1046
+ siret?: string;
1047
+ vatRegime?: string;
1048
+ } | null;
1049
+ user: {
1050
+ emailVerified: boolean;
1051
+ };
1052
+ }
1053
+ export type BillingCycle = 'monthly' | 'annual';
1054
+ export interface BillingSubscription {
1055
+ object: 'subscription';
1056
+ id: string;
1057
+ plan: AccountPlan;
1058
+ cycle: BillingCycle;
1059
+ status: 'active' | 'past_due' | 'paused' | 'canceled' | 'incomplete' | 'trialing';
1060
+ currentPeriodStart: string;
1061
+ currentPeriodEnd: string;
1062
+ cancelAtPeriodEnd: boolean;
1063
+ }
1064
+ /** Subscription (platform) invoice issued by INTEK CENTER to the Facturino account. */
1065
+ export interface PlatformInvoice {
1066
+ object: 'platform_invoice';
1067
+ id: string;
1068
+ status: string;
1069
+ number: string;
1070
+ /** Monetary totals as Decimal strings (HT, VAT, TTC…). */
1071
+ totals: Record<string, string>;
1072
+ /** Document dates (issued, due, period…). */
1073
+ dates: Record<string, string>;
1074
+ items: Array<{
1075
+ description: string;
1076
+ lineTotal: number;
1077
+ }>;
1078
+ metadata: Record<string, unknown>;
1079
+ created: string;
1080
+ }
1081
+ /**
1082
+ * A single metered dimension: how much has been consumed in the current period
1083
+ * and the plan limit. `limit` is `null` when the dimension is unlimited on the
1084
+ * current plan.
1085
+ */
1086
+ export interface UsageMeter {
1087
+ used: number;
1088
+ limit: number | null;
1089
+ }
1090
+ /**
1091
+ * Current-period usage snapshot for the authenticated account, returned by
1092
+ * `GET /v1/usage`. Drive in-app quota gauges and upgrade prompts from it,
1093
+ * before a limit triggers a `402 quota_exceeded` response.
1094
+ */
1095
+ export interface UsageSummary {
1096
+ object: 'usage';
1097
+ plan: AccountPlan;
1098
+ /** ISO 8601 start of the current monthly metering period. */
1099
+ periodStart: string;
1100
+ /** Per-dimension counters. Monthly dimensions reset one month after `periodStart`. */
1101
+ counters: {
1102
+ apiRequestsMonth: UsageMeter;
1103
+ invoicesMonth: UsageMeter;
1104
+ quotesMonth: UsageMeter;
1105
+ customers: UsageMeter;
1106
+ products: UsageMeter;
1107
+ members: UsageMeter;
1108
+ webhookEndpoints: UsageMeter;
1109
+ companies: UsageMeter;
1110
+ };
1111
+ }
1112
+ /**
1113
+ * Payload accepted by `validate.run`: a full invoice draft, checked against
1114
+ * the same rules as `invoices.create` (EN16931 / CIUS-FR) without persisting
1115
+ * anything. Validate identifiers (SIRET, VAT) up front with `customers.lookup`.
1116
+ */
1117
+ export type ValidateParams = InvoiceCreateParams;
1118
+ /** Result of a dry-run invoice validation. */
1119
+ export interface ValidateResponse {
1120
+ /** `true` when no conformity warnings were raised. */
1121
+ valid: boolean;
1122
+ /** Human-readable conformity warnings (EN16931 / CIUS-FR), empty when valid. */
1123
+ warnings: string[];
1124
+ /** Version of the validation ruleset applied. */
1125
+ schemaVersion: string;
1126
+ }
1127
+ export interface LegalForm {
1128
+ code: string;
1129
+ sigle: string;
1130
+ label: string;
1131
+ }
1132
+ export interface NafCode {
1133
+ code: string;
1134
+ label: string;
1135
+ }
1136
+ /**
1137
+ * Legal-form input for company/customer create/update. Provide either the
1138
+ * 4-digit INSEE `code` or the `sigle` (e.g. "SAS"); the API resolves the
1139
+ * canonical object. Do not send `label` — the input is strictly validated.
1140
+ */
1141
+ export interface LegalFormInput {
1142
+ code?: string;
1143
+ sigle?: string;
1144
+ }
1145
+ /**
1146
+ * NAF (APE) input for company/customer create/update. Provide the Rev. 2
1147
+ * `code` (e.g. "62.01Z" or "6201Z"); the API resolves the canonical object.
1148
+ */
1149
+ export interface NafCodeInput {
1150
+ code: string;
1151
+ }
1152
+ /**
1153
+ * A supported Plateforme Agréée (PA), returned by `reference.listPaProviders()`.
1154
+ * Public catalogue — use it to render a provider picker and the credential
1155
+ * fields each PA requires. Facturino is BYOPA: the customer brings their own
1156
+ * PA credentials, so integrations typically surface this list at connect time.
1157
+ */
1158
+ export interface PaProvider {
1159
+ slug: string;
1160
+ name: string;
1161
+ description: string;
1162
+ logoUrl: string | null;
1163
+ websiteUrl: string | null;
1164
+ documentationUrl: string | null;
1165
+ signupUrl: string | null;
1166
+ authType: string;
1167
+ credentialLabel1: string | null;
1168
+ credentialLabel2: string | null;
1169
+ requiresBaseUrl: boolean;
1170
+ pricingSummary: string | null;
1171
+ }
1172
+ /** Service health snapshot returned by `health.check()`. */
1173
+ export interface HealthStatus {
1174
+ status: string;
1175
+ version: string;
1176
+ region: string;
1177
+ timestamp: string;
1178
+ }
1179
+ //# sourceMappingURL=types.d.ts.map