@l4yercak3/cli 1.0.6 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1197 @@
1
+ # L4YERCAK3 CLI - API Reference
2
+
3
+ Complete reference for all backend APIs available via CLI.
4
+
5
+ ---
6
+
7
+ ## Authentication
8
+
9
+ ### CLI Session Management
10
+
11
+ | Endpoint | Method | Description |
12
+ |----------|--------|-------------|
13
+ | `/api/v1/auth/cli/validate` | GET | Validate CLI session token |
14
+ | `/api/v1/auth/cli/refresh` | POST | Refresh CLI session token |
15
+ | `/auth/cli-login` | GET | Browser OAuth login page |
16
+ | `/api/auth/oauth-signup` | GET | Direct OAuth provider redirect |
17
+
18
+ **CLI Session Token Format:** `cli_session_{64_hex_chars}`
19
+
20
+ **Session Lifetime:** 30 days
21
+
22
+ ---
23
+
24
+ ## Organizations
25
+
26
+ ### List Organizations
27
+ ```
28
+ GET /api/v1/organizations
29
+ Authorization: Bearer {cli_token}
30
+ ```
31
+
32
+ Response:
33
+ ```json
34
+ {
35
+ "organizations": [
36
+ {
37
+ "id": "org_xxx",
38
+ "name": "My Company",
39
+ "slug": "my-company",
40
+ "planTier": "starter"
41
+ }
42
+ ]
43
+ }
44
+ ```
45
+
46
+ ### Create Organization
47
+ ```
48
+ POST /api/v1/organizations
49
+ Authorization: Bearer {cli_token}
50
+
51
+ {
52
+ "name": "New Organization"
53
+ }
54
+ ```
55
+
56
+ ---
57
+
58
+ ## API Keys
59
+
60
+ ### List API Keys
61
+ ```
62
+ GET /api/v1/api-keys/list?organizationId={org_id}
63
+ Authorization: Bearer {cli_token}
64
+ ```
65
+
66
+ Response:
67
+ ```json
68
+ {
69
+ "keys": [
70
+ {
71
+ "id": "key_xxx",
72
+ "name": "CLI Generated Key",
73
+ "keyPreview": "sk_live_xxx...",
74
+ "scopes": ["*"],
75
+ "status": "active",
76
+ "createdAt": 1704067200000
77
+ }
78
+ ],
79
+ "limit": 3,
80
+ "currentCount": 1,
81
+ "canCreateMore": true,
82
+ "limitDescription": "1/3"
83
+ }
84
+ ```
85
+
86
+ ### Generate API Key
87
+ ```
88
+ POST /api/v1/api-keys/generate
89
+ Authorization: Bearer {cli_token}
90
+
91
+ {
92
+ "organizationId": "org_xxx",
93
+ "name": "Production API Key",
94
+ "scopes": ["*"]
95
+ }
96
+ ```
97
+
98
+ Response:
99
+ ```json
100
+ {
101
+ "id": "key_xxx",
102
+ "key": "sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
103
+ "name": "Production API Key",
104
+ "scopes": ["*"],
105
+ "createdAt": 1704067200000
106
+ }
107
+ ```
108
+
109
+ ---
110
+
111
+ ## CRM - Contacts
112
+
113
+ ### List Contacts
114
+ ```
115
+ GET /api/v1/crm/contacts?organizationId={org_id}&limit=50&offset=0
116
+ Authorization: Bearer {api_key}
117
+ ```
118
+
119
+ Response:
120
+ ```json
121
+ {
122
+ "contacts": [
123
+ {
124
+ "id": "obj_xxx",
125
+ "type": "contact",
126
+ "displayName": "John Doe",
127
+ "customProperties": {
128
+ "email": "john@example.com",
129
+ "phone": "+1234567890",
130
+ "company": "Acme Corp"
131
+ },
132
+ "createdAt": 1704067200000,
133
+ "updatedAt": 1704067200000
134
+ }
135
+ ],
136
+ "total": 150,
137
+ "hasMore": true
138
+ }
139
+ ```
140
+
141
+ ### Create Contact
142
+ ```
143
+ POST /api/v1/crm/contacts
144
+ Authorization: Bearer {api_key}
145
+
146
+ {
147
+ "organizationId": "org_xxx",
148
+ "displayName": "Jane Smith",
149
+ "email": "jane@example.com",
150
+ "phone": "+1234567890",
151
+ "company": "Acme Corp",
152
+ "customFields": {
153
+ "department": "Engineering"
154
+ }
155
+ }
156
+ ```
157
+
158
+ ### Get Contact
159
+ ```
160
+ GET /api/v1/crm/contacts/{contactId}
161
+ Authorization: Bearer {api_key}
162
+ ```
163
+
164
+ ### Update Contact
165
+ ```
166
+ PATCH /api/v1/crm/contacts/{contactId}
167
+ Authorization: Bearer {api_key}
168
+
169
+ {
170
+ "displayName": "Jane Doe",
171
+ "customFields": {
172
+ "title": "Senior Engineer"
173
+ }
174
+ }
175
+ ```
176
+
177
+ ### Delete Contact
178
+ ```
179
+ DELETE /api/v1/crm/contacts/{contactId}
180
+ Authorization: Bearer {api_key}
181
+ ```
182
+
183
+ ### Create Contact from Event Registration
184
+ ```
185
+ POST /api/v1/crm/contacts/from-event
186
+ Authorization: Bearer {api_key}
187
+
188
+ {
189
+ "organizationId": "org_xxx",
190
+ "eventId": "obj_event_xxx",
191
+ "attendeeData": {
192
+ "email": "attendee@example.com",
193
+ "firstName": "John",
194
+ "lastName": "Doe"
195
+ }
196
+ }
197
+ ```
198
+
199
+ ---
200
+
201
+ ## CRM - Organizations
202
+
203
+ ### List CRM Organizations
204
+ ```
205
+ GET /api/v1/crm/organizations?organizationId={org_id}
206
+ Authorization: Bearer {api_key}
207
+ ```
208
+
209
+ ### Create CRM Organization
210
+ ```
211
+ POST /api/v1/crm/organizations
212
+ Authorization: Bearer {api_key}
213
+
214
+ {
215
+ "organizationId": "org_xxx",
216
+ "name": "Client Company Inc",
217
+ "website": "https://clientcompany.com",
218
+ "industry": "Technology",
219
+ "taxId": "DE123456789"
220
+ }
221
+ ```
222
+
223
+ ---
224
+
225
+ ## Events
226
+
227
+ ### List Events
228
+ ```
229
+ GET /api/v1/events?organizationId={org_id}&status=published
230
+ Authorization: Bearer {api_key}
231
+ ```
232
+
233
+ Response:
234
+ ```json
235
+ {
236
+ "events": [
237
+ {
238
+ "id": "obj_xxx",
239
+ "type": "event",
240
+ "subtype": "conference",
241
+ "status": "published",
242
+ "displayName": "Tech Conference 2025",
243
+ "customProperties": {
244
+ "startDate": "2025-06-15T09:00:00Z",
245
+ "endDate": "2025-06-17T18:00:00Z",
246
+ "location": "Berlin, Germany",
247
+ "capacity": 500,
248
+ "registeredCount": 342
249
+ }
250
+ }
251
+ ]
252
+ }
253
+ ```
254
+
255
+ ### Create Event
256
+ ```
257
+ POST /api/v1/events
258
+ Authorization: Bearer {api_key}
259
+
260
+ {
261
+ "organizationId": "org_xxx",
262
+ "name": "Product Launch 2025",
263
+ "subtype": "conference",
264
+ "startDate": "2025-06-15T09:00:00Z",
265
+ "endDate": "2025-06-15T18:00:00Z",
266
+ "location": "Berlin",
267
+ "capacity": 200,
268
+ "description": "Annual product launch event"
269
+ }
270
+ ```
271
+
272
+ ### Get Event
273
+ ```
274
+ GET /api/v1/events/{eventId}
275
+ Authorization: Bearer {api_key}
276
+ ```
277
+
278
+ ### Update Event
279
+ ```
280
+ PATCH /api/v1/events/{eventId}
281
+ Authorization: Bearer {api_key}
282
+
283
+ {
284
+ "status": "published",
285
+ "capacity": 300
286
+ }
287
+ ```
288
+
289
+ ### Delete Event
290
+ ```
291
+ DELETE /api/v1/events/{eventId}
292
+ Authorization: Bearer {api_key}
293
+ ```
294
+
295
+ ---
296
+
297
+ ## Products
298
+
299
+ ### List Products
300
+ ```
301
+ GET /api/v1/products?organizationId={org_id}
302
+ Authorization: Bearer {api_key}
303
+ ```
304
+
305
+ Response:
306
+ ```json
307
+ {
308
+ "products": [
309
+ {
310
+ "id": "obj_xxx",
311
+ "type": "product",
312
+ "subtype": "ticket",
313
+ "status": "active",
314
+ "displayName": "Early Bird Ticket",
315
+ "customProperties": {
316
+ "price": 19900,
317
+ "currency": "EUR",
318
+ "quantity": 100,
319
+ "sold": 45,
320
+ "linkedEventId": "obj_event_xxx"
321
+ }
322
+ }
323
+ ]
324
+ }
325
+ ```
326
+
327
+ ### Create Product
328
+ ```
329
+ POST /api/v1/products
330
+ Authorization: Bearer {api_key}
331
+
332
+ {
333
+ "organizationId": "org_xxx",
334
+ "name": "VIP Ticket",
335
+ "subtype": "ticket",
336
+ "price": 49900,
337
+ "currency": "EUR",
338
+ "quantity": 50,
339
+ "linkedEventId": "obj_xxx",
340
+ "description": "VIP access with backstage pass"
341
+ }
342
+ ```
343
+
344
+ ### Get Product
345
+ ```
346
+ GET /api/v1/products/{productId}
347
+ Authorization: Bearer {api_key}
348
+ ```
349
+
350
+ ### Update Product
351
+ ```
352
+ PATCH /api/v1/products/{productId}
353
+ Authorization: Bearer {api_key}
354
+
355
+ {
356
+ "price": 39900,
357
+ "status": "active"
358
+ }
359
+ ```
360
+
361
+ ### Delete Product
362
+ ```
363
+ DELETE /api/v1/products/{productId}
364
+ Authorization: Bearer {api_key}
365
+ ```
366
+
367
+ ---
368
+
369
+ ## Tickets
370
+
371
+ ### List Tickets
372
+ ```
373
+ GET /api/v1/tickets?organizationId={org_id}&eventId={event_id}
374
+ Authorization: Bearer {api_key}
375
+ ```
376
+
377
+ Response:
378
+ ```json
379
+ {
380
+ "tickets": [
381
+ {
382
+ "id": "obj_xxx",
383
+ "type": "ticket",
384
+ "status": "valid",
385
+ "displayName": "Ticket #001",
386
+ "customProperties": {
387
+ "qrCode": "TKT-ABC123-XYZ",
388
+ "attendeeName": "John Doe",
389
+ "attendeeEmail": "john@example.com",
390
+ "productId": "obj_product_xxx",
391
+ "eventId": "obj_event_xxx",
392
+ "checkedIn": false,
393
+ "checkedInAt": null
394
+ }
395
+ }
396
+ ]
397
+ }
398
+ ```
399
+
400
+ ### Generate Ticket
401
+ ```
402
+ POST /api/v1/tickets
403
+ Authorization: Bearer {api_key}
404
+
405
+ {
406
+ "organizationId": "org_xxx",
407
+ "productId": "obj_xxx",
408
+ "eventId": "obj_xxx",
409
+ "attendeeName": "Jane Doe",
410
+ "attendeeEmail": "jane@example.com",
411
+ "formResponseData": {
412
+ "dietaryRequirements": "vegetarian"
413
+ }
414
+ }
415
+ ```
416
+
417
+ ### Redeem Ticket (Check-in)
418
+ ```
419
+ POST /api/v1/tickets/{ticketId}/redeem
420
+ Authorization: Bearer {api_key}
421
+ ```
422
+
423
+ ### Get Ticket PDF
424
+ ```
425
+ GET /api/v1/tickets/{ticketId}/pdf
426
+ Authorization: Bearer {api_key}
427
+
428
+ Response: application/pdf
429
+ ```
430
+
431
+ ### Bulk Export Tickets
432
+ ```
433
+ GET /api/v1/tickets/export?eventId={event_id}&format=csv
434
+ Authorization: Bearer {api_key}
435
+
436
+ Response: text/csv
437
+ ```
438
+
439
+ ---
440
+
441
+ ## Checkout & Transactions
442
+
443
+ ### Create Checkout Session
444
+ ```
445
+ POST /api/v1/checkout/sessions
446
+ Authorization: Bearer {api_key}
447
+
448
+ {
449
+ "organizationId": "org_xxx",
450
+ "productId": "obj_xxx",
451
+ "customerEmail": "customer@example.com",
452
+ "successUrl": "https://myapp.com/success",
453
+ "cancelUrl": "https://myapp.com/cancel"
454
+ }
455
+ ```
456
+
457
+ Response:
458
+ ```json
459
+ {
460
+ "sessionId": "cs_xxx",
461
+ "checkoutUrl": "https://app.l4yercak3.com/checkout/cs_xxx",
462
+ "expiresAt": 1704153600000
463
+ }
464
+ ```
465
+
466
+ ### Verify Payment
467
+ ```
468
+ POST /api/v1/checkout/confirm
469
+ Authorization: Bearer {api_key}
470
+
471
+ {
472
+ "sessionId": "cs_xxx"
473
+ }
474
+ ```
475
+
476
+ ### List Transactions
477
+ ```
478
+ GET /api/v1/transactions?organizationId={org_id}
479
+ Authorization: Bearer {api_key}
480
+ ```
481
+
482
+ Response:
483
+ ```json
484
+ {
485
+ "transactions": [
486
+ {
487
+ "id": "obj_xxx",
488
+ "type": "transaction",
489
+ "status": "completed",
490
+ "displayName": "Order #12345",
491
+ "customProperties": {
492
+ "lineItems": [
493
+ {
494
+ "productId": "obj_xxx",
495
+ "productName": "Early Bird Ticket",
496
+ "quantity": 2,
497
+ "unitPrice": 19900,
498
+ "total": 39800
499
+ }
500
+ ],
501
+ "subtotal": 39800,
502
+ "tax": 7562,
503
+ "total": 47362,
504
+ "currency": "EUR",
505
+ "customerEmail": "customer@example.com",
506
+ "paymentMethod": "card"
507
+ }
508
+ }
509
+ ]
510
+ }
511
+ ```
512
+
513
+ ### Get Transaction
514
+ ```
515
+ GET /api/v1/transactions/{transactionId}
516
+ Authorization: Bearer {api_key}
517
+ ```
518
+
519
+ ---
520
+
521
+ ## Invoices
522
+
523
+ ### List Invoices
524
+ ```
525
+ GET /api/v1/invoices?organizationId={org_id}&status=sent
526
+ Authorization: Bearer {api_key}
527
+ ```
528
+
529
+ Response:
530
+ ```json
531
+ {
532
+ "invoices": [
533
+ {
534
+ "id": "obj_xxx",
535
+ "type": "invoice",
536
+ "status": "sent",
537
+ "displayName": "INV-2025-001",
538
+ "customProperties": {
539
+ "invoiceNumber": "INV-2025-001",
540
+ "clientId": "obj_contact_xxx",
541
+ "clientName": "Acme Corp",
542
+ "lineItems": [
543
+ {
544
+ "description": "Consulting Services",
545
+ "quantity": 10,
546
+ "unitPrice": 15000,
547
+ "total": 150000
548
+ }
549
+ ],
550
+ "subtotal": 150000,
551
+ "taxRate": 19,
552
+ "tax": 28500,
553
+ "total": 178500,
554
+ "currency": "EUR",
555
+ "dueDate": "2025-02-15",
556
+ "paymentTerms": "net30"
557
+ }
558
+ }
559
+ ]
560
+ }
561
+ ```
562
+
563
+ ### Create Invoice
564
+ ```
565
+ POST /api/v1/invoices
566
+ Authorization: Bearer {api_key}
567
+
568
+ {
569
+ "organizationId": "org_xxx",
570
+ "clientId": "obj_contact_xxx",
571
+ "lineItems": [
572
+ {
573
+ "description": "Website Development",
574
+ "quantity": 1,
575
+ "unitPrice": 500000
576
+ }
577
+ ],
578
+ "taxRate": 19,
579
+ "currency": "EUR",
580
+ "dueDate": "2025-02-28",
581
+ "paymentTerms": "net30",
582
+ "notes": "Thank you for your business!"
583
+ }
584
+ ```
585
+
586
+ ### Get Invoice
587
+ ```
588
+ GET /api/v1/invoices/{invoiceId}
589
+ Authorization: Bearer {api_key}
590
+ ```
591
+
592
+ ### Update Invoice (Draft Only)
593
+ ```
594
+ PATCH /api/v1/invoices/{invoiceId}
595
+ Authorization: Bearer {api_key}
596
+
597
+ {
598
+ "lineItems": [...],
599
+ "notes": "Updated notes"
600
+ }
601
+ ```
602
+
603
+ ### Seal Invoice
604
+ ```
605
+ POST /api/v1/invoices/{invoiceId}/seal
606
+ Authorization: Bearer {api_key}
607
+ ```
608
+
609
+ ### Send Invoice
610
+ ```
611
+ POST /api/v1/invoices/{invoiceId}/send
612
+ Authorization: Bearer {api_key}
613
+
614
+ {
615
+ "recipientEmail": "client@acmecorp.com",
616
+ "message": "Please find attached invoice."
617
+ }
618
+ ```
619
+
620
+ ### Mark as Paid
621
+ ```
622
+ POST /api/v1/invoices/{invoiceId}/mark-paid
623
+ Authorization: Bearer {api_key}
624
+
625
+ {
626
+ "paidAmount": 178500,
627
+ "paymentMethod": "bank_transfer",
628
+ "paymentDate": "2025-01-20"
629
+ }
630
+ ```
631
+
632
+ ### Get Invoice PDF
633
+ ```
634
+ GET /api/v1/invoices/{invoiceId}/pdf
635
+ Authorization: Bearer {api_key}
636
+
637
+ Response: application/pdf
638
+ ```
639
+
640
+ ### Sync Invoice to Stripe
641
+ ```
642
+ POST /api/v1/invoices/{invoiceId}/sync-stripe
643
+ Authorization: Bearer {api_key}
644
+ ```
645
+
646
+ ---
647
+
648
+ ## Forms
649
+
650
+ ### List Forms
651
+ ```
652
+ GET /api/v1/forms?organizationId={org_id}
653
+ Authorization: Bearer {api_key}
654
+ ```
655
+
656
+ Response:
657
+ ```json
658
+ {
659
+ "forms": [
660
+ {
661
+ "id": "obj_xxx",
662
+ "type": "form",
663
+ "subtype": "registration",
664
+ "status": "published",
665
+ "displayName": "Event Registration",
666
+ "customProperties": {
667
+ "fields": [
668
+ {
669
+ "id": "f1",
670
+ "type": "text",
671
+ "label": "Full Name",
672
+ "required": true
673
+ },
674
+ {
675
+ "id": "f2",
676
+ "type": "email",
677
+ "label": "Email",
678
+ "required": true
679
+ }
680
+ ],
681
+ "responseCount": 45
682
+ }
683
+ }
684
+ ]
685
+ }
686
+ ```
687
+
688
+ ### Create Form
689
+ ```
690
+ POST /api/v1/forms
691
+ Authorization: Bearer {api_key}
692
+
693
+ {
694
+ "organizationId": "org_xxx",
695
+ "name": "Workshop Registration",
696
+ "subtype": "registration",
697
+ "fields": [
698
+ {
699
+ "type": "text",
700
+ "label": "Name",
701
+ "required": true
702
+ },
703
+ {
704
+ "type": "email",
705
+ "label": "Email",
706
+ "required": true
707
+ },
708
+ {
709
+ "type": "select",
710
+ "label": "Experience Level",
711
+ "options": ["Beginner", "Intermediate", "Advanced"],
712
+ "required": true
713
+ }
714
+ ]
715
+ }
716
+ ```
717
+
718
+ ### Submit Form Response
719
+ ```
720
+ POST /api/v1/forms/{formId}/submit
721
+ Authorization: Bearer {api_key}
722
+
723
+ {
724
+ "responses": {
725
+ "f1": "John Doe",
726
+ "f2": "john@example.com",
727
+ "f3": "Intermediate"
728
+ }
729
+ }
730
+ ```
731
+
732
+ ### Get Form Responses
733
+ ```
734
+ GET /api/v1/forms/{formId}/responses
735
+ Authorization: Bearer {api_key}
736
+ ```
737
+
738
+ ### Export Form Responses
739
+ ```
740
+ GET /api/v1/forms/{formId}/export?format=csv
741
+ Authorization: Bearer {api_key}
742
+
743
+ Response: text/csv
744
+ ```
745
+
746
+ ---
747
+
748
+ ## Projects
749
+
750
+ ### List Projects
751
+ ```
752
+ GET /api/v1/projects?organizationId={org_id}
753
+ Authorization: Bearer {api_key}
754
+ ```
755
+
756
+ Response:
757
+ ```json
758
+ {
759
+ "projects": [
760
+ {
761
+ "id": "obj_xxx",
762
+ "type": "project",
763
+ "status": "active",
764
+ "displayName": "Brand Redesign",
765
+ "customProperties": {
766
+ "clientId": "obj_contact_xxx",
767
+ "clientName": "Acme Corp",
768
+ "budget": 1500000,
769
+ "startDate": "2025-01-01",
770
+ "endDate": "2025-03-31",
771
+ "progress": 35,
772
+ "milestones": [
773
+ {
774
+ "id": "m1",
775
+ "name": "Discovery",
776
+ "status": "completed"
777
+ }
778
+ ]
779
+ }
780
+ }
781
+ ]
782
+ }
783
+ ```
784
+
785
+ ### Create Project
786
+ ```
787
+ POST /api/v1/projects
788
+ Authorization: Bearer {api_key}
789
+
790
+ {
791
+ "organizationId": "org_xxx",
792
+ "name": "Website Redesign",
793
+ "clientId": "obj_xxx",
794
+ "budget": 2000000,
795
+ "startDate": "2025-02-01",
796
+ "endDate": "2025-05-31",
797
+ "description": "Complete website overhaul"
798
+ }
799
+ ```
800
+
801
+ ### Get Project
802
+ ```
803
+ GET /api/v1/projects/{projectId}
804
+ Authorization: Bearer {api_key}
805
+ ```
806
+
807
+ ### Update Project
808
+ ```
809
+ PATCH /api/v1/projects/{projectId}
810
+ Authorization: Bearer {api_key}
811
+
812
+ {
813
+ "status": "completed",
814
+ "progress": 100
815
+ }
816
+ ```
817
+
818
+ ### Add Task to Project
819
+ ```
820
+ POST /api/v1/projects/{projectId}/tasks
821
+ Authorization: Bearer {api_key}
822
+
823
+ {
824
+ "title": "Design mockups",
825
+ "description": "Create initial design mockups",
826
+ "assigneeId": "user_xxx",
827
+ "dueDate": "2025-02-15",
828
+ "priority": "high"
829
+ }
830
+ ```
831
+
832
+ ### List Project Tasks
833
+ ```
834
+ GET /api/v1/projects/{projectId}/tasks
835
+ Authorization: Bearer {api_key}
836
+ ```
837
+
838
+ ---
839
+
840
+ ## Workflows
841
+
842
+ ### List Workflows
843
+ ```
844
+ GET /api/v1/workflows?organizationId={org_id}
845
+ Authorization: Bearer {api_key}
846
+ ```
847
+
848
+ ### Create Workflow
849
+ ```
850
+ POST /api/v1/workflows
851
+ Authorization: Bearer {api_key}
852
+
853
+ {
854
+ "organizationId": "org_xxx",
855
+ "name": "New Contact Welcome",
856
+ "trigger": {
857
+ "type": "contact_created"
858
+ },
859
+ "actions": [
860
+ {
861
+ "type": "send_email",
862
+ "templateId": "obj_template_xxx",
863
+ "delay": 0
864
+ }
865
+ ]
866
+ }
867
+ ```
868
+
869
+ ### Update Workflow
870
+ ```
871
+ PATCH /api/v1/workflows/{workflowId}
872
+ Authorization: Bearer {api_key}
873
+
874
+ {
875
+ "status": "active"
876
+ }
877
+ ```
878
+
879
+ ### Manually Trigger Workflow
880
+ ```
881
+ POST /api/v1/workflows/{workflowId}/run
882
+ Authorization: Bearer {api_key}
883
+
884
+ {
885
+ "contextData": {
886
+ "contactId": "obj_xxx"
887
+ }
888
+ }
889
+ ```
890
+
891
+ ### Get Workflow Logs
892
+ ```
893
+ GET /api/v1/workflows/{workflowId}/logs
894
+ Authorization: Bearer {api_key}
895
+ ```
896
+
897
+ ---
898
+
899
+ ## Templates
900
+
901
+ ### List Templates
902
+ ```
903
+ GET /api/v1/templates?organizationId={org_id}&type=email
904
+ Authorization: Bearer {api_key}
905
+ ```
906
+
907
+ Response:
908
+ ```json
909
+ {
910
+ "templates": [
911
+ {
912
+ "id": "obj_xxx",
913
+ "type": "template",
914
+ "subtype": "email",
915
+ "displayName": "Invoice Email",
916
+ "customProperties": {
917
+ "subject": "Invoice {{invoiceNumber}} from {{organizationName}}",
918
+ "htmlContent": "...",
919
+ "variables": ["invoiceNumber", "organizationName", "clientName"]
920
+ }
921
+ }
922
+ ]
923
+ }
924
+ ```
925
+
926
+ ### Get Template
927
+ ```
928
+ GET /api/v1/templates/{templateId}
929
+ Authorization: Bearer {api_key}
930
+ ```
931
+
932
+ ### Preview Template (with data)
933
+ ```
934
+ POST /api/v1/templates/{templateId}/preview
935
+ Authorization: Bearer {api_key}
936
+
937
+ {
938
+ "data": {
939
+ "invoiceNumber": "INV-2025-001",
940
+ "organizationName": "My Company",
941
+ "clientName": "Acme Corp"
942
+ }
943
+ }
944
+ ```
945
+
946
+ ---
947
+
948
+ ## Bookings
949
+
950
+ ### Create Booking
951
+ ```
952
+ POST /api/v1/bookings
953
+ Authorization: Bearer {api_key}
954
+
955
+ {
956
+ "organizationId": "org_xxx",
957
+ "eventId": "obj_xxx",
958
+ "productId": "obj_xxx",
959
+ "attendeeEmail": "attendee@example.com",
960
+ "attendeeName": "John Doe",
961
+ "quantity": 2
962
+ }
963
+ ```
964
+
965
+ ### List Bookings
966
+ ```
967
+ GET /api/v1/bookings?organizationId={org_id}&eventId={event_id}
968
+ Authorization: Bearer {api_key}
969
+ ```
970
+
971
+ ---
972
+
973
+ ## Webhooks
974
+
975
+ ### List Webhook Subscriptions
976
+ ```
977
+ GET /api/v1/webhooks?organizationId={org_id}
978
+ Authorization: Bearer {api_key}
979
+ ```
980
+
981
+ ### Create Webhook
982
+ ```
983
+ POST /api/v1/webhooks
984
+ Authorization: Bearer {api_key}
985
+
986
+ {
987
+ "organizationId": "org_xxx",
988
+ "url": "https://myapp.com/webhook",
989
+ "events": ["contact.created", "transaction.completed", "invoice.paid"],
990
+ "secret": "whsec_xxx"
991
+ }
992
+ ```
993
+
994
+ ### Delete Webhook
995
+ ```
996
+ DELETE /api/v1/webhooks/{webhookId}
997
+ Authorization: Bearer {api_key}
998
+ ```
999
+
1000
+ ### Test Webhook
1001
+ ```
1002
+ POST /api/v1/webhooks/{webhookId}/test
1003
+ Authorization: Bearer {api_key}
1004
+ ```
1005
+
1006
+ ---
1007
+
1008
+ ## Bulk Operations
1009
+
1010
+ ### Bulk Import
1011
+ ```
1012
+ POST /api/v1/bulk/import
1013
+ Authorization: Bearer {api_key}
1014
+ Content-Type: multipart/form-data
1015
+
1016
+ file: (CSV or JSON file)
1017
+ type: contacts | products | events
1018
+ organizationId: org_xxx
1019
+ options: {
1020
+ "updateExisting": true,
1021
+ "skipInvalid": true
1022
+ }
1023
+ ```
1024
+
1025
+ Response:
1026
+ ```json
1027
+ {
1028
+ "jobId": "bulk_xxx",
1029
+ "status": "processing",
1030
+ "total": 500,
1031
+ "processed": 0,
1032
+ "errors": []
1033
+ }
1034
+ ```
1035
+
1036
+ ### Bulk Export
1037
+ ```
1038
+ POST /api/v1/bulk/export
1039
+ Authorization: Bearer {api_key}
1040
+
1041
+ {
1042
+ "organizationId": "org_xxx",
1043
+ "type": "contacts",
1044
+ "format": "csv",
1045
+ "filters": {
1046
+ "createdAfter": "2024-01-01"
1047
+ }
1048
+ }
1049
+ ```
1050
+
1051
+ Response:
1052
+ ```json
1053
+ {
1054
+ "jobId": "export_xxx",
1055
+ "downloadUrl": "https://...",
1056
+ "expiresAt": 1704153600000
1057
+ }
1058
+ ```
1059
+
1060
+ ### Get Bulk Job Status
1061
+ ```
1062
+ GET /api/v1/bulk/jobs/{jobId}
1063
+ Authorization: Bearer {api_key}
1064
+ ```
1065
+
1066
+ ---
1067
+
1068
+ ## Connected Apps (CLI Registration)
1069
+
1070
+ ### Register Connected App
1071
+ ```
1072
+ POST /api/v1/cli/apps/register
1073
+ Authorization: Bearer {cli_token}
1074
+
1075
+ {
1076
+ "organizationId": "org_xxx",
1077
+ "name": "My Benefits Platform",
1078
+ "framework": "nextjs",
1079
+ "features": ["crm", "benefits", "invoicing"],
1080
+ "modelMappings": [
1081
+ {
1082
+ "localModel": "User",
1083
+ "layerCakeType": "contact",
1084
+ "syncDirection": "bidirectional",
1085
+ "fieldMappings": [
1086
+ {"localField": "email", "layerCakeField": "email"},
1087
+ {"localField": "name", "layerCakeField": "displayName"}
1088
+ ]
1089
+ }
1090
+ ],
1091
+ "productionDomain": "myapp.vercel.app"
1092
+ }
1093
+ ```
1094
+
1095
+ ### List Connected Apps
1096
+ ```
1097
+ GET /api/v1/cli/apps?organizationId={org_id}
1098
+ Authorization: Bearer {cli_token}
1099
+ ```
1100
+
1101
+ ### Update Connected App
1102
+ ```
1103
+ PATCH /api/v1/cli/apps/{appId}
1104
+ Authorization: Bearer {cli_token}
1105
+
1106
+ {
1107
+ "status": "paused",
1108
+ "modelMappings": [...]
1109
+ }
1110
+ ```
1111
+
1112
+ ### Disconnect App
1113
+ ```
1114
+ DELETE /api/v1/cli/apps/{appId}
1115
+ Authorization: Bearer {cli_token}
1116
+ ```
1117
+
1118
+ ### Sync App Data
1119
+ ```
1120
+ POST /api/v1/cli/apps/{appId}/sync
1121
+ Authorization: Bearer {cli_token}
1122
+
1123
+ {
1124
+ "direction": "bidirectional",
1125
+ "models": ["contacts", "organizations"]
1126
+ }
1127
+ ```
1128
+
1129
+ ---
1130
+
1131
+ ## Error Codes
1132
+
1133
+ | Code | HTTP Status | Description |
1134
+ |------|-------------|-------------|
1135
+ | `UNAUTHORIZED` | 401 | Missing or invalid authentication |
1136
+ | `SESSION_EXPIRED` | 401 | CLI session expired |
1137
+ | `NOT_AUTHORIZED` | 403 | No permission for this resource |
1138
+ | `NOT_FOUND` | 404 | Resource not found |
1139
+ | `VALIDATION_ERROR` | 400 | Invalid request data |
1140
+ | `MISSING_PARAM` | 400 | Required parameter missing |
1141
+ | `API_KEY_LIMIT_REACHED` | 429 | API key quota exceeded |
1142
+ | `RATE_LIMITED` | 429 | Too many requests |
1143
+ | `RESOURCE_LIMIT` | 429 | Plan resource limit reached |
1144
+ | `UNKNOWN_ERROR` | 500 | Internal server error |
1145
+
1146
+ ---
1147
+
1148
+ ## Rate Limits
1149
+
1150
+ | Plan | Requests/minute | Bulk operations/day |
1151
+ |------|-----------------|---------------------|
1152
+ | Free | 60 | 10 |
1153
+ | Starter | 300 | 50 |
1154
+ | Professional | 1000 | 200 |
1155
+ | Agency | 3000 | 500 |
1156
+ | Enterprise | Unlimited | Unlimited |
1157
+
1158
+ ---
1159
+
1160
+ ## Webhooks Payload Format
1161
+
1162
+ ```json
1163
+ {
1164
+ "id": "evt_xxx",
1165
+ "type": "contact.created",
1166
+ "timestamp": 1704067200000,
1167
+ "data": {
1168
+ "id": "obj_xxx",
1169
+ "type": "contact",
1170
+ "displayName": "John Doe",
1171
+ "customProperties": {...}
1172
+ },
1173
+ "organizationId": "org_xxx"
1174
+ }
1175
+ ```
1176
+
1177
+ ### Available Webhook Events
1178
+
1179
+ - `contact.created`
1180
+ - `contact.updated`
1181
+ - `contact.deleted`
1182
+ - `transaction.completed`
1183
+ - `transaction.refunded`
1184
+ - `invoice.created`
1185
+ - `invoice.sent`
1186
+ - `invoice.paid`
1187
+ - `event.published`
1188
+ - `ticket.issued`
1189
+ - `ticket.redeemed`
1190
+ - `form.submitted`
1191
+ - `project.created`
1192
+ - `project.completed`
1193
+
1194
+ ---
1195
+
1196
+ *Document Version: 1.0*
1197
+ *Last Updated: January 2025*