@beel_es/sdk 1.3.0 → 2.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 (41) hide show
  1. package/CHANGELOG.md +227 -0
  2. package/README.md +237 -29
  3. package/dist/index.d.mts +4875 -1235
  4. package/dist/index.d.ts +4875 -1235
  5. package/dist/index.js +1462 -184
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +1460 -184
  8. package/dist/index.mjs.map +1 -1
  9. package/docs/reference/README.md +233 -0
  10. package/docs/reference/account-companies.md +55 -0
  11. package/docs/reference/account-invitations.md +57 -0
  12. package/docs/reference/account-members.md +97 -0
  13. package/docs/reference/account-webhooks.md +123 -0
  14. package/docs/reference/account.md +94 -0
  15. package/docs/reference/accounts.md +72 -0
  16. package/docs/reference/catalogs.md +68 -0
  17. package/docs/reference/client.md +113 -0
  18. package/docs/reference/company-customers.md +85 -0
  19. package/docs/reference/company-invoices-schedule.md +52 -0
  20. package/docs/reference/company-invoices.md +316 -0
  21. package/docs/reference/company-payment-connections-events.md +103 -0
  22. package/docs/reference/company-payment-connections.md +87 -0
  23. package/docs/reference/company-products.md +72 -0
  24. package/docs/reference/company-recurring-invoices.md +136 -0
  25. package/docs/reference/company-series.md +94 -0
  26. package/docs/reference/company-tax-configuration.md +36 -0
  27. package/docs/reference/company-verifactu-configuration.md +41 -0
  28. package/docs/reference/company.md +94 -0
  29. package/docs/reference/configuration.md +90 -0
  30. package/docs/reference/customer-builder.md +107 -0
  31. package/docs/reference/customers.md +91 -0
  32. package/docs/reference/errors.md +72 -0
  33. package/docs/reference/invoice-builder.md +149 -0
  34. package/docs/reference/invoices.md +250 -0
  35. package/docs/reference/nif.md +31 -0
  36. package/docs/reference/products.md +111 -0
  37. package/docs/reference/series.md +81 -0
  38. package/docs/reference/types.md +222 -0
  39. package/docs/reference/webhook-verifier.md +95 -0
  40. package/llms.txt +52 -0
  41. package/package.json +11 -4
