@letsbot/sdk 0.2.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3090 @@
1
+ # LetsBot Business (ERP) public API — generated twin: erp-v1.json (keep both in step).
2
+ openapi: 3.1.0
3
+ info:
4
+ title: LetsBot Business (ERP) API
5
+ version: 1.0.0
6
+ description: 'Public REST API of LetsBot Business («الأعمال»): https://{workspace}.letsbot.net/api/v1/erp.
7
+
8
+
9
+ Auth: the workspace API key in `X-Zapier-Api-Key` (Integrations → Zapier → API keys) with the `erp` scope ticked explicitly. Envelope `{success, data, meta?}` / `{success: false, error, code, errors?,
10
+ params?}`. Money and quantities are 4-dp decimal strings. Each area answers 404 until the workspace switches it on. Writes create drafts or take the explicit step you call (confirm, issue, record a
11
+ payment); nothing here messages a customer. Rate limit 120 requests/min per key (subscribe 30/min). Every POST accepts `Idempotency-Key` (24 h replay, `Idempotent-Replayed: true`).
12
+
13
+
14
+ Webhooks: subscribe with POST /hooks; deliveries are signed `X-LetsBot-Signature: t=<unix>,v1=<HMAC-SHA256 hex of "<t>.<raw body>">` with the subscription secret (reject t older than 5 minutes).'
15
+ servers:
16
+ - url: https://{workspace}.letsbot.net/api/v1/erp
17
+ variables:
18
+ workspace:
19
+ default: your-workspace
20
+ description: Your LetsBot workspace subdomain
21
+ security:
22
+ - zapierApiKey: []
23
+ tags:
24
+ - name: Inventory
25
+ - name: Sales
26
+ - name: Purchasing
27
+ - name: Expenses
28
+ - name: Accounting
29
+ - name: Webhooks
30
+ paths:
31
+ /hooks:
32
+ get:
33
+ operationId: erpListHooks
34
+ summary: List ERP webhook subscriptions made through the API
35
+ tags:
36
+ - Webhooks
37
+ description: 'Scope: `erp`. Area: `erp_core` (404 while the workspace has not switched on Business (ERP)).'
38
+ security:
39
+ - zapierApiKey: []
40
+ responses:
41
+ '200':
42
+ description: OK
43
+ content:
44
+ application/json:
45
+ schema:
46
+ type: object
47
+ properties:
48
+ success:
49
+ const: true
50
+ data:
51
+ type: array
52
+ items:
53
+ $ref: '#/components/schemas/Hook'
54
+ meta:
55
+ $ref: '#/components/schemas/PageMeta'
56
+ '401': &id001
57
+ $ref: '#/components/responses/Unauthorized'
58
+ '403': &id002
59
+ $ref: '#/components/responses/MissingScope'
60
+ '404': &id003
61
+ $ref: '#/components/responses/NotFound'
62
+ '422': &id004
63
+ $ref: '#/components/responses/Unprocessable'
64
+ '429': &id005
65
+ $ref: '#/components/responses/TooManyRequests'
66
+ post:
67
+ operationId: erpSubscribeHook
68
+ summary: Subscribe to ERP events (REST hook)
69
+ tags:
70
+ - Webhooks
71
+ description: 'Zapier sends {target_url, event}. https only, public addresses. Only events of areas the workspace switched on.
72
+
73
+
74
+ Scope: `erp`. Area: `erp_core` (404 while the workspace has not switched on Business (ERP)).'
75
+ security:
76
+ - zapierApiKey: []
77
+ responses:
78
+ '201':
79
+ description: Created; `secret` (whsec_…) is returned once.
80
+ content:
81
+ application/json:
82
+ schema:
83
+ type: object
84
+ properties:
85
+ success:
86
+ const: true
87
+ data:
88
+ $ref: '#/components/schemas/Hook'
89
+ '401': *id001
90
+ '403': *id002
91
+ '404': *id003
92
+ '422': *id004
93
+ '429': *id005
94
+ requestBody:
95
+ required: true
96
+ content:
97
+ application/json:
98
+ schema:
99
+ type: object
100
+ required: []
101
+ properties:
102
+ target_url:
103
+ type: string
104
+ format: uri
105
+ url:
106
+ type: string
107
+ format: uri
108
+ event:
109
+ type: string
110
+ events:
111
+ type: array
112
+ items:
113
+ type: string
114
+ source:
115
+ type: string
116
+ enum:
117
+ - zapier
118
+ - make
119
+ - n8n
120
+ - api
121
+ description:
122
+ type: string
123
+ /hooks/{id}:
124
+ delete:
125
+ operationId: erpUnsubscribeHook
126
+ summary: Delete an API-made ERP subscription
127
+ tags:
128
+ - Webhooks
129
+ description: 'Scope: `erp`. Area: `erp_core` (404 while the workspace has not switched on Business (ERP)).'
130
+ security:
131
+ - zapierApiKey: []
132
+ parameters:
133
+ - &id006
134
+ name: id
135
+ in: path
136
+ required: true
137
+ schema:
138
+ type: integer
139
+ responses:
140
+ '200':
141
+ description: OK
142
+ content:
143
+ application/json:
144
+ schema:
145
+ type: object
146
+ properties:
147
+ success:
148
+ const: true
149
+ data:
150
+ $ref: '#/components/schemas/Hook'
151
+ '401': *id001
152
+ '403': *id002
153
+ '404': *id003
154
+ '422': *id004
155
+ '429': *id005
156
+ /hooks/events:
157
+ get:
158
+ operationId: erpHookEvents
159
+ summary: ERP event catalogue
160
+ tags:
161
+ - Webhooks
162
+ description: 'Scope: `erp`. Area: `erp_core` (404 while the workspace has not switched on Business (ERP)).'
163
+ security:
164
+ - zapierApiKey: []
165
+ responses:
166
+ '200':
167
+ description: OK
168
+ content:
169
+ application/json:
170
+ schema:
171
+ type: object
172
+ properties:
173
+ success:
174
+ const: true
175
+ data:
176
+ type: array
177
+ items:
178
+ $ref: '#/components/schemas/HookEvent'
179
+ meta:
180
+ $ref: '#/components/schemas/PageMeta'
181
+ '401': *id001
182
+ '403': *id002
183
+ '404': *id003
184
+ '422': *id004
185
+ '429': *id005
186
+ /hooks/sample:
187
+ get:
188
+ operationId: erpHookSample
189
+ summary: Sample payload for an event (latest record)
190
+ tags:
191
+ - Webhooks
192
+ description: 'Scope: `erp`. Area: `erp_core` (404 while the workspace has not switched on Business (ERP)).'
193
+ security:
194
+ - zapierApiKey: []
195
+ parameters:
196
+ - name: event
197
+ in: query
198
+ required: true
199
+ schema:
200
+ type: string
201
+ responses:
202
+ '200':
203
+ description: OK
204
+ content:
205
+ application/json:
206
+ schema:
207
+ type: object
208
+ properties:
209
+ success:
210
+ const: true
211
+ data:
212
+ type: array
213
+ items:
214
+ $ref: '#/components/schemas/WebhookDelivery'
215
+ meta:
216
+ $ref: '#/components/schemas/PageMeta'
217
+ '401': *id001
218
+ '403': *id002
219
+ '404': *id003
220
+ '422': *id004
221
+ '429': *id005
222
+ /inventory/items:
223
+ get:
224
+ operationId: erpListItems
225
+ summary: List items (with variants)
226
+ tags:
227
+ - Inventory
228
+ description: 'Scope: `erp`. Area: `erp_inventory` (404 while the workspace has not switched on Inventory).'
229
+ security:
230
+ - zapierApiKey: []
231
+ parameters:
232
+ - &id007
233
+ $ref: '#/components/parameters/Page'
234
+ - &id008
235
+ $ref: '#/components/parameters/PerPage'
236
+ - name: search
237
+ in: query
238
+ required: false
239
+ description: Name or SKU
240
+ schema:
241
+ type: string
242
+ - name: status
243
+ in: query
244
+ required: false
245
+ description: active,archived
246
+ schema:
247
+ type: string
248
+ - name: type
249
+ in: query
250
+ required: false
251
+ description: stock,service,kit,consumable
252
+ schema:
253
+ type: string
254
+ - name: low_only
255
+ in: query
256
+ required: false
257
+ description: Below reorder point
258
+ schema:
259
+ type: boolean
260
+ - &id009
261
+ $ref: '#/components/parameters/UpdatedSince'
262
+ - &id010
263
+ $ref: '#/components/parameters/CreatedSince'
264
+ - &id011
265
+ $ref: '#/components/parameters/Sort'
266
+ - &id012
267
+ $ref: '#/components/parameters/Dir'
268
+ responses:
269
+ '200':
270
+ description: OK
271
+ content:
272
+ application/json:
273
+ schema:
274
+ type: object
275
+ properties:
276
+ success:
277
+ const: true
278
+ data:
279
+ type: array
280
+ items:
281
+ $ref: '#/components/schemas/Item'
282
+ meta:
283
+ $ref: '#/components/schemas/PageMeta'
284
+ '401': *id001
285
+ '403': *id002
286
+ '404': *id003
287
+ '422': *id004
288
+ '429': *id005
289
+ /inventory/items/{id}:
290
+ get:
291
+ operationId: erpGetItem
292
+ summary: Get an item
293
+ tags:
294
+ - Inventory
295
+ description: 'Scope: `erp`. Area: `erp_inventory` (404 while the workspace has not switched on Inventory).'
296
+ security:
297
+ - zapierApiKey: []
298
+ parameters:
299
+ - *id006
300
+ responses:
301
+ '200':
302
+ description: OK
303
+ content:
304
+ application/json:
305
+ schema:
306
+ type: object
307
+ properties:
308
+ success:
309
+ const: true
310
+ data:
311
+ $ref: '#/components/schemas/Item'
312
+ '401': *id001
313
+ '403': *id002
314
+ '404': *id003
315
+ '422': *id004
316
+ '429': *id005
317
+ /inventory/variants:
318
+ get:
319
+ operationId: erpListVariants
320
+ summary: List / find variants (exact sku=)
321
+ tags:
322
+ - Inventory
323
+ description: 'Scope: `erp`. Area: `erp_inventory` (404 while the workspace has not switched on Inventory).'
324
+ security:
325
+ - zapierApiKey: []
326
+ parameters:
327
+ - *id007
328
+ - *id008
329
+ - name: sku
330
+ in: query
331
+ required: false
332
+ description: Exact SKU
333
+ schema:
334
+ type: string
335
+ - name: search
336
+ in: query
337
+ required: false
338
+ description: Text
339
+ schema:
340
+ type: string
341
+ - name: item_id
342
+ in: query
343
+ required: false
344
+ description: Item id
345
+ schema:
346
+ type: integer
347
+ responses:
348
+ '200':
349
+ description: OK
350
+ content:
351
+ application/json:
352
+ schema:
353
+ type: object
354
+ properties:
355
+ success:
356
+ const: true
357
+ data:
358
+ type: array
359
+ items:
360
+ $ref: '#/components/schemas/Variant'
361
+ meta:
362
+ $ref: '#/components/schemas/PageMeta'
363
+ '401': *id001
364
+ '403': *id002
365
+ '404': *id003
366
+ '422': *id004
367
+ '429': *id005
368
+ /inventory/warehouses:
369
+ get:
370
+ operationId: erpListWarehouses
371
+ summary: List warehouses
372
+ tags:
373
+ - Inventory
374
+ description: 'Scope: `erp`. Area: `erp_inventory` (404 while the workspace has not switched on Inventory).'
375
+ security:
376
+ - zapierApiKey: []
377
+ parameters:
378
+ - *id007
379
+ - *id008
380
+ - name: status
381
+ in: query
382
+ required: false
383
+ description: active,archived
384
+ schema:
385
+ type: string
386
+ responses:
387
+ '200':
388
+ description: OK
389
+ content:
390
+ application/json:
391
+ schema:
392
+ type: object
393
+ properties:
394
+ success:
395
+ const: true
396
+ data:
397
+ type: array
398
+ items:
399
+ $ref: '#/components/schemas/Warehouse'
400
+ meta:
401
+ $ref: '#/components/schemas/PageMeta'
402
+ '401': *id001
403
+ '403': *id002
404
+ '404': *id003
405
+ '422': *id004
406
+ '429': *id005
407
+ /inventory/stock-levels:
408
+ get:
409
+ operationId: erpListStockLevels
410
+ summary: Stock levels per variant × warehouse
411
+ tags:
412
+ - Inventory
413
+ description: 'Scope: `erp`. Area: `erp_inventory` (404 while the workspace has not switched on Inventory).'
414
+ security:
415
+ - zapierApiKey: []
416
+ parameters:
417
+ - *id007
418
+ - *id008
419
+ - name: sku
420
+ in: query
421
+ required: false
422
+ description: Exact SKU
423
+ schema:
424
+ type: string
425
+ - name: variant_id
426
+ in: query
427
+ required: false
428
+ description: Variant
429
+ schema:
430
+ type: integer
431
+ - name: warehouse_id
432
+ in: query
433
+ required: false
434
+ description: Warehouse
435
+ schema:
436
+ type: integer
437
+ responses:
438
+ '200':
439
+ description: OK
440
+ content:
441
+ application/json:
442
+ schema:
443
+ type: object
444
+ properties:
445
+ success:
446
+ const: true
447
+ data:
448
+ type: array
449
+ items:
450
+ $ref: '#/components/schemas/StockLevel'
451
+ meta:
452
+ $ref: '#/components/schemas/PageMeta'
453
+ '401': *id001
454
+ '403': *id002
455
+ '404': *id003
456
+ '422': *id004
457
+ '429': *id005
458
+ /inventory/stock-moves:
459
+ get:
460
+ operationId: erpListStockMoves
461
+ summary: Stock ledger (append-only; poll with after_id)
462
+ tags:
463
+ - Inventory
464
+ description: 'Scope: `erp`. Area: `erp_inventory` (404 while the workspace has not switched on Inventory).'
465
+ security:
466
+ - zapierApiKey: []
467
+ parameters:
468
+ - *id007
469
+ - *id008
470
+ - name: after_id
471
+ in: query
472
+ required: false
473
+ description: Only moves after this id, oldest first
474
+ schema:
475
+ type: integer
476
+ - name: variant_id
477
+ in: query
478
+ required: false
479
+ description: Variant
480
+ schema:
481
+ type: integer
482
+ - name: warehouse_id
483
+ in: query
484
+ required: false
485
+ description: Warehouse
486
+ schema:
487
+ type: integer
488
+ - name: move_type
489
+ in: query
490
+ required: false
491
+ description: Comma list
492
+ schema:
493
+ type: string
494
+ - name: since
495
+ in: query
496
+ required: false
497
+ description: moved_at ≥ (ISO-8601)
498
+ schema:
499
+ type: string
500
+ - name: until
501
+ in: query
502
+ required: false
503
+ description: moved_at ≤ (ISO-8601)
504
+ schema:
505
+ type: string
506
+ responses:
507
+ '200':
508
+ description: OK
509
+ content:
510
+ application/json:
511
+ schema:
512
+ type: object
513
+ properties:
514
+ success:
515
+ const: true
516
+ data:
517
+ type: array
518
+ items:
519
+ $ref: '#/components/schemas/StockMove'
520
+ meta:
521
+ $ref: '#/components/schemas/PageMeta'
522
+ '401': *id001
523
+ '403': *id002
524
+ '404': *id003
525
+ '422': *id004
526
+ '429': *id005
527
+ /sales/customers:
528
+ get:
529
+ operationId: erpListCustomers
530
+ summary: List customers
531
+ tags:
532
+ - Sales
533
+ description: 'Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
534
+ security:
535
+ - zapierApiKey: []
536
+ parameters:
537
+ - *id007
538
+ - *id008
539
+ - name: search
540
+ in: query
541
+ required: false
542
+ description: Name, legal name or VAT
543
+ schema:
544
+ type: string
545
+ - name: contact_id
546
+ in: query
547
+ required: false
548
+ description: CRM contact
549
+ schema:
550
+ type: integer
551
+ - name: company_id
552
+ in: query
553
+ required: false
554
+ description: CRM company
555
+ schema:
556
+ type: integer
557
+ - *id009
558
+ - *id010
559
+ - *id011
560
+ - *id012
561
+ responses:
562
+ '200':
563
+ description: OK
564
+ content:
565
+ application/json:
566
+ schema:
567
+ type: object
568
+ properties:
569
+ success:
570
+ const: true
571
+ data:
572
+ type: array
573
+ items:
574
+ $ref: '#/components/schemas/Customer'
575
+ meta:
576
+ $ref: '#/components/schemas/PageMeta'
577
+ '401': *id001
578
+ '403': *id002
579
+ '404': *id003
580
+ '422': *id004
581
+ '429': *id005
582
+ /sales/customers/{id}:
583
+ get:
584
+ operationId: erpGetCustomer
585
+ summary: Get a customer
586
+ tags:
587
+ - Sales
588
+ description: 'Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
589
+ security:
590
+ - zapierApiKey: []
591
+ parameters:
592
+ - *id006
593
+ responses:
594
+ '200':
595
+ description: OK
596
+ content:
597
+ application/json:
598
+ schema:
599
+ type: object
600
+ properties:
601
+ success:
602
+ const: true
603
+ data:
604
+ $ref: '#/components/schemas/Customer'
605
+ '401': *id001
606
+ '403': *id002
607
+ '404': *id003
608
+ '422': *id004
609
+ '429': *id005
610
+ /sales/customers/{id}/statement:
611
+ get:
612
+ operationId: erpCustomerStatement
613
+ summary: Customer statement of account (+ PDF link)
614
+ tags:
615
+ - Sales
616
+ description: 'Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
617
+ security:
618
+ - zapierApiKey: []
619
+ parameters:
620
+ - *id006
621
+ - name: from
622
+ in: query
623
+ required: false
624
+ description: Y-m-d (default today − 89 days)
625
+ schema:
626
+ type: string
627
+ format: date
628
+ - name: to
629
+ in: query
630
+ required: false
631
+ description: Y-m-d (default today)
632
+ schema:
633
+ type: string
634
+ format: date
635
+ responses:
636
+ '200':
637
+ description: OK
638
+ content:
639
+ application/json:
640
+ schema:
641
+ type: object
642
+ properties:
643
+ success:
644
+ const: true
645
+ data:
646
+ $ref: '#/components/schemas/Statement'
647
+ '401': *id001
648
+ '403': *id002
649
+ '404': *id003
650
+ '422': *id004
651
+ '429': *id005
652
+ /sales/orders:
653
+ get:
654
+ operationId: erpListSalesOrders
655
+ summary: List sales orders
656
+ tags:
657
+ - Sales
658
+ description: 'Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
659
+ security:
660
+ - zapierApiKey: []
661
+ parameters:
662
+ - *id007
663
+ - *id008
664
+ - name: status
665
+ in: query
666
+ required: false
667
+ description: Comma list
668
+ schema:
669
+ type: string
670
+ - name: customer_id
671
+ in: query
672
+ required: false
673
+ description: Customer
674
+ schema:
675
+ type: integer
676
+ - name: contact_id
677
+ in: query
678
+ required: false
679
+ description: CRM contact
680
+ schema:
681
+ type: integer
682
+ - name: company_id
683
+ in: query
684
+ required: false
685
+ description: CRM company
686
+ schema:
687
+ type: integer
688
+ - *id009
689
+ - *id010
690
+ - *id011
691
+ - *id012
692
+ responses:
693
+ '200':
694
+ description: OK
695
+ content:
696
+ application/json:
697
+ schema:
698
+ type: object
699
+ properties:
700
+ success:
701
+ const: true
702
+ data:
703
+ type: array
704
+ items:
705
+ $ref: '#/components/schemas/SalesOrder'
706
+ meta:
707
+ $ref: '#/components/schemas/PageMeta'
708
+ '401': *id001
709
+ '403': *id002
710
+ '404': *id003
711
+ '422': *id004
712
+ '429': *id005
713
+ post:
714
+ operationId: erpCreateSalesOrder
715
+ summary: Create a DRAFT sales order
716
+ tags:
717
+ - Sales
718
+ description: 'Reserves nothing and messages nobody until confirmed.
719
+
720
+
721
+ Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
722
+ security:
723
+ - zapierApiKey: []
724
+ parameters:
725
+ - $ref: '#/components/parameters/IdempotencyKey'
726
+ responses:
727
+ '201':
728
+ description: OK
729
+ content:
730
+ application/json:
731
+ schema:
732
+ type: object
733
+ properties:
734
+ success:
735
+ const: true
736
+ data:
737
+ $ref: '#/components/schemas/SalesOrder'
738
+ '401': *id001
739
+ '403': *id002
740
+ '404': *id003
741
+ '422': *id004
742
+ '429': *id005
743
+ requestBody:
744
+ required: true
745
+ content:
746
+ application/json:
747
+ schema:
748
+ type: object
749
+ required:
750
+ - lines
751
+ properties:
752
+ customer_id: &id014
753
+ type: integer
754
+ description: ERP customer id
755
+ contact_id: &id015
756
+ type: integer
757
+ description: CRM contact id (customer profile created when missing)
758
+ company_id: &id016
759
+ type: integer
760
+ description: CRM company id
761
+ lines:
762
+ type: array
763
+ minItems: 1
764
+ items:
765
+ $ref: '#/components/schemas/LineIn'
766
+ warehouse_id: &id013
767
+ type: integer
768
+ currency:
769
+ type: string
770
+ prices_include_tax:
771
+ type: boolean
772
+ payment_method:
773
+ type: string
774
+ enum:
775
+ - link
776
+ - cod
777
+ - bank
778
+ - cash
779
+ - credit
780
+ payment_terms_days: *id013
781
+ delivery_date:
782
+ type: string
783
+ format: date
784
+ shipping_address:
785
+ type: object
786
+ deal_id: *id013
787
+ notes:
788
+ type: string
789
+ reference:
790
+ type: string
791
+ description: Your reference (stored as source_ref).
792
+ /sales/orders/{id}:
793
+ get:
794
+ operationId: erpGetSalesOrder
795
+ summary: Get a sales order
796
+ tags:
797
+ - Sales
798
+ description: 'Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
799
+ security:
800
+ - zapierApiKey: []
801
+ parameters:
802
+ - *id006
803
+ responses:
804
+ '200':
805
+ description: OK
806
+ content:
807
+ application/json:
808
+ schema:
809
+ type: object
810
+ properties:
811
+ success:
812
+ const: true
813
+ data:
814
+ $ref: '#/components/schemas/SalesOrder'
815
+ '401': *id001
816
+ '403': *id002
817
+ '404': *id003
818
+ '422': *id004
819
+ '429': *id005
820
+ /sales/orders/{id}/confirm:
821
+ post:
822
+ operationId: erpConfirmSalesOrder
823
+ summary: Confirm a draft order (credit check, number, stock reservation)
824
+ tags:
825
+ - Sales
826
+ description: 'Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
827
+ security:
828
+ - zapierApiKey: []
829
+ parameters:
830
+ - *id006
831
+ responses:
832
+ '200':
833
+ description: OK
834
+ content:
835
+ application/json:
836
+ schema:
837
+ type: object
838
+ properties:
839
+ success:
840
+ const: true
841
+ data:
842
+ $ref: '#/components/schemas/SalesOrder'
843
+ '401': *id001
844
+ '403': *id002
845
+ '404': *id003
846
+ '422': *id004
847
+ '429': *id005
848
+ /sales/invoices:
849
+ get:
850
+ operationId: erpListInvoices
851
+ summary: List invoices (tax, simplified, debit notes)
852
+ tags:
853
+ - Sales
854
+ description: 'Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
855
+ security:
856
+ - zapierApiKey: []
857
+ parameters:
858
+ - *id007
859
+ - *id008
860
+ - name: doc_type
861
+ in: query
862
+ required: false
863
+ description: tax,simplified,debit_note
864
+ schema:
865
+ type: string
866
+ - name: status
867
+ in: query
868
+ required: false
869
+ description: Comma list
870
+ schema:
871
+ type: string
872
+ - name: einvoice_status
873
+ in: query
874
+ required: false
875
+ description: Comma list
876
+ schema:
877
+ type: string
878
+ - name: overdue
879
+ in: query
880
+ required: false
881
+ description: Open and past due
882
+ schema:
883
+ type: boolean
884
+ - name: customer_id
885
+ in: query
886
+ required: false
887
+ description: Customer
888
+ schema:
889
+ type: integer
890
+ - name: order_id
891
+ in: query
892
+ required: false
893
+ description: Sales order
894
+ schema:
895
+ type: integer
896
+ - *id009
897
+ - *id010
898
+ - *id011
899
+ - *id012
900
+ responses:
901
+ '200':
902
+ description: OK
903
+ content:
904
+ application/json:
905
+ schema:
906
+ type: object
907
+ properties:
908
+ success:
909
+ const: true
910
+ data:
911
+ type: array
912
+ items:
913
+ $ref: '#/components/schemas/Invoice'
914
+ meta:
915
+ $ref: '#/components/schemas/PageMeta'
916
+ '401': *id001
917
+ '403': *id002
918
+ '404': *id003
919
+ '422': *id004
920
+ '429': *id005
921
+ post:
922
+ operationId: erpCreateInvoice
923
+ summary: Create a DRAFT invoice (lines, or order_id = what is left on that order)
924
+ tags:
925
+ - Sales
926
+ description: 'Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
927
+ security:
928
+ - zapierApiKey: []
929
+ parameters:
930
+ - $ref: '#/components/parameters/IdempotencyKey'
931
+ responses:
932
+ '201':
933
+ description: OK
934
+ content:
935
+ application/json:
936
+ schema:
937
+ type: object
938
+ properties:
939
+ success:
940
+ const: true
941
+ data:
942
+ $ref: '#/components/schemas/Invoice'
943
+ '401': *id001
944
+ '403': *id002
945
+ '404': *id003
946
+ '422': *id004
947
+ '429': *id005
948
+ requestBody:
949
+ required: true
950
+ content:
951
+ application/json:
952
+ schema:
953
+ type: object
954
+ required: []
955
+ properties:
956
+ customer_id: *id014
957
+ contact_id: *id015
958
+ company_id: *id016
959
+ order_id: *id013
960
+ doc_type:
961
+ type: string
962
+ enum:
963
+ - tax
964
+ - simplified
965
+ lines:
966
+ type: array
967
+ items:
968
+ $ref: '#/components/schemas/LineIn'
969
+ currency:
970
+ type: string
971
+ issue_date:
972
+ type: string
973
+ format: date
974
+ supply_date:
975
+ type: string
976
+ format: date
977
+ due_date:
978
+ type: string
979
+ format: date
980
+ prices_include_tax:
981
+ type: boolean
982
+ payment_terms_days: *id013
983
+ deal_id: *id013
984
+ notes:
985
+ type: string
986
+ /sales/invoices/{id}:
987
+ get:
988
+ operationId: erpGetInvoice
989
+ summary: Get an invoice
990
+ tags:
991
+ - Sales
992
+ description: 'Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
993
+ security:
994
+ - zapierApiKey: []
995
+ parameters:
996
+ - *id006
997
+ responses:
998
+ '200':
999
+ description: OK
1000
+ content:
1001
+ application/json:
1002
+ schema:
1003
+ type: object
1004
+ properties:
1005
+ success:
1006
+ const: true
1007
+ data:
1008
+ $ref: '#/components/schemas/Invoice'
1009
+ '401': *id001
1010
+ '403': *id002
1011
+ '404': *id003
1012
+ '422': *id004
1013
+ '429': *id005
1014
+ /sales/invoices/{id}/issue:
1015
+ post:
1016
+ operationId: erpIssueInvoice
1017
+ summary: Issue a draft invoice (number, QR, e-invoice submission when on)
1018
+ tags:
1019
+ - Sales
1020
+ description: 'Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
1021
+ security:
1022
+ - zapierApiKey: []
1023
+ parameters:
1024
+ - *id006
1025
+ responses:
1026
+ '200':
1027
+ description: OK
1028
+ content:
1029
+ application/json:
1030
+ schema:
1031
+ type: object
1032
+ properties:
1033
+ success:
1034
+ const: true
1035
+ data:
1036
+ $ref: '#/components/schemas/Invoice'
1037
+ '401': *id001
1038
+ '403': *id002
1039
+ '404': *id003
1040
+ '422': *id004
1041
+ '429': *id005
1042
+ /sales/invoices/{id}/pdf:
1043
+ get:
1044
+ operationId: erpInvoicePdfLink
1045
+ summary: Customer PDF / page link (only once shareable)
1046
+ tags:
1047
+ - Sales
1048
+ description: 'Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
1049
+ security:
1050
+ - zapierApiKey: []
1051
+ parameters:
1052
+ - *id006
1053
+ responses:
1054
+ '200':
1055
+ description: OK
1056
+ content:
1057
+ application/json:
1058
+ schema:
1059
+ type: object
1060
+ properties:
1061
+ success:
1062
+ const: true
1063
+ data:
1064
+ $ref: '#/components/schemas/InvoiceLinks'
1065
+ '401': *id001
1066
+ '403': *id002
1067
+ '404': *id003
1068
+ '422': *id004
1069
+ '429': *id005
1070
+ /sales/invoices/{id}/credit-notes:
1071
+ post:
1072
+ operationId: erpCreateCreditNote
1073
+ summary: Create a DRAFT credit note against an issued invoice
1074
+ tags:
1075
+ - Sales
1076
+ description: 'Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
1077
+ security:
1078
+ - zapierApiKey: []
1079
+ parameters:
1080
+ - *id006
1081
+ - $ref: '#/components/parameters/IdempotencyKey'
1082
+ responses:
1083
+ '201':
1084
+ description: OK
1085
+ content:
1086
+ application/json:
1087
+ schema:
1088
+ type: object
1089
+ properties:
1090
+ success:
1091
+ const: true
1092
+ data:
1093
+ $ref: '#/components/schemas/Invoice'
1094
+ '401': *id001
1095
+ '403': *id002
1096
+ '404': *id003
1097
+ '422': *id004
1098
+ '429': *id005
1099
+ requestBody:
1100
+ required: true
1101
+ content:
1102
+ application/json:
1103
+ schema:
1104
+ type: object
1105
+ required:
1106
+ - reason
1107
+ - lines
1108
+ properties:
1109
+ reason:
1110
+ type: string
1111
+ enum:
1112
+ - return
1113
+ - price_adjustment
1114
+ - discount
1115
+ - cancellation
1116
+ - damaged
1117
+ - other
1118
+ lines:
1119
+ type: array
1120
+ minItems: 1
1121
+ items:
1122
+ type: object
1123
+ required:
1124
+ - invoice_line_id
1125
+ properties:
1126
+ invoice_line_id: *id013
1127
+ qty:
1128
+ type: number
1129
+ amount:
1130
+ type: number
1131
+ description: Net, excl. VAT
1132
+ /sales/credit-notes:
1133
+ get:
1134
+ operationId: erpListCreditNotes
1135
+ summary: List credit notes
1136
+ tags:
1137
+ - Sales
1138
+ description: 'Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
1139
+ security:
1140
+ - zapierApiKey: []
1141
+ parameters:
1142
+ - *id007
1143
+ - *id008
1144
+ - name: status
1145
+ in: query
1146
+ required: false
1147
+ description: Comma list
1148
+ schema:
1149
+ type: string
1150
+ - name: customer_id
1151
+ in: query
1152
+ required: false
1153
+ description: Customer
1154
+ schema:
1155
+ type: integer
1156
+ - *id009
1157
+ - *id010
1158
+ - *id011
1159
+ - *id012
1160
+ responses:
1161
+ '200':
1162
+ description: OK
1163
+ content:
1164
+ application/json:
1165
+ schema:
1166
+ type: object
1167
+ properties:
1168
+ success:
1169
+ const: true
1170
+ data:
1171
+ type: array
1172
+ items:
1173
+ $ref: '#/components/schemas/Invoice'
1174
+ meta:
1175
+ $ref: '#/components/schemas/PageMeta'
1176
+ '401': *id001
1177
+ '403': *id002
1178
+ '404': *id003
1179
+ '422': *id004
1180
+ '429': *id005
1181
+ /sales/credit-notes/{id}:
1182
+ get:
1183
+ operationId: erpGetCreditNote
1184
+ summary: Get a credit note
1185
+ tags:
1186
+ - Sales
1187
+ description: 'Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
1188
+ security:
1189
+ - zapierApiKey: []
1190
+ parameters:
1191
+ - *id006
1192
+ responses:
1193
+ '200':
1194
+ description: OK
1195
+ content:
1196
+ application/json:
1197
+ schema:
1198
+ type: object
1199
+ properties:
1200
+ success:
1201
+ const: true
1202
+ data:
1203
+ $ref: '#/components/schemas/Invoice'
1204
+ '401': *id001
1205
+ '403': *id002
1206
+ '404': *id003
1207
+ '422': *id004
1208
+ '429': *id005
1209
+ /sales/credit-notes/{id}/issue:
1210
+ post:
1211
+ operationId: erpIssueCreditNote
1212
+ summary: Issue a draft credit note
1213
+ tags:
1214
+ - Sales
1215
+ description: 'Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
1216
+ security:
1217
+ - zapierApiKey: []
1218
+ parameters:
1219
+ - *id006
1220
+ responses:
1221
+ '200':
1222
+ description: OK
1223
+ content:
1224
+ application/json:
1225
+ schema:
1226
+ type: object
1227
+ properties:
1228
+ success:
1229
+ const: true
1230
+ data:
1231
+ $ref: '#/components/schemas/Invoice'
1232
+ '401': *id001
1233
+ '403': *id002
1234
+ '404': *id003
1235
+ '422': *id004
1236
+ '429': *id005
1237
+ /sales/payments:
1238
+ get:
1239
+ operationId: erpListPayments
1240
+ summary: List payments
1241
+ tags:
1242
+ - Sales
1243
+ description: 'Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
1244
+ security:
1245
+ - zapierApiKey: []
1246
+ parameters:
1247
+ - *id007
1248
+ - *id008
1249
+ - name: direction
1250
+ in: query
1251
+ required: false
1252
+ description: in,out
1253
+ schema:
1254
+ type: string
1255
+ - name: method
1256
+ in: query
1257
+ required: false
1258
+ description: Comma list
1259
+ schema:
1260
+ type: string
1261
+ - name: customer_id
1262
+ in: query
1263
+ required: false
1264
+ description: Customer
1265
+ schema:
1266
+ type: integer
1267
+ - *id009
1268
+ - *id010
1269
+ - *id011
1270
+ - *id012
1271
+ responses:
1272
+ '200':
1273
+ description: OK
1274
+ content:
1275
+ application/json:
1276
+ schema:
1277
+ type: object
1278
+ properties:
1279
+ success:
1280
+ const: true
1281
+ data:
1282
+ type: array
1283
+ items:
1284
+ $ref: '#/components/schemas/Payment'
1285
+ meta:
1286
+ $ref: '#/components/schemas/PageMeta'
1287
+ '401': *id001
1288
+ '403': *id002
1289
+ '404': *id003
1290
+ '422': *id004
1291
+ '429': *id005
1292
+ post:
1293
+ operationId: erpRecordPayment
1294
+ summary: Record a customer payment (receipt)
1295
+ tags:
1296
+ - Sales
1297
+ description: 'Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
1298
+ security:
1299
+ - zapierApiKey: []
1300
+ parameters:
1301
+ - $ref: '#/components/parameters/IdempotencyKey'
1302
+ responses:
1303
+ '201':
1304
+ description: OK
1305
+ content:
1306
+ application/json:
1307
+ schema:
1308
+ type: object
1309
+ properties:
1310
+ success:
1311
+ const: true
1312
+ data:
1313
+ $ref: '#/components/schemas/Payment'
1314
+ '401': *id001
1315
+ '403': *id002
1316
+ '404': *id003
1317
+ '422': *id004
1318
+ '429': *id005
1319
+ requestBody:
1320
+ required: true
1321
+ content:
1322
+ application/json:
1323
+ schema:
1324
+ type: object
1325
+ required:
1326
+ - amount
1327
+ - method
1328
+ properties:
1329
+ customer_id: *id014
1330
+ contact_id: *id015
1331
+ company_id: *id016
1332
+ amount:
1333
+ type: number
1334
+ exclusiveMinimum: 0
1335
+ method:
1336
+ type: string
1337
+ enum:
1338
+ - gateway
1339
+ - cash
1340
+ - bank_transfer
1341
+ - cod
1342
+ - card_pos
1343
+ - bnpl
1344
+ - store_credit
1345
+ currency:
1346
+ type: string
1347
+ fx_rate:
1348
+ type: number
1349
+ received_at:
1350
+ type: string
1351
+ format: date-time
1352
+ reference:
1353
+ type: string
1354
+ provider:
1355
+ type: string
1356
+ provider_payment_id:
1357
+ type: string
1358
+ description: 'With provider: idempotent on the provider id.'
1359
+ allocations:
1360
+ type: array
1361
+ items:
1362
+ type: object
1363
+ required:
1364
+ - invoice_id
1365
+ - amount
1366
+ properties:
1367
+ invoice_id: *id013
1368
+ amount:
1369
+ type: number
1370
+ description: Omit = oldest due first.
1371
+ /sales/payments/{id}:
1372
+ get:
1373
+ operationId: erpGetPayment
1374
+ summary: Get a payment
1375
+ tags:
1376
+ - Sales
1377
+ description: 'Scope: `erp`. Area: `erp_sales` (404 while the workspace has not switched on Sales).'
1378
+ security:
1379
+ - zapierApiKey: []
1380
+ parameters:
1381
+ - *id006
1382
+ responses:
1383
+ '200':
1384
+ description: OK
1385
+ content:
1386
+ application/json:
1387
+ schema:
1388
+ type: object
1389
+ properties:
1390
+ success:
1391
+ const: true
1392
+ data:
1393
+ $ref: '#/components/schemas/Payment'
1394
+ '401': *id001
1395
+ '403': *id002
1396
+ '404': *id003
1397
+ '422': *id004
1398
+ '429': *id005
1399
+ /purchasing/suppliers:
1400
+ get:
1401
+ operationId: erpListSuppliers
1402
+ summary: List suppliers
1403
+ tags:
1404
+ - Purchasing
1405
+ description: 'Scope: `erp`. Area: `erp_purchasing` (404 while the workspace has not switched on Purchasing).'
1406
+ security:
1407
+ - zapierApiKey: []
1408
+ parameters:
1409
+ - *id007
1410
+ - *id008
1411
+ - name: search
1412
+ in: query
1413
+ required: false
1414
+ description: Name, code or VAT
1415
+ schema:
1416
+ type: string
1417
+ - name: status
1418
+ in: query
1419
+ required: false
1420
+ description: Comma list
1421
+ schema:
1422
+ type: string
1423
+ - *id009
1424
+ - *id010
1425
+ - *id011
1426
+ - *id012
1427
+ responses:
1428
+ '200':
1429
+ description: OK
1430
+ content:
1431
+ application/json:
1432
+ schema:
1433
+ type: object
1434
+ properties:
1435
+ success:
1436
+ const: true
1437
+ data:
1438
+ type: array
1439
+ items:
1440
+ $ref: '#/components/schemas/Supplier'
1441
+ meta:
1442
+ $ref: '#/components/schemas/PageMeta'
1443
+ '401': *id001
1444
+ '403': *id002
1445
+ '404': *id003
1446
+ '422': *id004
1447
+ '429': *id005
1448
+ /purchasing/suppliers/{id}:
1449
+ get:
1450
+ operationId: erpGetSupplier
1451
+ summary: Get a supplier
1452
+ tags:
1453
+ - Purchasing
1454
+ description: 'Scope: `erp`. Area: `erp_purchasing` (404 while the workspace has not switched on Purchasing).'
1455
+ security:
1456
+ - zapierApiKey: []
1457
+ parameters:
1458
+ - *id006
1459
+ responses:
1460
+ '200':
1461
+ description: OK
1462
+ content:
1463
+ application/json:
1464
+ schema:
1465
+ type: object
1466
+ properties:
1467
+ success:
1468
+ const: true
1469
+ data:
1470
+ $ref: '#/components/schemas/Supplier'
1471
+ '401': *id001
1472
+ '403': *id002
1473
+ '404': *id003
1474
+ '422': *id004
1475
+ '429': *id005
1476
+ /purchasing/purchase-orders:
1477
+ get:
1478
+ operationId: erpListPurchaseOrders
1479
+ summary: List purchase orders
1480
+ tags:
1481
+ - Purchasing
1482
+ description: 'Scope: `erp`. Area: `erp_purchasing` (404 while the workspace has not switched on Purchasing).'
1483
+ security:
1484
+ - zapierApiKey: []
1485
+ parameters:
1486
+ - *id007
1487
+ - *id008
1488
+ - name: status
1489
+ in: query
1490
+ required: false
1491
+ description: Comma list
1492
+ schema:
1493
+ type: string
1494
+ - name: supplier_reply
1495
+ in: query
1496
+ required: false
1497
+ description: Comma list
1498
+ schema:
1499
+ type: string
1500
+ - name: supplier_id
1501
+ in: query
1502
+ required: false
1503
+ description: Supplier
1504
+ schema:
1505
+ type: integer
1506
+ - name: warehouse_id
1507
+ in: query
1508
+ required: false
1509
+ description: Warehouse
1510
+ schema:
1511
+ type: integer
1512
+ - *id009
1513
+ - *id010
1514
+ - *id011
1515
+ - *id012
1516
+ responses:
1517
+ '200':
1518
+ description: OK
1519
+ content:
1520
+ application/json:
1521
+ schema:
1522
+ type: object
1523
+ properties:
1524
+ success:
1525
+ const: true
1526
+ data:
1527
+ type: array
1528
+ items:
1529
+ $ref: '#/components/schemas/PurchaseOrder'
1530
+ meta:
1531
+ $ref: '#/components/schemas/PageMeta'
1532
+ '401': *id001
1533
+ '403': *id002
1534
+ '404': *id003
1535
+ '422': *id004
1536
+ '429': *id005
1537
+ post:
1538
+ operationId: erpCreatePurchaseOrder
1539
+ summary: Create a DRAFT purchase order
1540
+ tags:
1541
+ - Purchasing
1542
+ description: 'Approval and sending to the supplier stay with a person in the panel.
1543
+
1544
+
1545
+ Scope: `erp`. Area: `erp_purchasing` (404 while the workspace has not switched on Purchasing).'
1546
+ security:
1547
+ - zapierApiKey: []
1548
+ parameters:
1549
+ - $ref: '#/components/parameters/IdempotencyKey'
1550
+ responses:
1551
+ '201':
1552
+ description: OK
1553
+ content:
1554
+ application/json:
1555
+ schema:
1556
+ type: object
1557
+ properties:
1558
+ success:
1559
+ const: true
1560
+ data:
1561
+ $ref: '#/components/schemas/PurchaseOrder'
1562
+ '401': *id001
1563
+ '403': *id002
1564
+ '404': *id003
1565
+ '422': *id004
1566
+ '429': *id005
1567
+ requestBody:
1568
+ required: true
1569
+ content:
1570
+ application/json:
1571
+ schema:
1572
+ type: object
1573
+ required:
1574
+ - supplier_id
1575
+ - lines
1576
+ properties:
1577
+ supplier_id: *id013
1578
+ warehouse_id: *id013
1579
+ order_date:
1580
+ type: string
1581
+ format: date
1582
+ expected_date:
1583
+ type: string
1584
+ format: date
1585
+ payment_terms_days: *id013
1586
+ currency:
1587
+ type: string
1588
+ fx_rate:
1589
+ type: number
1590
+ notes:
1591
+ type: string
1592
+ lines:
1593
+ type: array
1594
+ minItems: 1
1595
+ items:
1596
+ type: object
1597
+ required:
1598
+ - qty
1599
+ properties:
1600
+ variant_id: *id013
1601
+ sku:
1602
+ type: string
1603
+ name:
1604
+ type: string
1605
+ supplier_sku:
1606
+ type: string
1607
+ qty:
1608
+ type: number
1609
+ unit_price:
1610
+ type: number
1611
+ discount_pct:
1612
+ type: number
1613
+ tax_rate:
1614
+ type: number
1615
+ uom_id: *id013
1616
+ /purchasing/purchase-orders/{id}:
1617
+ get:
1618
+ operationId: erpGetPurchaseOrder
1619
+ summary: Get a purchase order
1620
+ tags:
1621
+ - Purchasing
1622
+ description: 'Scope: `erp`. Area: `erp_purchasing` (404 while the workspace has not switched on Purchasing).'
1623
+ security:
1624
+ - zapierApiKey: []
1625
+ parameters:
1626
+ - *id006
1627
+ responses:
1628
+ '200':
1629
+ description: OK
1630
+ content:
1631
+ application/json:
1632
+ schema:
1633
+ type: object
1634
+ properties:
1635
+ success:
1636
+ const: true
1637
+ data:
1638
+ $ref: '#/components/schemas/PurchaseOrder'
1639
+ '401': *id001
1640
+ '403': *id002
1641
+ '404': *id003
1642
+ '422': *id004
1643
+ '429': *id005
1644
+ /purchasing/bills:
1645
+ get:
1646
+ operationId: erpListBills
1647
+ summary: List supplier bills
1648
+ tags:
1649
+ - Purchasing
1650
+ description: 'Scope: `erp`. Area: `erp_purchasing` (404 while the workspace has not switched on Purchasing).'
1651
+ security:
1652
+ - zapierApiKey: []
1653
+ parameters:
1654
+ - *id007
1655
+ - *id008
1656
+ - name: status
1657
+ in: query
1658
+ required: false
1659
+ description: Comma list
1660
+ schema:
1661
+ type: string
1662
+ - name: kind
1663
+ in: query
1664
+ required: false
1665
+ description: goods,landed,expense
1666
+ schema:
1667
+ type: string
1668
+ - name: supplier_id
1669
+ in: query
1670
+ required: false
1671
+ description: Supplier
1672
+ schema:
1673
+ type: integer
1674
+ - name: purchase_order_id
1675
+ in: query
1676
+ required: false
1677
+ description: PO
1678
+ schema:
1679
+ type: integer
1680
+ - *id009
1681
+ - *id010
1682
+ - *id011
1683
+ - *id012
1684
+ responses:
1685
+ '200':
1686
+ description: OK
1687
+ content:
1688
+ application/json:
1689
+ schema:
1690
+ type: object
1691
+ properties:
1692
+ success:
1693
+ const: true
1694
+ data:
1695
+ type: array
1696
+ items:
1697
+ $ref: '#/components/schemas/Bill'
1698
+ meta:
1699
+ $ref: '#/components/schemas/PageMeta'
1700
+ '401': *id001
1701
+ '403': *id002
1702
+ '404': *id003
1703
+ '422': *id004
1704
+ '429': *id005
1705
+ /purchasing/bills/{id}:
1706
+ get:
1707
+ operationId: erpGetBill
1708
+ summary: Get a supplier bill
1709
+ tags:
1710
+ - Purchasing
1711
+ description: 'Scope: `erp`. Area: `erp_purchasing` (404 while the workspace has not switched on Purchasing).'
1712
+ security:
1713
+ - zapierApiKey: []
1714
+ parameters:
1715
+ - *id006
1716
+ responses:
1717
+ '200':
1718
+ description: OK
1719
+ content:
1720
+ application/json:
1721
+ schema:
1722
+ type: object
1723
+ properties:
1724
+ success:
1725
+ const: true
1726
+ data:
1727
+ $ref: '#/components/schemas/Bill'
1728
+ '401': *id001
1729
+ '403': *id002
1730
+ '404': *id003
1731
+ '422': *id004
1732
+ '429': *id005
1733
+ /expenses/categories:
1734
+ get:
1735
+ operationId: erpListExpenseCategories
1736
+ summary: List active expense categories
1737
+ tags:
1738
+ - Expenses
1739
+ description: 'Scope: `erp`. Area: `erp_expenses` (404 while the workspace has not switched on Expenses).'
1740
+ security:
1741
+ - zapierApiKey: []
1742
+ parameters:
1743
+ - *id007
1744
+ - *id008
1745
+ responses:
1746
+ '200':
1747
+ description: OK
1748
+ content:
1749
+ application/json:
1750
+ schema:
1751
+ type: object
1752
+ properties:
1753
+ success:
1754
+ const: true
1755
+ data:
1756
+ type: array
1757
+ items:
1758
+ $ref: '#/components/schemas/ExpenseCategory'
1759
+ meta:
1760
+ $ref: '#/components/schemas/PageMeta'
1761
+ '401': *id001
1762
+ '403': *id002
1763
+ '404': *id003
1764
+ '422': *id004
1765
+ '429': *id005
1766
+ /expenses:
1767
+ get:
1768
+ operationId: erpListExpenses
1769
+ summary: List expenses
1770
+ tags:
1771
+ - Expenses
1772
+ description: 'Scope: `erp`. Area: `erp_expenses` (404 while the workspace has not switched on Expenses).'
1773
+ security:
1774
+ - zapierApiKey: []
1775
+ parameters:
1776
+ - *id007
1777
+ - *id008
1778
+ - name: status
1779
+ in: query
1780
+ required: false
1781
+ description: Comma list
1782
+ schema:
1783
+ type: string
1784
+ - name: category_id
1785
+ in: query
1786
+ required: false
1787
+ description: Category
1788
+ schema:
1789
+ type: integer
1790
+ - name: supplier_id
1791
+ in: query
1792
+ required: false
1793
+ description: Supplier
1794
+ schema:
1795
+ type: integer
1796
+ - *id009
1797
+ - *id010
1798
+ - *id011
1799
+ - *id012
1800
+ responses:
1801
+ '200':
1802
+ description: OK
1803
+ content:
1804
+ application/json:
1805
+ schema:
1806
+ type: object
1807
+ properties:
1808
+ success:
1809
+ const: true
1810
+ data:
1811
+ type: array
1812
+ items:
1813
+ $ref: '#/components/schemas/Expense'
1814
+ meta:
1815
+ $ref: '#/components/schemas/PageMeta'
1816
+ '401': *id001
1817
+ '403': *id002
1818
+ '404': *id003
1819
+ '422': *id004
1820
+ '429': *id005
1821
+ post:
1822
+ operationId: erpCreateExpense
1823
+ summary: Create a DRAFT expense
1824
+ tags:
1825
+ - Expenses
1826
+ description: 'Submit / approve / post stay with a person (approval threshold and self-approval rules apply).
1827
+
1828
+
1829
+ Scope: `erp`. Area: `erp_expenses` (404 while the workspace has not switched on Expenses).'
1830
+ security:
1831
+ - zapierApiKey: []
1832
+ parameters:
1833
+ - $ref: '#/components/parameters/IdempotencyKey'
1834
+ responses:
1835
+ '201':
1836
+ description: OK
1837
+ content:
1838
+ application/json:
1839
+ schema:
1840
+ type: object
1841
+ properties:
1842
+ success:
1843
+ const: true
1844
+ data:
1845
+ $ref: '#/components/schemas/Expense'
1846
+ '401': *id001
1847
+ '403': *id002
1848
+ '404': *id003
1849
+ '422': *id004
1850
+ '429': *id005
1851
+ requestBody:
1852
+ required: true
1853
+ content:
1854
+ application/json:
1855
+ schema:
1856
+ type: object
1857
+ required:
1858
+ - description
1859
+ - amount
1860
+ properties:
1861
+ expense_date:
1862
+ type: string
1863
+ format: date
1864
+ category_id: *id013
1865
+ category_code:
1866
+ type: string
1867
+ description:
1868
+ type: string
1869
+ vendor_name:
1870
+ type: string
1871
+ vendor_vat_number:
1872
+ type: string
1873
+ receipt_number:
1874
+ type: string
1875
+ is_tax_invoice:
1876
+ type: boolean
1877
+ currency:
1878
+ type: string
1879
+ fx_rate:
1880
+ type: number
1881
+ amount:
1882
+ type: number
1883
+ description: Total paid incl. VAT
1884
+ vat_amount:
1885
+ type: number
1886
+ paid_from:
1887
+ type: string
1888
+ enum:
1889
+ - cash
1890
+ - bank
1891
+ - card
1892
+ - payable
1893
+ notes:
1894
+ type: string
1895
+ /expenses/{id}:
1896
+ get:
1897
+ operationId: erpGetExpense
1898
+ summary: Get an expense
1899
+ tags:
1900
+ - Expenses
1901
+ description: 'Scope: `erp`. Area: `erp_expenses` (404 while the workspace has not switched on Expenses).'
1902
+ security:
1903
+ - zapierApiKey: []
1904
+ parameters:
1905
+ - *id006
1906
+ responses:
1907
+ '200':
1908
+ description: OK
1909
+ content:
1910
+ application/json:
1911
+ schema:
1912
+ type: object
1913
+ properties:
1914
+ success:
1915
+ const: true
1916
+ data:
1917
+ $ref: '#/components/schemas/Expense'
1918
+ '401': *id001
1919
+ '403': *id002
1920
+ '404': *id003
1921
+ '422': *id004
1922
+ '429': *id005
1923
+ /accounting/accounts:
1924
+ get:
1925
+ operationId: erpListAccounts
1926
+ summary: Chart of accounts
1927
+ tags:
1928
+ - Accounting
1929
+ description: 'Scope: `erp`. Area: `erp_accounting` (404 while the workspace has not switched on Accounting).'
1930
+ security:
1931
+ - zapierApiKey: []
1932
+ parameters:
1933
+ - *id007
1934
+ - *id008
1935
+ - name: type
1936
+ in: query
1937
+ required: false
1938
+ description: Comma list
1939
+ schema:
1940
+ type: string
1941
+ - name: include_inactive
1942
+ in: query
1943
+ required: false
1944
+ description: Also inactive
1945
+ schema:
1946
+ type: boolean
1947
+ responses:
1948
+ '200':
1949
+ description: OK
1950
+ content:
1951
+ application/json:
1952
+ schema:
1953
+ type: object
1954
+ properties:
1955
+ success:
1956
+ const: true
1957
+ data:
1958
+ type: array
1959
+ items:
1960
+ $ref: '#/components/schemas/Account'
1961
+ meta:
1962
+ $ref: '#/components/schemas/PageMeta'
1963
+ '401': *id001
1964
+ '403': *id002
1965
+ '404': *id003
1966
+ '422': *id004
1967
+ '429': *id005
1968
+ /accounting/journal-entries:
1969
+ get:
1970
+ operationId: erpListJournalEntries
1971
+ summary: List journal entries
1972
+ tags:
1973
+ - Accounting
1974
+ description: 'Scope: `erp`. Area: `erp_accounting` (404 while the workspace has not switched on Accounting).'
1975
+ security:
1976
+ - zapierApiKey: []
1977
+ parameters:
1978
+ - *id007
1979
+ - *id008
1980
+ - name: from
1981
+ in: query
1982
+ required: false
1983
+ description: entry_date ≥
1984
+ schema:
1985
+ type: string
1986
+ format: date
1987
+ - name: to
1988
+ in: query
1989
+ required: false
1990
+ description: entry_date ≤
1991
+ schema:
1992
+ type: string
1993
+ format: date
1994
+ - name: kind
1995
+ in: query
1996
+ required: false
1997
+ description: Comma list
1998
+ schema:
1999
+ type: string
2000
+ - name: document_type
2001
+ in: query
2002
+ required: false
2003
+ description: Comma list
2004
+ schema:
2005
+ type: string
2006
+ - name: document_id
2007
+ in: query
2008
+ required: false
2009
+ description: Document
2010
+ schema:
2011
+ type: integer
2012
+ - name: after_id
2013
+ in: query
2014
+ required: false
2015
+ description: Only entries after this id, oldest first
2016
+ schema:
2017
+ type: integer
2018
+ responses:
2019
+ '200':
2020
+ description: OK
2021
+ content:
2022
+ application/json:
2023
+ schema:
2024
+ type: object
2025
+ properties:
2026
+ success:
2027
+ const: true
2028
+ data:
2029
+ type: array
2030
+ items:
2031
+ $ref: '#/components/schemas/JournalEntry'
2032
+ meta:
2033
+ $ref: '#/components/schemas/PageMeta'
2034
+ '401': *id001
2035
+ '403': *id002
2036
+ '404': *id003
2037
+ '422': *id004
2038
+ '429': *id005
2039
+ /accounting/journal-entries/{id}:
2040
+ get:
2041
+ operationId: erpGetJournalEntry
2042
+ summary: Get a journal entry
2043
+ tags:
2044
+ - Accounting
2045
+ description: 'Scope: `erp`. Area: `erp_accounting` (404 while the workspace has not switched on Accounting).'
2046
+ security:
2047
+ - zapierApiKey: []
2048
+ parameters:
2049
+ - *id006
2050
+ responses:
2051
+ '200':
2052
+ description: OK
2053
+ content:
2054
+ application/json:
2055
+ schema:
2056
+ type: object
2057
+ properties:
2058
+ success:
2059
+ const: true
2060
+ data:
2061
+ $ref: '#/components/schemas/JournalEntry'
2062
+ '401': *id001
2063
+ '403': *id002
2064
+ '404': *id003
2065
+ '422': *id004
2066
+ '429': *id005
2067
+ /accounting/reports/profit-and-loss:
2068
+ get:
2069
+ operationId: erpReportProfitAndLoss
2070
+ summary: Profit & loss
2071
+ tags:
2072
+ - Accounting
2073
+ description: 'Scope: `erp`. Area: `erp_accounting` (404 while the workspace has not switched on Accounting).'
2074
+ security:
2075
+ - zapierApiKey: []
2076
+ parameters:
2077
+ - name: from
2078
+ in: query
2079
+ required: false
2080
+ description: 'Default: first day of this month'
2081
+ schema:
2082
+ type: string
2083
+ format: date
2084
+ - name: to
2085
+ in: query
2086
+ required: false
2087
+ description: 'Default: today'
2088
+ schema:
2089
+ type: string
2090
+ format: date
2091
+ - name: branch_id
2092
+ in: query
2093
+ required: false
2094
+ description: Branch
2095
+ schema:
2096
+ type: integer
2097
+ responses:
2098
+ '200':
2099
+ description: OK
2100
+ content:
2101
+ application/json:
2102
+ schema:
2103
+ type: object
2104
+ properties:
2105
+ success:
2106
+ const: true
2107
+ data:
2108
+ $ref: '#/components/schemas/Report'
2109
+ '401': *id001
2110
+ '403': *id002
2111
+ '404': *id003
2112
+ '422': *id004
2113
+ '429': *id005
2114
+ /accounting/reports/balance-sheet:
2115
+ get:
2116
+ operationId: erpReportBalanceSheet
2117
+ summary: Balance sheet
2118
+ tags:
2119
+ - Accounting
2120
+ description: 'Scope: `erp`. Area: `erp_accounting` (404 while the workspace has not switched on Accounting).'
2121
+ security:
2122
+ - zapierApiKey: []
2123
+ parameters:
2124
+ - name: as_of
2125
+ in: query
2126
+ required: false
2127
+ description: 'Default: today'
2128
+ schema:
2129
+ type: string
2130
+ format: date
2131
+ - name: branch_id
2132
+ in: query
2133
+ required: false
2134
+ description: Branch
2135
+ schema:
2136
+ type: integer
2137
+ responses:
2138
+ '200':
2139
+ description: OK
2140
+ content:
2141
+ application/json:
2142
+ schema:
2143
+ type: object
2144
+ properties:
2145
+ success:
2146
+ const: true
2147
+ data:
2148
+ $ref: '#/components/schemas/Report'
2149
+ '401': *id001
2150
+ '403': *id002
2151
+ '404': *id003
2152
+ '422': *id004
2153
+ '429': *id005
2154
+ /accounting/reports/vat:
2155
+ get:
2156
+ operationId: erpReportVat
2157
+ summary: VAT return summary (country layout)
2158
+ tags:
2159
+ - Accounting
2160
+ description: 'Scope: `erp`. Area: `erp_accounting` (404 while the workspace has not switched on Accounting).'
2161
+ security:
2162
+ - zapierApiKey: []
2163
+ parameters:
2164
+ - name: from
2165
+ in: query
2166
+ required: false
2167
+ description: 'Default: first day of this month'
2168
+ schema:
2169
+ type: string
2170
+ format: date
2171
+ - name: to
2172
+ in: query
2173
+ required: false
2174
+ description: 'Default: today'
2175
+ schema:
2176
+ type: string
2177
+ format: date
2178
+ responses:
2179
+ '200':
2180
+ description: OK
2181
+ content:
2182
+ application/json:
2183
+ schema:
2184
+ type: object
2185
+ properties:
2186
+ success:
2187
+ const: true
2188
+ data:
2189
+ $ref: '#/components/schemas/Report'
2190
+ '401': *id001
2191
+ '403': *id002
2192
+ '404': *id003
2193
+ '422': *id004
2194
+ '429': *id005
2195
+ webhooks:
2196
+ invoice.issued:
2197
+ post:
2198
+ operationId: erpWebhookInvoiceIssued
2199
+ summary: invoice.issued
2200
+ requestBody:
2201
+ content:
2202
+ application/json:
2203
+ schema:
2204
+ $ref: '#/components/schemas/WebhookDelivery'
2205
+ responses:
2206
+ '200':
2207
+ description: Received
2208
+ '410':
2209
+ description: Gone — unsubscribes
2210
+ invoice.paid:
2211
+ post:
2212
+ operationId: erpWebhookInvoicePaid
2213
+ summary: invoice.paid
2214
+ requestBody:
2215
+ content:
2216
+ application/json:
2217
+ schema:
2218
+ $ref: '#/components/schemas/WebhookDelivery'
2219
+ responses:
2220
+ '200':
2221
+ description: Received
2222
+ '410':
2223
+ description: Gone — unsubscribes
2224
+ invoice.cleared:
2225
+ post:
2226
+ operationId: erpWebhookInvoiceCleared
2227
+ summary: invoice.cleared
2228
+ requestBody:
2229
+ content:
2230
+ application/json:
2231
+ schema:
2232
+ $ref: '#/components/schemas/WebhookDelivery'
2233
+ responses:
2234
+ '200':
2235
+ description: Received
2236
+ '410':
2237
+ description: Gone — unsubscribes
2238
+ invoice.rejected:
2239
+ post:
2240
+ operationId: erpWebhookInvoiceRejected
2241
+ summary: invoice.rejected
2242
+ requestBody:
2243
+ content:
2244
+ application/json:
2245
+ schema:
2246
+ $ref: '#/components/schemas/WebhookDelivery'
2247
+ responses:
2248
+ '200':
2249
+ description: Received
2250
+ '410':
2251
+ description: Gone — unsubscribes
2252
+ credit_note.issued:
2253
+ post:
2254
+ operationId: erpWebhookCreditNoteIssued
2255
+ summary: credit_note.issued
2256
+ requestBody:
2257
+ content:
2258
+ application/json:
2259
+ schema:
2260
+ $ref: '#/components/schemas/WebhookDelivery'
2261
+ responses:
2262
+ '200':
2263
+ description: Received
2264
+ '410':
2265
+ description: Gone — unsubscribes
2266
+ payment.received:
2267
+ post:
2268
+ operationId: erpWebhookPaymentReceived
2269
+ summary: payment.received
2270
+ requestBody:
2271
+ content:
2272
+ application/json:
2273
+ schema:
2274
+ $ref: '#/components/schemas/WebhookDelivery'
2275
+ responses:
2276
+ '200':
2277
+ description: Received
2278
+ '410':
2279
+ description: Gone — unsubscribes
2280
+ order.confirmed:
2281
+ post:
2282
+ operationId: erpWebhookOrderConfirmed
2283
+ summary: order.confirmed
2284
+ requestBody:
2285
+ content:
2286
+ application/json:
2287
+ schema:
2288
+ $ref: '#/components/schemas/WebhookDelivery'
2289
+ responses:
2290
+ '200':
2291
+ description: Received
2292
+ '410':
2293
+ description: Gone — unsubscribes
2294
+ stock.low:
2295
+ post:
2296
+ operationId: erpWebhookStockLow
2297
+ summary: stock.low
2298
+ requestBody:
2299
+ content:
2300
+ application/json:
2301
+ schema:
2302
+ $ref: '#/components/schemas/WebhookDelivery'
2303
+ responses:
2304
+ '200':
2305
+ description: Received
2306
+ '410':
2307
+ description: Gone — unsubscribes
2308
+ po.confirmed_by_supplier:
2309
+ post:
2310
+ operationId: erpWebhookPoConfirmedBySupplier
2311
+ summary: po.confirmed_by_supplier
2312
+ requestBody:
2313
+ content:
2314
+ application/json:
2315
+ schema:
2316
+ $ref: '#/components/schemas/WebhookDelivery'
2317
+ responses:
2318
+ '200':
2319
+ description: Received
2320
+ '410':
2321
+ description: Gone — unsubscribes
2322
+ expense.posted:
2323
+ post:
2324
+ operationId: erpWebhookExpensePosted
2325
+ summary: expense.posted
2326
+ requestBody:
2327
+ content:
2328
+ application/json:
2329
+ schema:
2330
+ $ref: '#/components/schemas/WebhookDelivery'
2331
+ responses:
2332
+ '200':
2333
+ description: Received
2334
+ '410':
2335
+ description: Gone — unsubscribes
2336
+ components:
2337
+ securitySchemes:
2338
+ zapierApiKey:
2339
+ type: apiKey
2340
+ in: header
2341
+ name: X-Zapier-Api-Key
2342
+ parameters:
2343
+ Page:
2344
+ name: page
2345
+ in: query
2346
+ required: false
2347
+ description: Page (1-based)
2348
+ schema:
2349
+ type: integer
2350
+ minimum: 1
2351
+ PerPage:
2352
+ name: per_page
2353
+ in: query
2354
+ required: false
2355
+ description: 1–100 (default 25)
2356
+ schema:
2357
+ type: integer
2358
+ minimum: 1
2359
+ maximum: 100
2360
+ UpdatedSince:
2361
+ name: updated_since
2362
+ in: query
2363
+ required: false
2364
+ description: ISO-8601
2365
+ schema:
2366
+ type: string
2367
+ format: date-time
2368
+ CreatedSince:
2369
+ name: created_since
2370
+ in: query
2371
+ required: false
2372
+ description: ISO-8601
2373
+ schema:
2374
+ type: string
2375
+ format: date-time
2376
+ Sort:
2377
+ name: sort
2378
+ in: query
2379
+ required: false
2380
+ description: Sort key (per endpoint)
2381
+ schema:
2382
+ type: string
2383
+ Dir:
2384
+ name: dir
2385
+ in: query
2386
+ required: false
2387
+ description: asc|desc
2388
+ schema:
2389
+ type: string
2390
+ enum:
2391
+ - asc
2392
+ - desc
2393
+ IdempotencyKey:
2394
+ name: Idempotency-Key
2395
+ in: header
2396
+ required: false
2397
+ description: Optional. Same key + same body within 24 h replays the first answer; same key + another body → 422 idempotency_key_reused.
2398
+ schema:
2399
+ type: string
2400
+ maxLength: 255
2401
+ responses:
2402
+ Unauthorized:
2403
+ description: Missing or invalid API key
2404
+ content:
2405
+ application/json:
2406
+ schema:
2407
+ $ref: '#/components/schemas/Error'
2408
+ MissingScope:
2409
+ description: The key does not list the `erp` scope
2410
+ content:
2411
+ application/json:
2412
+ schema:
2413
+ $ref: '#/components/schemas/Error'
2414
+ NotFound:
2415
+ description: Unknown record, or the area is not switched on for this workspace
2416
+ content:
2417
+ application/json:
2418
+ schema:
2419
+ $ref: '#/components/schemas/Error'
2420
+ Unprocessable:
2421
+ description: Validation failed or the ERP engine refused (code = reason)
2422
+ content:
2423
+ application/json:
2424
+ schema:
2425
+ $ref: '#/components/schemas/Error'
2426
+ TooManyRequests:
2427
+ description: Rate limit
2428
+ content:
2429
+ application/json:
2430
+ schema:
2431
+ $ref: '#/components/schemas/Error'
2432
+ schemas:
2433
+ Error:
2434
+ type: object
2435
+ required:
2436
+ - success
2437
+ - error
2438
+ - code
2439
+ properties:
2440
+ success:
2441
+ const: false
2442
+ error:
2443
+ type: string
2444
+ description: Human message that states the fix.
2445
+ code:
2446
+ type: string
2447
+ description: 'Machine code: not_found, missing_scope, validation_failed, idempotency_key_reused, idempotency_request_in_progress, or the ERP engine reason (e.g. credit_limit_exceeded, buyer_incomplete,
2448
+ insufficient_available, variant_unknown, supplier_required, vat_exceeds_amount).'
2449
+ errors:
2450
+ type: object
2451
+ additionalProperties:
2452
+ type: array
2453
+ items:
2454
+ type: string
2455
+ params:
2456
+ type: object
2457
+ additionalProperties: true
2458
+ PageMeta:
2459
+ type: object
2460
+ properties:
2461
+ current_page: *id013
2462
+ last_page: *id013
2463
+ per_page: *id013
2464
+ total: *id013
2465
+ Money: &id018
2466
+ type: string
2467
+ pattern: ^-?\d+\.\d{4}$
2468
+ example: '1150.0000'
2469
+ Item:
2470
+ type: object
2471
+ properties:
2472
+ id: *id013
2473
+ sku: &id017
2474
+ type:
2475
+ - string
2476
+ - 'null'
2477
+ name:
2478
+ type: string
2479
+ name_en: *id017
2480
+ type:
2481
+ type: string
2482
+ enum:
2483
+ - stock
2484
+ - service
2485
+ - kit
2486
+ - consumable
2487
+ category_id: &id019
2488
+ type:
2489
+ - integer
2490
+ - 'null'
2491
+ sale_price: *id018
2492
+ price_includes_tax:
2493
+ type: boolean
2494
+ currency: *id017
2495
+ tracking:
2496
+ type: string
2497
+ has_expiry:
2498
+ type: boolean
2499
+ crm_product_id: *id019
2500
+ status:
2501
+ type: string
2502
+ created_at: &id020
2503
+ type:
2504
+ - string
2505
+ - 'null'
2506
+ format: date-time
2507
+ updated_at: *id020
2508
+ variants:
2509
+ type: array
2510
+ items:
2511
+ $ref: '#/components/schemas/Variant'
2512
+ Variant:
2513
+ type: object
2514
+ properties:
2515
+ id: *id013
2516
+ item_id: *id013
2517
+ sku: *id017
2518
+ name: *id017
2519
+ option_values: {}
2520
+ sale_price: *id018
2521
+ is_default:
2522
+ type: boolean
2523
+ status:
2524
+ type: string
2525
+ item:
2526
+ type: object
2527
+ Warehouse:
2528
+ type: object
2529
+ properties:
2530
+ id: *id013
2531
+ code:
2532
+ type: string
2533
+ name:
2534
+ type: string
2535
+ name_en: *id017
2536
+ kind:
2537
+ type: string
2538
+ is_sellable:
2539
+ type: boolean
2540
+ is_channel_default:
2541
+ type: boolean
2542
+ branch_id: *id019
2543
+ status:
2544
+ type: string
2545
+ StockLevel:
2546
+ type: object
2547
+ properties:
2548
+ variant_id: *id013
2549
+ sku: *id017
2550
+ warehouse_id: *id013
2551
+ warehouse_code:
2552
+ type: string
2553
+ warehouse_sellable:
2554
+ type: boolean
2555
+ on_hand: *id018
2556
+ reserved: *id018
2557
+ available: *id018
2558
+ updated_at: *id020
2559
+ StockMove:
2560
+ type: object
2561
+ description: Append-only ledger row (never cost).
2562
+ properties:
2563
+ id: *id013
2564
+ moved_at: *id020
2565
+ variant_id: *id013
2566
+ warehouse_id: *id013
2567
+ lot_id: *id019
2568
+ qty: *id018
2569
+ qty_after_warehouse:
2570
+ type:
2571
+ - string
2572
+ - 'null'
2573
+ move_type:
2574
+ type: string
2575
+ document_type: *id017
2576
+ document_id: *id019
2577
+ document_number: *id017
2578
+ reason_code: *id017
2579
+ group_uid: *id017
2580
+ reverses_move_id: *id019
2581
+ source: *id017
2582
+ Customer:
2583
+ type: object
2584
+ properties:
2585
+ id: *id013
2586
+ contact_id: *id019
2587
+ company_id: *id019
2588
+ party_type: *id017
2589
+ display_name: *id017
2590
+ legal_name: *id017
2591
+ legal_name_en: *id017
2592
+ vat_number: *id017
2593
+ cr_number: *id017
2594
+ address:
2595
+ type:
2596
+ - object
2597
+ - 'null'
2598
+ credit_limit:
2599
+ type:
2600
+ - string
2601
+ - 'null'
2602
+ payment_terms_days: *id019
2603
+ currency: *id017
2604
+ tax_exempt:
2605
+ type: boolean
2606
+ archived:
2607
+ type: boolean
2608
+ created_at: *id020
2609
+ updated_at: *id020
2610
+ Statement:
2611
+ type: object
2612
+ properties:
2613
+ customer:
2614
+ $ref: '#/components/schemas/Customer'
2615
+ from:
2616
+ type: string
2617
+ format: date
2618
+ to:
2619
+ type: string
2620
+ format: date
2621
+ currencies:
2622
+ type: array
2623
+ items:
2624
+ type: object
2625
+ properties:
2626
+ currency:
2627
+ type: string
2628
+ opening: *id018
2629
+ closing: *id018
2630
+ debit: *id018
2631
+ credit: *id018
2632
+ rows:
2633
+ type: array
2634
+ items:
2635
+ type: object
2636
+ pdf_url:
2637
+ type:
2638
+ - string
2639
+ - 'null'
2640
+ format: uri
2641
+ SalesOrder:
2642
+ type: object
2643
+ properties:
2644
+ id: *id013
2645
+ number: *id017
2646
+ status:
2647
+ type: string
2648
+ enum:
2649
+ - draft
2650
+ - confirmed
2651
+ - partially_delivered
2652
+ - delivered
2653
+ - invoiced
2654
+ - closed
2655
+ - cancelled
2656
+ delivery_status: *id017
2657
+ invoice_status: *id017
2658
+ review_status: *id017
2659
+ source: *id017
2660
+ customer_id: *id019
2661
+ contact_id: *id019
2662
+ company_id: *id019
2663
+ deal_id: *id019
2664
+ warehouse_id: *id019
2665
+ currency:
2666
+ type: string
2667
+ prices_include_tax:
2668
+ type: boolean
2669
+ subtotal: *id018
2670
+ discount_total: *id018
2671
+ tax_total: *id018
2672
+ total: *id018
2673
+ payment_method: *id017
2674
+ payment_terms_days: *id019
2675
+ delivery_date: &id021
2676
+ type:
2677
+ - string
2678
+ - 'null'
2679
+ format: date
2680
+ notes: *id017
2681
+ confirmed_at: *id020
2682
+ cancelled_at: *id020
2683
+ created_at: *id020
2684
+ updated_at: *id020
2685
+ lines:
2686
+ type:
2687
+ - array
2688
+ - 'null'
2689
+ items:
2690
+ type: object
2691
+ Invoice:
2692
+ type: object
2693
+ description: Invoice, simplified invoice, debit note or credit note.
2694
+ properties:
2695
+ id: *id013
2696
+ number: *id017
2697
+ doc_type:
2698
+ type: string
2699
+ enum:
2700
+ - tax
2701
+ - simplified
2702
+ - credit_note
2703
+ - debit_note
2704
+ status:
2705
+ type: string
2706
+ einvoice_status:
2707
+ type: string
2708
+ description: not_required, pending, cleared, reported, warning, rejected, failed (ZATCA) / ETA states.
2709
+ order_id: *id019
2710
+ original_invoice_id: *id019
2711
+ adjustment_reason: *id017
2712
+ customer_id: *id019
2713
+ contact_id: *id019
2714
+ company_id: *id019
2715
+ deal_id: *id019
2716
+ buyer:
2717
+ type:
2718
+ - object
2719
+ - 'null'
2720
+ currency:
2721
+ type: string
2722
+ issue_date: *id021
2723
+ supply_date: *id021
2724
+ due_date: *id021
2725
+ prices_include_tax:
2726
+ type: boolean
2727
+ subtotal: *id018
2728
+ discount_total: *id018
2729
+ tax_total: *id018
2730
+ total: *id018
2731
+ amount_paid: *id018
2732
+ amount_credited: *id018
2733
+ balance_due: *id018
2734
+ uuid: *id017
2735
+ share_blocked_reason: *id017
2736
+ issued_at: *id020
2737
+ created_at: *id020
2738
+ updated_at: *id020
2739
+ lines:
2740
+ type:
2741
+ - array
2742
+ - 'null'
2743
+ items:
2744
+ type: object
2745
+ InvoiceLinks:
2746
+ type: object
2747
+ properties:
2748
+ id: *id013
2749
+ number: *id017
2750
+ available:
2751
+ type: boolean
2752
+ blocked_reason:
2753
+ type:
2754
+ - string
2755
+ - 'null'
2756
+ description: not_issued, einvoice_pending, … — the link appears once the invoice may be shared.
2757
+ pdf_url:
2758
+ type:
2759
+ - string
2760
+ - 'null'
2761
+ format: uri
2762
+ page_url:
2763
+ type:
2764
+ - string
2765
+ - 'null'
2766
+ format: uri
2767
+ Payment:
2768
+ type: object
2769
+ properties:
2770
+ id: *id013
2771
+ number: *id017
2772
+ direction:
2773
+ type: string
2774
+ enum:
2775
+ - in
2776
+ - out
2777
+ method:
2778
+ type: string
2779
+ status:
2780
+ type: string
2781
+ source: *id017
2782
+ customer_id: *id019
2783
+ contact_id: *id019
2784
+ amount: *id018
2785
+ allocated: *id018
2786
+ unallocated: *id018
2787
+ currency:
2788
+ type: string
2789
+ received_at: *id020
2790
+ provider: *id017
2791
+ provider_payment_id: *id017
2792
+ reference: *id017
2793
+ reverses_payment_id: *id019
2794
+ allocations:
2795
+ type:
2796
+ - array
2797
+ - 'null'
2798
+ items:
2799
+ type: object
2800
+ properties:
2801
+ kind:
2802
+ type: string
2803
+ invoice_id: *id019
2804
+ credit_note_id: *id019
2805
+ amount: *id018
2806
+ created_at: *id020
2807
+ Supplier:
2808
+ type: object
2809
+ properties:
2810
+ id: *id013
2811
+ code: *id017
2812
+ name:
2813
+ type: string
2814
+ legal_name: *id017
2815
+ legal_name_en: *id017
2816
+ contact_id: *id019
2817
+ company_id: *id019
2818
+ vat_number: *id017
2819
+ cr_number: *id017
2820
+ address:
2821
+ type:
2822
+ - object
2823
+ - 'null'
2824
+ whatsapp_phone: *id017
2825
+ email: *id017
2826
+ currency: *id017
2827
+ payment_terms_days: *id019
2828
+ lead_time_days: *id019
2829
+ status:
2830
+ type: string
2831
+ created_at: *id020
2832
+ updated_at: *id020
2833
+ PurchaseOrder:
2834
+ type: object
2835
+ properties:
2836
+ id: *id013
2837
+ number: *id017
2838
+ status:
2839
+ type: string
2840
+ approval_status: *id017
2841
+ receipt_status: *id017
2842
+ billing_status: *id017
2843
+ supplier_reply: *id017
2844
+ supplier_reply_at: *id020
2845
+ supplier_id: *id013
2846
+ warehouse_id: *id019
2847
+ order_date: *id021
2848
+ expected_date: *id021
2849
+ payment_terms_days: *id019
2850
+ currency:
2851
+ type: string
2852
+ subtotal: *id018
2853
+ tax_total: *id018
2854
+ total: *id018
2855
+ source: *id017
2856
+ notes: *id017
2857
+ sent_at: *id020
2858
+ created_at: *id020
2859
+ updated_at: *id020
2860
+ lines:
2861
+ type:
2862
+ - array
2863
+ - 'null'
2864
+ items:
2865
+ type: object
2866
+ Bill:
2867
+ type: object
2868
+ properties:
2869
+ id: *id013
2870
+ number: *id017
2871
+ status:
2872
+ type: string
2873
+ kind:
2874
+ type: string
2875
+ supplier_id: *id013
2876
+ purchase_order_id: *id019
2877
+ supplier_invoice_no: *id017
2878
+ bill_date: *id021
2879
+ due_date: *id021
2880
+ currency:
2881
+ type: string
2882
+ subtotal: *id018
2883
+ tax_total: *id018
2884
+ total: *id018
2885
+ amount_paid: *id018
2886
+ balance_due: *id018
2887
+ match_status: *id017
2888
+ posted_at: *id020
2889
+ created_at: *id020
2890
+ updated_at: *id020
2891
+ lines:
2892
+ type:
2893
+ - array
2894
+ - 'null'
2895
+ items:
2896
+ type: object
2897
+ Expense:
2898
+ type: object
2899
+ properties:
2900
+ id: *id013
2901
+ number: *id017
2902
+ status:
2903
+ type: string
2904
+ enum:
2905
+ - draft
2906
+ - pending_approval
2907
+ - posted
2908
+ - rejected
2909
+ - void
2910
+ source: *id017
2911
+ expense_date: *id021
2912
+ category_id: *id019
2913
+ category_code: *id017
2914
+ description: *id017
2915
+ vendor_name: *id017
2916
+ vendor_vat_number: *id017
2917
+ supplier_id: *id019
2918
+ receipt_number: *id017
2919
+ is_tax_invoice:
2920
+ type: boolean
2921
+ currency:
2922
+ type: string
2923
+ amount:
2924
+ type:
2925
+ - string
2926
+ - 'null'
2927
+ vat_amount: *id018
2928
+ net_amount:
2929
+ type:
2930
+ - string
2931
+ - 'null'
2932
+ vat_recoverable:
2933
+ type: boolean
2934
+ paid_from: *id017
2935
+ branch_id: *id019
2936
+ journal_entry_id: *id019
2937
+ notes: *id017
2938
+ approved_at: *id020
2939
+ created_at: *id020
2940
+ updated_at: *id020
2941
+ ExpenseCategory:
2942
+ type: object
2943
+ properties:
2944
+ id: *id013
2945
+ code:
2946
+ type: string
2947
+ name:
2948
+ type: string
2949
+ name_en: *id017
2950
+ parent_id: *id019
2951
+ vat_applicable:
2952
+ type: boolean
2953
+ Account:
2954
+ type: object
2955
+ properties:
2956
+ id: *id013
2957
+ code:
2958
+ type: string
2959
+ name:
2960
+ type: string
2961
+ name_en: *id017
2962
+ type:
2963
+ type: string
2964
+ subtype: *id017
2965
+ parent_id: *id019
2966
+ is_group:
2967
+ type: boolean
2968
+ currency: *id017
2969
+ is_active:
2970
+ type: boolean
2971
+ JournalEntry:
2972
+ type: object
2973
+ description: Append-only; corrections are reversing entries.
2974
+ properties:
2975
+ id: *id013
2976
+ number: *id017
2977
+ entry_date: *id021
2978
+ kind: *id017
2979
+ status: *id017
2980
+ rule: *id017
2981
+ document_type: *id017
2982
+ document_id: *id019
2983
+ document_number: *id017
2984
+ reverses_entry_id: *id019
2985
+ reversed_by_entry_id: *id019
2986
+ currency: *id017
2987
+ total_debit: *id018
2988
+ total_credit: *id018
2989
+ memo: *id017
2990
+ source: *id017
2991
+ posted_at: *id020
2992
+ lines:
2993
+ type:
2994
+ - array
2995
+ - 'null'
2996
+ items:
2997
+ type: object
2998
+ Report:
2999
+ type: object
3000
+ additionalProperties: true
3001
+ description: Report body as built by the accounting engine (sections, rows, totals as 4-dp strings).
3002
+ Hook:
3003
+ type: object
3004
+ properties:
3005
+ id: *id013
3006
+ url:
3007
+ type: string
3008
+ events:
3009
+ type: array
3010
+ items:
3011
+ type: string
3012
+ source:
3013
+ type: string
3014
+ description: *id017
3015
+ is_active:
3016
+ type: boolean
3017
+ disabled_reason: *id017
3018
+ created_at: *id020
3019
+ secret:
3020
+ type: string
3021
+ description: whsec_… — only in the subscribe answer; signs every delivery.
3022
+ HookEvent:
3023
+ type: object
3024
+ properties:
3025
+ event:
3026
+ type: string
3027
+ enum:
3028
+ - invoice.issued
3029
+ - invoice.paid
3030
+ - invoice.cleared
3031
+ - invoice.rejected
3032
+ - credit_note.issued
3033
+ - payment.received
3034
+ - order.confirmed
3035
+ - stock.low
3036
+ - po.confirmed_by_supplier
3037
+ - expense.posted
3038
+ object:
3039
+ type: string
3040
+ area:
3041
+ type: string
3042
+ available:
3043
+ type: boolean
3044
+ WebhookDelivery:
3045
+ type: object
3046
+ description: 'Body POSTed to the subscriber. Headers: X-LetsBot-Event, X-LetsBot-Delivery, X-LetsBot-Signature: t=<unix>,v1=<hex HMAC-SHA256 of "<t>.<body>" with the subscription secret>. Answer 2xx;
3047
+ 410 unsubscribes.'
3048
+ properties:
3049
+ id:
3050
+ type: string
3051
+ event:
3052
+ type: string
3053
+ object:
3054
+ type: string
3055
+ record_id: *id019
3056
+ occurred_at:
3057
+ type: string
3058
+ format: date-time
3059
+ data:
3060
+ type: object
3061
+ previous:
3062
+ type: object
3063
+ LineIn:
3064
+ type: object
3065
+ required:
3066
+ - qty
3067
+ description: variant_id or sku (inventory), crm_product_id, or free text name + unit_price. Client totals are ignored.
3068
+ properties:
3069
+ variant_id: *id013
3070
+ sku:
3071
+ type: string
3072
+ crm_product_id: *id013
3073
+ name:
3074
+ type: string
3075
+ name_en:
3076
+ type: string
3077
+ description:
3078
+ type: string
3079
+ qty:
3080
+ type: number
3081
+ exclusiveMinimum: 0
3082
+ unit_price:
3083
+ type: number
3084
+ minimum: 0
3085
+ discount_pct:
3086
+ type: number
3087
+ discount_amount:
3088
+ type: number
3089
+ tax_rate:
3090
+ type: number