@@ -0,0 +1,316 @@
1
+ <!-- Generated by `npm run docs:reference` from the SDK source and openapi/public-api.yaml. Do not edit. -->
2
+
3
+ # `beel.company(companyId).invoices` — `CompanyInvoicesResource`
4
+
5
+ [Reference index](README.md)
6
+
7
+ Invoice lifecycle of one company: create a draft (or issue it directly), issue, void,
8
+ correct, list and read, PDF and email. Reach it as `beel.company(companyId).invoices`.
9
+
10
+ A create, issue, void or corrective carries an automatic `Idempotency-Key`, reused by the
11
+ client's automatic retries. To retry a create yourself safely, use `createOnce`.
12
+
13
+ ## Properties
14
+
15
+ | Property | Type | Description |
16
+ |---|---|---|
17
+ | `schedule` | [`CompanyInvoiceScheduleResource`](company-invoices-schedule.md) | Scheduled issuing of one invoice: read, set or clear it. |
18
+
19
+ ## Methods
20
+
21
+ | Method | HTTP | Summary |
22
+ |---|---|---|
23
+ | [`beel.company(companyId).invoices.derive(body, options?)`](#company-invoices-derive) | `POST /v1/companies/{company_id}/invoices/derivations` | Derive a new draft invoice from an existing one — the canonical form of `duplicate`. |
24
+ | [`beel.company(companyId).invoices.list(params?, options?)`](#company-invoices-list) | `GET /v1/companies/{company_id}/invoices` | List the company's invoices, paginated, with filters: status, type, customer, dates, `external_ref` (exact match), VeriFactu status and more. |
25
+ | [`beel.company(companyId).invoices.create(body, params?, options?)`](#company-invoices-create) | `POST /v1/companies/{company_id}/invoices` | Create an invoice: a `DRAFT` by default, or numbered and issued in the same call with `options.issue_directly: true`. |
26
+ | [`beel.company(companyId).invoices.createOnce(body, params?, options?)`](#company-invoices-create-once) | via `list`, `create` | Create a standard or simplified invoice once per `external_ref`, safe to call again after any failure. |
27
+ | [`beel.company(companyId).invoices.get(invoiceId, options?)`](#company-invoices-get) | `GET /v1/companies/{company_id}/invoices/{invoice_id}` | Get one invoice, including its `status` and its `verifactu` block (`submission_status`, `qr_url`, `error_code`…). |
28
+ | [`beel.company(companyId).invoices.update(invoiceId, body, options?)`](#company-invoices-update) | `PATCH /v1/companies/{company_id}/invoices/{invoice_id}` | Update a `DRAFT` or `SCHEDULED` invoice (or an `ACTIVE` proforma). |
29
+ | [`beel.company(companyId).invoices.delete(invoiceId, options?)`](#company-invoices-delete) | `DELETE /v1/companies/{company_id}/invoices/{invoice_id}` | Delete a draft invoice. |
30
+ | [`beel.company(companyId).invoices.issue(invoiceId, params?, options?)`](#company-invoices-issue) | `POST /v1/companies/{company_id}/invoices/{invoice_id}/issue` | Issue a draft: assigns its definitive number and makes it immutable. |
31
+ | [`beel.company(companyId).invoices.void(invoiceId, body, options?)`](#company-invoices-void) | `POST /v1/companies/{company_id}/invoices/{invoice_id}/void` | Void an invoice issued by mistake. |
32
+ | [`beel.company(companyId).invoices.createCorrective(invoiceId, body, options?)`](#company-invoices-create-corrective) | `POST /v1/companies/{company_id}/invoices/{invoice_id}/corrective` | Create a corrective invoice (rectificativa) for an issued invoice. |
33
+ | [`beel.company(companyId).invoices.convertToInvoice(invoiceId, body?, options?)`](#company-invoices-convert-to-invoice) | `POST /v1/companies/{company_id}/invoices/{invoice_id}/convert-to-invoice` | Convert a proforma into an invoice. |
34
+ | [`beel.company(companyId).invoices.createSimplifiedExchange(body, options?)`](#company-invoices-create-simplified-exchange) | `POST /v1/companies/{company_id}/invoices/simplified-exchanges` | Issue a full invoice in exchange for one or more issued simplified invoices, when the customer asks for an invoice with their details. |
35
+ | [`beel.company(companyId).invoices.verifactuRecords(invoiceId, options?)`](#company-invoices-verifactu-records) | `GET /v1/companies/{company_id}/invoices/{invoice_id}/verifactu-records` | The VeriFactu records of an invoice, oldest first: its registration and, if it was voided, its cancellation. |
36
+ | [`beel.company(companyId).invoices.setStatus(invoiceId, body, options?)`](#company-invoices-set-status) | `PUT /v1/companies/{company_id}/invoices/{invoice_id}/status` | Set the commercial status: `PAID` (from `ISSUED`, `SENT`, `OVERDUE`), `SENT` (from `ISSUED`) or back to `ISSUED` (from `SENT`). |
37
+ | [`beel.company(companyId).invoices.getPdf(invoiceId, options?)`](#company-invoices-get-pdf) | `GET /v1/companies/{company_id}/invoices/{invoice_id}/pdf` | Get a short-lived download URL for the invoice PDF. |
38
+ | [`beel.company(companyId).invoices.send(invoiceId, body, options?)`](#company-invoices-send) | `POST /v1/companies/{company_id}/invoices/{invoice_id}/send` | Send the invoice by email with its PDF. |
39
+
40
+ <a id="company-invoices-derive"></a>
41
+ ### `derive(body, options?)`
42
+
43
+ Derive a new draft invoice from an existing one — the canonical form of `duplicate`.
44
+ The source invoice is not modified.
45
+
46
+ - **HTTP:** `POST /v1/companies/{company_id}/invoices/derivations` · operation `createCompanyInvoiceDerivation` · scopes `invoices:write` · accepts `Idempotency-Key`
47
+ - **Parameters:**
48
+ - `body: components['schemas']['CreateInvoiceDerivationRequest']` — `from_invoice_id`, and optionally the `series_id` of the copy.
49
+ - `options?: RequestOptions` — Per-call `idempotencyKey`, `signal` and `timeoutMs`. See [`RequestOptions`](types.md#requestoptions).
50
+ - **Returns:** The new draft invoice. Response `201` `data`: `Invoice`.
51
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
52
+
53
+ <a id="company-invoices-list"></a>
54
+ ### `list(params?, options?)`
55
+
56
+ List the company's invoices, paginated, with filters: status, type, customer, dates,
57
+ `external_ref` (exact match), VeriFactu status and more.
58
+
59
+ - **HTTP:** `GET /v1/companies/{company_id}/invoices` · operation `listCompanyInvoices` · scopes `invoices:read`
60
+ - **Parameters:**
61
+ - `params?: operations['listCompanyInvoices']['parameters']['query']` — Filters and pagination (`page`, `limit`).
62
+ - `options?: RequestOptions` — Per-call `idempotencyKey`, `signal` and `timeoutMs`. See [`RequestOptions`](types.md#requestoptions).
63
+ - **Returns:** The page of `invoices` and its `pagination`. Response `200` `data`: `{ invoices: Invoice[]; pagination: Pagination }`.
64
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
65
+
66
+ **Example**
67
+
68
+ ```typescript
69
+ const { invoices } = await company.invoices.list({ external_ref: 'ORD-2026-0042' });
70
+ ```
71
+
72
+ <a id="company-invoices-create"></a>
73
+ ### `create(body, params?, options?)`
74
+
75
+ Create an invoice: a `DRAFT` by default, or numbered and issued in the same call with
76
+ `options.issue_directly: true`. `CORRECTIVE` is not accepted here: use
77
+ `createCorrective`.
78
+
79
+ One call sends one `Idempotency-Key`, reused by the client's automatic retries, so
80
+ those never duplicate the invoice. A second call is a new operation: to repeat a create
81
+ whose outcome you do not know, use `createOnce`.
82
+
83
+ - **HTTP:** `POST /v1/companies/{company_id}/invoices` · operation `createCompanyInvoice` · scopes `invoices:write` · accepts `Idempotency-Key`
84
+ - **Parameters:**
85
+ - `body: components['schemas']['CreateInvoiceRequest']` — Type, recipient and lines; `external_ref` to tie it to your order.
86
+ - `params?: operations['createCompanyInvoice']['parameters']['query']` — `wait_for_pdf`, when issuing directly.
87
+ - `options?: RequestOptions` — Per-call `idempotencyKey`, `signal` and `timeoutMs`. See [`RequestOptions`](types.md#requestoptions).
88
+ - **Returns:** The created invoice. With VeriFactu, `verifactu.submission_status` starts `PENDING`. Response `201` `data`: `Invoice`.
89
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `409` `BeeLConflictError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
90
+
91
+ **Example**
92
+
93
+ ```typescript
94
+ const invoice = await company.invoices.create({
95
+ type: 'STANDARD',
96
+ recipient: { customer_id: 'customer-uuid' },
97
+ lines: [{
98
+ description: 'Consulting', quantity: 1, unit_price: 100,
99
+ main_tax: { type: 'IVA', percentage: 21, regime_key: '01' },
100
+ }],
101
+ external_ref: 'ORD-2026-0042',
102
+ });
103
+ ```
104
+
105
+ <a id="company-invoices-create-once"></a>
106
+ ### `createOnce(body, params?, options?)`
107
+
108
+ Create a standard or simplified invoice once per `external_ref`, safe to call again
109
+ after any failure. It looks the reference up first and returns the invoice that already
110
+ holds it; otherwise it creates one. If the create answers
111
+ `409 INVOICE_DUPLICATE_EXTERNAL_REFERENCE`, or its outcome is unknown (network error,
112
+ `5xx`), it looks the reference up again and returns the invoice it finds.
113
+
114
+ The returned invoice may be one created earlier, in any status (`VOIDED` included):
115
+ compare its fields if that matters to you.
116
+
117
+ - **HTTP:** through [`list`](#company-invoices-list), [`create`](#company-invoices-create)
118
+ - **Parameters:**
119
+ - `body: CreateInvoiceOnceRequest` — A `CreateInvoiceRequest` with `type` `STANDARD` or `SIMPLIFIED` and a non-empty `external_ref`. See [`CreateInvoiceOnceRequest`](types.md#createinvoiceoncerequest).
120
+ - `params?: CreateInvoiceOnceParams` — `wait_for_pdf`, when issuing directly. See [`CreateInvoiceOnceParams`](types.md#createinvoiceonceparams).
121
+ - `options?: RequestOptions` — `idempotencyKey` for the create; `signal` and `timeoutMs` for the whole sequence of calls. See [`RequestOptions`](types.md#requestoptions).
122
+ - **Returns:** The one invoice that holds `body.external_ref`.
123
+ - **Throws:** `TypeError` Before any request, when `external_ref` is empty or `type` is not `STANDARD`/`SIMPLIFIED`.<br>`BeeLApiError` The create's error when no invoice holds the reference afterwards — nothing was created, so calling again is safe.
124
+
125
+ **Example**
126
+
127
+ ```typescript
128
+ const invoice = await company.invoices.createOnce({
129
+ type: 'STANDARD',
130
+ external_ref: order.id,
131
+ recipient: { customer_id: order.customerId },
132
+ lines: [{ description: 'Order', quantity: 1, unit_price: 100,
133
+ main_tax: { type: 'IVA', percentage: 21, regime_key: '01' } }],
134
+ options: { issue_directly: true },
135
+ });
136
+ ```
137
+
138
+ <a id="company-invoices-get"></a>
139
+ ### `get(invoiceId, options?)`
140
+
141
+ Get one invoice, including its `status` and its `verifactu` block
142
+ (`submission_status`, `qr_url`, `error_code`…).
143
+
144
+ - **HTTP:** `GET /v1/companies/{company_id}/invoices/{invoice_id}` · operation `getCompanyInvoice` · scopes `invoices:read`
145
+ - **Parameters:**
146
+ - `invoiceId: string` — Invoice UUID.
147
+ - `options?: RequestOptions` — Per-call `idempotencyKey`, `signal` and `timeoutMs`. See [`RequestOptions`](types.md#requestoptions).
148
+ - **Returns:** The invoice. Response `200` `data`: `Invoice`.
149
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `429` `BeeLRateLimitError`
150
+
151
+ <a id="company-invoices-update"></a>
152
+ ### `update(invoiceId, body, options?)`
153
+
154
+ Update a `DRAFT` or `SCHEDULED` invoice (or an `ACTIVE` proforma). Only the fields
155
+ present in `body` change; an issued invoice is amended with a corrective instead.
156
+
157
+ - **HTTP:** `PATCH /v1/companies/{company_id}/invoices/{invoice_id}` · operation `patchCompanyInvoice` · scopes `invoices:write` · accepts `Idempotency-Key`
158
+ - **Parameters:**
159
+ - `invoiceId: string` — Invoice UUID.
160
+ - `body: operations['patchCompanyInvoice']['requestBody']['content']['application/json']` — Fields to change.
161
+ - `options?: RequestOptions` — Per-call `idempotencyKey`, `signal` and `timeoutMs`. See [`RequestOptions`](types.md#requestoptions).
162
+ - **Returns:** The updated invoice. Response `200` `data`: `Invoice`.
163
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `409` `BeeLConflictError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
164
+
165
+ <a id="company-invoices-delete"></a>
166
+ ### `delete(invoiceId, options?)`
167
+
168
+ Delete a draft invoice. Deleting frees its `external_ref` for a new invoice.
169
+
170
+ - **HTTP:** `DELETE /v1/companies/{company_id}/invoices/{invoice_id}` · operation `deleteCompanyInvoice` · scopes `invoices:write`
171
+ - **Parameters:**
172
+ - `invoiceId: string` — Invoice UUID.
173
+ - `options?: RequestOptions` — Per-call `idempotencyKey`, `signal` and `timeoutMs`. See [`RequestOptions`](types.md#requestoptions).
174
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `429` `BeeLRateLimitError`
175
+
176
+ <a id="company-invoices-issue"></a>
177
+ ### `issue(invoiceId, params?, options?)`
178
+
179
+ Issue a draft: assigns its definitive number and makes it immutable. PDF generation and
180
+ the VeriFactu submission happen after the response.
181
+
182
+ - **HTTP:** `POST /v1/companies/{company_id}/invoices/{invoice_id}/issue` · operation `issueCompanyInvoice` · scopes `invoices:write` · accepts `Idempotency-Key`
183
+ - **Parameters:**
184
+ - `invoiceId: string` — UUID of the draft.
185
+ - `params?: operations['issueCompanyInvoice']['parameters']['query']` — `wait_for_pdf: true` to wait for the PDF before answering.
186
+ - `options?: RequestOptions` — Per-call `idempotencyKey`, `signal` and `timeoutMs`. See [`RequestOptions`](types.md#requestoptions).
187
+ - **Returns:** The issued invoice. Response `200` `data`: `Invoice`.
188
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `409` `BeeLConflictError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
189
+
190
+ <a id="company-invoices-void"></a>
191
+ ### `void(invoiceId, body, options?)`
192
+
193
+ Void an invoice issued by mistake. The document is kept and its number never reused. If
194
+ the operation did happen but the invoice is wrong, use `createCorrective`.
195
+
196
+ - **HTTP:** `POST /v1/companies/{company_id}/invoices/{invoice_id}/void` · operation `voidCompanyInvoice` · scopes `invoices:write` · accepts `Idempotency-Key`
197
+ - **Parameters:**
198
+ - `invoiceId: string` — Invoice UUID.
199
+ - `body: NonNullable<operations['voidCompanyInvoice']['requestBody']>['content']['application/json']` — `reason`; `issued_in_error: true` is required once it was sent or paid.
200
+ - `options?: RequestOptions` — Per-call `idempotencyKey`, `signal` and `timeoutMs`. See [`RequestOptions`](types.md#requestoptions).
201
+ - **Returns:** The voided invoice. Response `200` `data`: `Invoice`.
202
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `409` `BeeLConflictError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
203
+
204
+ <a id="company-invoices-create-corrective"></a>
205
+ ### `createCorrective(invoiceId, body, options?)`
206
+
207
+ Create a corrective invoice (rectificativa) for an issued invoice.
208
+
209
+ - **HTTP:** `POST /v1/companies/{company_id}/invoices/{invoice_id}/corrective` · operation `createCompanyCorrectiveInvoice` · scopes `invoices:write` · accepts `Idempotency-Key`
210
+ - **Parameters:**
211
+ - `invoiceId: string` — UUID of the issued invoice to correct.
212
+ - `body: operations['createCompanyCorrectiveInvoice']['requestBody']['content']['application/json']` — `rectification_type` (`TOTAL`/`PARTIAL`), `rectification_code` (`R1`–`R5`), `reason` and, for `PARTIAL`, the correcting `lines`.
213
+ - `options?: RequestOptions` — Per-call `idempotencyKey`, `signal` and `timeoutMs`. See [`RequestOptions`](types.md#requestoptions).
214
+ - **Returns:** The corrective invoice. Response `201` `data`: `Invoice`.
215
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `409` `BeeLConflictError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
216
+
217
+ **Example**
218
+
219
+ ```typescript
220
+ const corrective = await company.invoices.createCorrective('invoice-uuid', {
221
+ rectification_type: 'PARTIAL',
222
+ rectification_code: 'R1',
223
+ reason: 'Discount agreed with the customer after the sale',
224
+ lines: [{ description: 'Discount', quantity: -1, unit_price: 10,
225
+ main_tax: { type: 'IVA', percentage: 21, regime_key: '01' } }],
226
+ });
227
+ ```
228
+
229
+ <a id="company-invoices-convert-to-invoice"></a>
230
+ ### `convertToInvoice(invoiceId, body?, options?)`
231
+
232
+ Convert a proforma into an invoice.
233
+
234
+ - **HTTP:** `POST /v1/companies/{company_id}/invoices/{invoice_id}/convert-to-invoice` · operation `convertCompanyProformaToInvoice` · scopes `invoices:write` · accepts `Idempotency-Key`
235
+ - **Parameters:**
236
+ - `invoiceId: string` — UUID of the proforma.
237
+ - `body?: NonNullable<operations['convertCompanyProformaToInvoice']['requestBody']>['content']['application/json']` — Optional overrides for the new invoice.
238
+ - `options?: RequestOptions` — Per-call `idempotencyKey`, `signal` and `timeoutMs`. See [`RequestOptions`](types.md#requestoptions).
239
+ - **Returns:** The new invoice. Response `201` `data`: `Invoice`.
240
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `409` `BeeLConflictError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
241
+
242
+ <a id="company-invoices-create-simplified-exchange"></a>
243
+ ### `createSimplifiedExchange(body, options?)`
244
+
245
+ Issue a full invoice in exchange for one or more issued simplified invoices, when the
246
+ customer asks for an invoice with their details. It is not a corrective: the simplified
247
+ invoices become `VOIDED` with `void_cause: 'EXCHANGED'`, and the new `STANDARD` invoice
248
+ lists them in `replaced_invoice_ids`.
249
+
250
+ - **HTTP:** `POST /v1/companies/{company_id}/invoices/simplified-exchanges` · operation `createCompanySimplifiedExchange` · scopes `invoices:write` · accepts `Idempotency-Key`
251
+ - **Parameters:**
252
+ - `body: components['schemas']['CreateSimplifiedExchangeRequest']` — `simplified_invoice_ids` and the identified `recipient`.
253
+ - `options?: RequestOptions` — Per-call `idempotencyKey`, `signal` and `timeoutMs`. See [`RequestOptions`](types.md#requestoptions).
254
+ - **Returns:** The new standard invoice. Response `201` `data`: `Invoice`.
255
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
256
+
257
+ **Example**
258
+
259
+ ```typescript
260
+ const invoice = await company.invoices.createSimplifiedExchange({
261
+ simplified_invoice_ids: ['simplified-uuid'],
262
+ recipient: { customer_id: 'customer-uuid' },
263
+ });
264
+ ```
265
+
266
+ <a id="company-invoices-verifactu-records"></a>
267
+ ### `verifactuRecords(invoiceId, options?)`
268
+
269
+ The VeriFactu records of an invoice, oldest first: its registration and, if it was
270
+ voided, its cancellation. An invoice never submitted answers with an empty list.
271
+
272
+ - **HTTP:** `GET /v1/companies/{company_id}/invoices/{invoice_id}/verifactu-records` · operation `listCompanyInvoiceVerifactuRecords` · scopes `invoices:read`
273
+ - **Parameters:**
274
+ - `invoiceId: string` — Invoice UUID.
275
+ - `options?: RequestOptions` — Per-call `idempotencyKey`, `signal` and `timeoutMs`. See [`RequestOptions`](types.md#requestoptions).
276
+ - **Returns:** The records (`data.records` of the response), each with its own `submission_status`. Response `200` `data`: `{ records: VeriFactuRecord[] }`.
277
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `429` `BeeLRateLimitError`
278
+
279
+ <a id="company-invoices-set-status"></a>
280
+ ### `setStatus(invoiceId, body, options?)`
281
+
282
+ Set the commercial status: `PAID` (from `ISSUED`, `SENT`, `OVERDUE`), `SENT` (from
283
+ `ISSUED`) or back to `ISSUED` (from `SENT`). Issuing and voiding have their own methods.
284
+
285
+ - **HTTP:** `PUT /v1/companies/{company_id}/invoices/{invoice_id}/status` · operation `setCompanyInvoiceStatus` · scopes `invoices:write` · accepts `Idempotency-Key`
286
+ - **Parameters:**
287
+ - `invoiceId: string` — Invoice UUID.
288
+ - `body: operations['setCompanyInvoiceStatus']['requestBody']['content']['application/json']` — Target `status` and, for `PAID`, the payment details.
289
+ - `options?: RequestOptions` — Per-call `idempotencyKey`, `signal` and `timeoutMs`. See [`RequestOptions`](types.md#requestoptions).
290
+ - **Returns:** The updated invoice. Response `200` `data`: `Invoice`.
291
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
292
+
293
+ <a id="company-invoices-get-pdf"></a>
294
+ ### `getPdf(invoiceId, options?)`
295
+
296
+ Get a short-lived download URL for the invoice PDF.
297
+
298
+ - **HTTP:** `GET /v1/companies/{company_id}/invoices/{invoice_id}/pdf` · operation `getCompanyInvoicePdf` · scopes `invoices:read`
299
+ - **Parameters:**
300
+ - `invoiceId: string` — Invoice UUID.
301
+ - `options?: RequestOptions` — Per-call `idempotencyKey`, `signal` and `timeoutMs`. See [`RequestOptions`](types.md#requestoptions).
302
+ - **Returns:** `download_url`, `expires_in_seconds` and `file_name`. Response `200` `data`: `{ download_url: string; expires_in_seconds: number; file_name: string }`.
303
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `429` `BeeLRateLimitError`
304
+
305
+ <a id="company-invoices-send"></a>
306
+ ### `send(invoiceId, body, options?)`
307
+
308
+ Send the invoice by email with its PDF. Without recipients, the customer's addresses are used.
309
+
310
+ - **HTTP:** `POST /v1/companies/{company_id}/invoices/{invoice_id}/send` · operation `sendCompanyInvoice` · scopes `invoices:write` · accepts `Idempotency-Key`
311
+ - **Parameters:**
312
+ - `invoiceId: string` — Invoice UUID.
313
+ - `body: NonNullable<operations['sendCompanyInvoice']['requestBody']>['content']['application/json']` — Optional recipients, subject and message.
314
+ - `options?: RequestOptions` — Per-call `idempotencyKey`, `signal` and `timeoutMs`. See [`RequestOptions`](types.md#requestoptions).
315
+ - **Returns:** The delivery record. Response `200` `data`: `{ email_id?: UUID; sent_to?: Email[]; sent_at?: string }`.
316
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
@@ -0,0 +1,103 @@
1
+ <!-- Generated by `npm run docs:reference` from the SDK source and openapi/public-api.yaml. Do not edit. -->
2
+
3
+ # `beel.company(companyId).paymentConnections.events(connectionId)` — `CompanyPaymentEventsResource`
4
+
5
+ [Reference index](README.md)
6
+
7
+ Payment events received through a connection, and the recovery levers for the ones
8
+ that did not produce an invoice. Reach it as
9
+ `beel.company(companyId).paymentConnections.events(connectionId)`.
10
+
11
+ ## Methods
12
+
13
+ | Method | HTTP | Summary |
14
+ |---|---|---|
15
+ | [`beel.company(companyId).paymentConnections.events(connectionId).list(params?)`](#company-payment-connections-events-list) | `GET /v1/companies/{company_id}/payment-connections/{connection_id}/events` | Events of the connection, most recent first. |
16
+ | [`beel.company(companyId).paymentConnections.events(connectionId).get(eventId)`](#company-payment-connections-events-get) | `GET /v1/companies/{company_id}/payment-connections/{connection_id}/events/{event_id}` | Get one event. |
17
+ | [`beel.company(companyId).paymentConnections.events(connectionId).retry(eventId)`](#company-payment-connections-events-retry) | `POST /v1/companies/{company_id}/payment-connections/{connection_id}/events/{event_id}/retry` | Reprocess an event whose automatic invoicing didn't complete, applying the NIF's **current** configuration. |
18
+ | [`beel.company(companyId).paymentConnections.events(connectionId).draft(eventId)`](#company-payment-connections-events-draft) | `POST /v1/companies/{company_id}/payment-connections/{connection_id}/events/{event_id}/draft` | Build a **draft** invoice from an event that couldn't be invoiced automatically, so you can review it before issuing. |
19
+ | [`beel.company(companyId).paymentConnections.events(connectionId).resolve(eventId)`](#company-payment-connections-events-resolve) | `POST /v1/companies/{company_id}/payment-connections/{connection_id}/events/{event_id}/resolve` | Mark an event as dealt with outside the automatic flow. |
20
+ | [`beel.company(companyId).paymentConnections.events(connectionId).discard(eventId)`](#company-payment-connections-events-discard) | `POST /v1/companies/{company_id}/payment-connections/{connection_id}/events/{event_id}/discard` | Discard an event so it stops asking for attention. |
21
+ | [`beel.company(companyId).paymentConnections.events(connectionId).restore(eventId)`](#company-payment-connections-events-restore) | `POST /v1/companies/{company_id}/payment-connections/{connection_id}/events/{event_id}/restore` | Bring a discarded event back into the list. |
22
+
23
+ <a id="company-payment-connections-events-list"></a>
24
+ ### `list(params?)`
25
+
26
+ Events of the connection, most recent first. Nothing is hidden by default:
27
+ skipped events, duplicates and disputes are all returned — narrow with the
28
+ filters. `charges_only` returns one row per money movement instead.
29
+
30
+ - **HTTP:** `GET /v1/companies/{company_id}/payment-connections/{connection_id}/events` · operation `listCompanyPaymentEvents` · scopes `payment-connections:read`
31
+ - **Parameters:**
32
+ - `params?: operations['listCompanyPaymentEvents']['parameters']['query']` — Filters (`needs_action`, `charges_only`…) and pagination.
33
+ - **Returns:** The `events`, their `pagination` and `counts`. Response `200` `data`: `{ events: ManagedPaymentEvent[]; pagination?: Pagination; counts?: PaymentEventCounts }`.
34
+ - **Throws:** `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError` · `500` `BeeLApiError`
35
+
36
+ <a id="company-payment-connections-events-get"></a>
37
+ ### `get(eventId)`
38
+
39
+ Get one event.
40
+
41
+ - **HTTP:** `GET /v1/companies/{company_id}/payment-connections/{connection_id}/events/{event_id}` · operation `getCompanyPaymentEvent` · scopes `payment-connections:read`
42
+ - **Parameters:**
43
+ - `eventId: string` — Event UUID.
44
+ - **Returns:** The event. Response `200` `data`: `ManagedPaymentEvent`.
45
+ - **Throws:** `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError` · `500` `BeeLApiError`
46
+
47
+ <a id="company-payment-connections-events-retry"></a>
48
+ ### `retry(eventId)`
49
+
50
+ Reprocess an event whose automatic invoicing didn't complete, applying the NIF's
51
+ **current** configuration. Only retryable states qualify and the retry budget is
52
+ finite: otherwise `400`.
53
+
54
+ - **HTTP:** `POST /v1/companies/{company_id}/payment-connections/{connection_id}/events/{event_id}/retry` · operation `retryCompanyPaymentEvent` · scopes `payment-connections:write` · accepts `Idempotency-Key`
55
+ - **Parameters:**
56
+ - `eventId: string` — Event UUID.
57
+ - **Returns:** The event after the retry. Response `200` `data`: `ManagedPaymentEvent`.
58
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
59
+
60
+ <a id="company-payment-connections-events-draft"></a>
61
+ ### `draft(eventId)`
62
+
63
+ Build a **draft** invoice from an event that couldn't be invoiced automatically,
64
+ so you can review it before issuing.
65
+
66
+ - **HTTP:** `POST /v1/companies/{company_id}/payment-connections/{connection_id}/events/{event_id}/draft` · operation `generateCompanyPaymentEventDraft` · scopes `payment-connections:write` · accepts `Idempotency-Key`
67
+ - **Parameters:**
68
+ - `eventId: string` — Event UUID.
69
+ - **Returns:** The draft's `invoice_id`. Response `201` `data`: `{ invoice_id: string }`.
70
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
71
+
72
+ <a id="company-payment-connections-events-resolve"></a>
73
+ ### `resolve(eventId)`
74
+
75
+ Mark an event as dealt with outside the automatic flow.
76
+
77
+ - **HTTP:** `POST /v1/companies/{company_id}/payment-connections/{connection_id}/events/{event_id}/resolve` · operation `resolveCompanyPaymentEvent` · scopes `payment-connections:write` · accepts `Idempotency-Key`
78
+ - **Parameters:**
79
+ - `eventId: string` — Event UUID.
80
+ - **Returns:** The resolved event. Response `200` `data`: `ManagedPaymentEvent`.
81
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
82
+
83
+ <a id="company-payment-connections-events-discard"></a>
84
+ ### `discard(eventId)`
85
+
86
+ Discard an event so it stops asking for attention. Reversible with `restore`.
87
+
88
+ - **HTTP:** `POST /v1/companies/{company_id}/payment-connections/{connection_id}/events/{event_id}/discard` · operation `discardCompanyPaymentEvent` · scopes `payment-connections:write` · accepts `Idempotency-Key`
89
+ - **Parameters:**
90
+ - `eventId: string` — Event UUID.
91
+ - **Returns:** The discarded event. Response `200` `data`: `ManagedPaymentEvent`.
92
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
93
+
94
+ <a id="company-payment-connections-events-restore"></a>
95
+ ### `restore(eventId)`
96
+
97
+ Bring a discarded event back into the list.
98
+
99
+ - **HTTP:** `POST /v1/companies/{company_id}/payment-connections/{connection_id}/events/{event_id}/restore` · operation `restoreCompanyPaymentEvent` · scopes `payment-connections:write` · accepts `Idempotency-Key`
100
+ - **Parameters:**
101
+ - `eventId: string` — Event UUID.
102
+ - **Returns:** The restored event. Response `200` `data`: `ManagedPaymentEvent`.
103
+ - **Throws:** `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError` · `500` `BeeLApiError`
@@ -0,0 +1,87 @@
1
+ <!-- Generated by `npm run docs:reference` from the SDK source and openapi/public-api.yaml. Do not edit. -->
2
+
3
+ # `beel.company(companyId).paymentConnections` — `CompanyPaymentConnectionsResource`
4
+
5
+ [Reference index](README.md)
6
+
7
+ Payment connections of a company (NIF): the Stripe Connect link whose charges
8
+ auto-generate invoices under that NIF.
9
+
10
+ A connection is addressed by **its own UUID**, not by the provider slug — a NIF can
11
+ hold several connections of the same provider, so the slug does not name one. Take
12
+ `id` from `list`. The slug only appears when you *start* an authorization.
13
+
14
+ **Example**
15
+
16
+ ```typescript
17
+ const company = beel.company('company-uuid');
18
+ const { connections } = await company.paymentConnections.list();
19
+ const events = await company.paymentConnections.events(connections[0].id).list({
20
+ needs_action: true,
21
+ });
22
+ ```
23
+
24
+ ## Methods
25
+
26
+ | Method | HTTP | Summary |
27
+ |---|---|---|
28
+ | [`beel.company(companyId).paymentConnections.list()`](#company-payment-connections-list) | `GET /v1/companies/{company_id}/payment-connections` | Every payment connection of this company. |
29
+ | [`beel.company(companyId).paymentConnections.authorize(body)`](#company-payment-connections-authorize) | `POST /v1/companies/{company_id}/payment-connections/authorizations` | Start an authorization and get the URL where the NIF's holder approves it. |
30
+ | [`beel.company(companyId).paymentConnections.update(connectionId, body)`](#company-payment-connections-update) | `PATCH /v1/companies/{company_id}/payment-connections/{connection_id}` | Update the settings of one connection, addressed by its UUID. |
31
+ | [`beel.company(companyId).paymentConnections.disconnect(connectionId)`](#company-payment-connections-disconnect) | `DELETE /v1/companies/{company_id}/payment-connections/{connection_id}` | Disconnect one connection. |
32
+ | [`beel.company(companyId).paymentConnections.events(connectionId)`](#company-payment-connections-events) | — | The payment events of one connection — where you audit what did and didn't invoice. |
33
+
34
+ <a id="company-payment-connections-list"></a>
35
+ ### `list()`
36
+
37
+ Every payment connection of this company.
38
+
39
+ - **HTTP:** `GET /v1/companies/{company_id}/payment-connections` · operation `listCompanyPaymentConnections` · scopes `payment-connections:read`
40
+ - **Returns:** The `connections`. Response `200` `data`: `{ connections: ManagedPaymentConnection[] }`.
41
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `429` `BeeLRateLimitError`
42
+
43
+ <a id="company-payment-connections-authorize"></a>
44
+ ### `authorize(body)`
45
+
46
+ Start an authorization and get the URL where the NIF's holder approves it.
47
+
48
+ This is the one place the provider slug is used — currently only `stripe`.
49
+
50
+ - **HTTP:** `POST /v1/companies/{company_id}/payment-connections/authorizations` · operation `initiatePaymentConnection` · scopes `payment-connections:write` · accepts `Idempotency-Key`
51
+ - **Parameters:**
52
+ - `body: components['schemas']['InitiatePaymentConnectionRequest']` — `{ provider: 'stripe' }`, plus the return URL when needed.
53
+ - **Returns:** The `authorization_url` to send the NIF's holder to. Response `200` `data`: `{ authorization_url: string }`.
54
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
55
+
56
+ <a id="company-payment-connections-update"></a>
57
+ ### `update(connectionId, body)`
58
+
59
+ Update the settings of one connection, addressed by its UUID.
60
+
61
+ - **HTTP:** `PATCH /v1/companies/{company_id}/payment-connections/{connection_id}` · operation `updateCompanyPaymentConnection` · scopes `payment-connections:write` · accepts `Idempotency-Key`
62
+ - **Parameters:**
63
+ - `connectionId: string` — Connection UUID, from `list`.
64
+ - `body: components['schemas']['UpdateCompanyPaymentConnectionRequest']` — Settings to change.
65
+ - **Returns:** The updated connection. Response `200` `data`: `CompanyPaymentConnection`.
66
+ - **Throws:** `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError` · `500` `BeeLApiError`
67
+
68
+ <a id="company-payment-connections-disconnect"></a>
69
+ ### `disconnect(connectionId)`
70
+
71
+ Disconnect one connection. Tokens are revoked and auto-invoicing stops;
72
+ already-issued invoices are untouched.
73
+
74
+ - **HTTP:** `DELETE /v1/companies/{company_id}/payment-connections/{connection_id}` · operation `disconnectCompanyPaymentConnection` · scopes `payment-connections:write`
75
+ - **Parameters:**
76
+ - `connectionId: string` — Connection UUID.
77
+ - **Returns:** `Promise<void>`
78
+ - **Throws:** `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `429` `BeeLRateLimitError` · `500` `BeeLApiError`
79
+
80
+ <a id="company-payment-connections-events"></a>
81
+ ### `events(connectionId)`
82
+
83
+ The payment events of one connection — where you audit what did and didn't invoice.
84
+
85
+ - **Parameters:**
86
+ - `connectionId: string` — Connection UUID.
87
+ - **Returns:** The events resource of that connection. No request is made.
@@ -0,0 +1,72 @@
1
+ <!-- Generated by `npm run docs:reference` from the SDK source and openapi/public-api.yaml. Do not edit. -->
2
+
3
+ # `beel.company(companyId).products` — `CompanyProductsResource`
4
+
5
+ [Reference index](README.md)
6
+
7
+ Products and services of one company. Reach it as `beel.company(companyId).products`.
8
+
9
+ ## Methods
10
+
11
+ | Method | HTTP | Summary |
12
+ |---|---|---|
13
+ | [`beel.company(companyId).products.list(params?)`](#company-products-list) | `GET /v1/companies/{company_id}/products` | List the company's products, paginated and searchable. |
14
+ | [`beel.company(companyId).products.create(body)`](#company-products-create) | `POST /v1/companies/{company_id}/products` | Create a product or service. |
15
+ | [`beel.company(companyId).products.get(productId)`](#company-products-get) | `GET /v1/companies/{company_id}/products/{product_id}` | Get one product. |
16
+ | [`beel.company(companyId).products.update(productId, body)`](#company-products-update) | `PATCH /v1/companies/{company_id}/products/{product_id}` | Update a product. |
17
+ | [`beel.company(companyId).products.delete(productId)`](#company-products-delete) | `DELETE /v1/companies/{company_id}/products/{product_id}` | Delete a product from the catalog. |
18
+
19
+ <a id="company-products-list"></a>
20
+ ### `list(params?)`
21
+
22
+ List the company's products, paginated and searchable.
23
+
24
+ - **HTTP:** `GET /v1/companies/{company_id}/products` · operation `listCompanyProducts` · scopes `products:read`
25
+ - **Parameters:**
26
+ - `params?: operations['listCompanyProducts']['parameters']['query']` — Filters and pagination.
27
+ - **Returns:** The page of `products` and its `pagination`. Response `200` `data`: `{ products: Product[]; pagination: Pagination }`.
28
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
29
+
30
+ <a id="company-products-create"></a>
31
+ ### `create(body)`
32
+
33
+ Create a product or service.
34
+
35
+ - **HTTP:** `POST /v1/companies/{company_id}/products` · operation `createCompanyProduct` · scopes `products:write` · accepts `Idempotency-Key`
36
+ - **Parameters:**
37
+ - `body: components['schemas']['CreateProductRequest']` — Name, category, price and main tax.
38
+ - **Returns:** The created product. Response `201` `data`: `Product`.
39
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `409` `BeeLConflictError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
40
+
41
+ <a id="company-products-get"></a>
42
+ ### `get(productId)`
43
+
44
+ Get one product.
45
+
46
+ - **HTTP:** `GET /v1/companies/{company_id}/products/{product_id}` · operation `getCompanyProduct` · scopes `products:read`
47
+ - **Parameters:**
48
+ - `productId: string` — Product UUID.
49
+ - **Returns:** The product. Response `200` `data`: `Product`.
50
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `429` `BeeLRateLimitError`
51
+
52
+ <a id="company-products-update"></a>
53
+ ### `update(productId, body)`
54
+
55
+ Update a product. Only the fields present in `body` change.
56
+
57
+ - **HTTP:** `PATCH /v1/companies/{company_id}/products/{product_id}` · operation `patchCompanyProduct` · scopes `products:write`
58
+ - **Parameters:**
59
+ - `productId: string` — Product UUID.
60
+ - `body: operations['patchCompanyProduct']['requestBody']['content']['application/json']` — Fields to change.
61
+ - **Returns:** The updated product. Response `200` `data`: `Product`.
62
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `409` `BeeLConflictError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
63
+
64
+ <a id="company-products-delete"></a>
65
+ ### `delete(productId)`
66
+
67
+ Delete a product from the catalog. Existing invoice lines are unaffected.
68
+
69
+ - **HTTP:** `DELETE /v1/companies/{company_id}/products/{product_id}` · operation `deleteCompanyProduct` · scopes `products:write`
70
+ - **Parameters:**
71
+ - `productId: string` — Product UUID.
72
+ - **Throws:** `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `429` `BeeLRateLimitError` · `500` `BeeLApiError`