-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.json
More file actions
1535 lines (1535 loc) · 68.5 KB
/
Copy pathopenapi.json
File metadata and controls
1535 lines (1535 loc) · 68.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"openapi": "3.1.0",
"info": {
"title": "AgentaOS Gateway API",
"version": "1.0.0",
"description": "The AgentaOS REST API: payment links, checkouts, subscriptions, customers, invoices, and the unified transactions feed. This is the same API the TypeScript SDK (`@agentaos/pay`) and the `agenta` CLI call underneath.\n\n## Money model\n\n- **Decimal currency units (`number`)**: a plain `amount` field (on a create body, a Payment Link, a Checkout's `amount_override`, or an Invoice's `amount`/`fiat_amount`/`tax_amount`) is in currency units. `49.99` means EUR 49.99, never cents.\n- **Integer minor units (`number`)**: exactly one field breaks that rule: `unitAmountMinor` on a Subscription. It is an integer count of the smallest currency unit (`1999` means EUR 19.99), named with a `Minor` suffix specifically so it is never confused with a plain `amount`. The `money` object on Transactions and the `earnings` object on a retrieved Invoice are also integer minor units, computed server-side.\n- **String, on webhooks**: the `amount` inside a webhook payload's `data` object is a string (e.g. `\"49.99\"`), since JSON numbers silently drop trailing zeros and this value must round-trip exactly for accounting.\n\n## Naming convention\n\nMost response fields mirror the underlying database column and are `snake_case` (`created_at`, `seller_mode`, `buyer_email`, ...). A small number of computed convenience fields are camelCase with no snake_case equivalent: `checkoutUrl` on Checkouts and Payment Links, `sellerMode` on Payment Links specifically, `money` on Transactions, and `earnings` on a single retrieved Invoice. Two resources (Subscriptions and Customers) are fully camelCase end to end.\n\n## Pagination\n\nEvery list endpoint takes `limit` and `offset` and returns `{ items, total, hasMore }`. `hasMore` is computed server-side (`offset + items.length < total`); never derive it client-side.",
"contact": {
"name": "AgentaOS",
"url": "https://agentaos.ai"
},
"license": {
"name": "Proprietary",
"url": "https://agentaos.ai"
}
},
"servers": [
{
"url": "https://api.agentaos.ai/api/v1",
"description": "Production"
}
],
"security": [
{
"ApiKeyAuth": []
}
],
"tags": [
{
"name": "Payment Links",
"description": "Reusable, shareable payment products: a fixed amount and description behind one URL."
},
{
"name": "Checkouts",
"description": "One attempt to collect one payment, standalone or built from a payment link. Wire path is `/gateway/sessions`; the SDK and CLI call this resource \"checkout\"."
},
{
"name": "Subscriptions",
"description": "Merchant-side read and management surface for recurring plans. Created automatically when a buyer pays a `type: subscription` payment link."
},
{
"name": "Customers",
"description": "Read-only surface: everyone who has paid you or been sent an invoice."
},
{
"name": "Invoices",
"description": "Every checkout issues an invoice. List, retrieve, void, export, and download PDFs/receipts."
},
{
"name": "Transactions",
"description": "The unified activity feed: every inbound payment and outbound send, across every rail, in one list."
}
],
"paths": {
"/gateway/payment-links": {
"post": {
"tags": ["Payment Links"],
"operationId": "createPaymentLink",
"summary": "Create a payment link",
"description": "Creates a reusable, shareable payment link.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/PaymentLinkCreateRequest" },
"example": {
"amount": 49.99,
"currency": "EUR",
"name": "Pro plan",
"description": "Monthly access to Pro features"
}
}
}
},
"responses": {
"201": {
"description": "Payment link created.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/PaymentLink" },
"examples": { "default": { "$ref": "#/components/examples/PaymentLinkExample" } }
}
}
},
"400": { "$ref": "#/components/responses/BadRequest" },
"401": { "$ref": "#/components/responses/Unauthorized" },
"403": { "$ref": "#/components/responses/Forbidden" }
}
},
"get": {
"tags": ["Payment Links"],
"operationId": "listPaymentLinks",
"summary": "List payment links",
"description": "Paginated. See the Money model / Pagination notes on this spec's top-level description.",
"parameters": [
{ "$ref": "#/components/parameters/Limit100" },
{ "$ref": "#/components/parameters/Offset" },
{ "$ref": "#/components/parameters/NetworksFilter" }
],
"responses": {
"200": {
"description": "A page of payment links.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/PaymentLinkListResponse" }
}
}
},
"401": { "$ref": "#/components/responses/Unauthorized" }
}
}
},
"/gateway/payment-links/{id}": {
"get": {
"tags": ["Payment Links"],
"operationId": "getPaymentLink",
"summary": "Retrieve a payment link",
"description": "Same fields as create, plus `transactions`: every payment (inbound or outbound) recorded against this link, newest first, same row shape as a Transaction but without the computed `money` breakdown.",
"parameters": [{ "$ref": "#/components/parameters/PaymentLinkId" }],
"responses": {
"200": {
"description": "The payment link, with its transaction history.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/PaymentLinkDetail" }
}
}
},
"401": { "$ref": "#/components/responses/Unauthorized" },
"403": { "$ref": "#/components/responses/Forbidden" },
"404": { "$ref": "#/components/responses/NotFound" }
}
},
"patch": {
"tags": ["Payment Links"],
"operationId": "updatePaymentLink",
"summary": "Update a payment link",
"description": "Partial update: only send the fields you want to change.",
"parameters": [{ "$ref": "#/components/parameters/PaymentLinkId" }],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/PaymentLinkUpdateRequest" },
"example": { "amount": 59.99 }
}
}
},
"responses": {
"200": {
"description": "The updated payment link.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/PaymentLink" }
}
}
},
"400": { "$ref": "#/components/responses/BadRequest" },
"401": { "$ref": "#/components/responses/Unauthorized" },
"403": { "$ref": "#/components/responses/Forbidden" },
"404": { "$ref": "#/components/responses/NotFound" }
}
},
"delete": {
"tags": ["Payment Links"],
"operationId": "cancelPaymentLink",
"summary": "Cancel a payment link",
"description": "Deactivates the link. Existing checkouts already in progress are unaffected; no new checkout can be started from it afterward. This is a state change, not a delete: the link and its payment history stay readable.",
"parameters": [{ "$ref": "#/components/parameters/PaymentLinkId" }],
"responses": {
"200": {
"description": "The link was cancelled.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/SuccessResponse" },
"example": { "success": true }
}
}
},
"401": { "$ref": "#/components/responses/Unauthorized" },
"403": { "$ref": "#/components/responses/Forbidden" },
"404": { "$ref": "#/components/responses/NotFound" },
"409": { "$ref": "#/components/responses/Conflict" }
}
}
},
"/gateway/sessions": {
"post": {
"tags": ["Checkouts"],
"operationId": "createCheckout",
"summary": "Create a checkout",
"description": "Creates a checkout session, standalone or built from a payment link with `linkId`. The create and list responses do **not** include a plain `amount`, only `amount_override` (`null` unless you passed one). Call \"Retrieve a checkout\" for a computed, ready-to-display `amount`. Accepts an `Idempotency-Key` header (wins over a body `idempotencyKey` if both are sent); a repeat call with the same key returns the same checkout instead of creating a second one.",
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"required": false,
"description": "Alternative to the body's `idempotencyKey` field. The header wins if both are sent.",
"schema": { "type": "string" }
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/CheckoutCreateRequest" },
"example": {
"amount": 49.99,
"currency": "EUR",
"description": "Order #123",
"successUrl": "https://myshop.com/success",
"cancelUrl": "https://myshop.com/cart",
"webhookUrl": "https://myshop.com/webhooks",
"buyerEmail": "john@example.com"
}
}
}
},
"responses": {
"201": {
"description": "Checkout created.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Checkout" },
"examples": { "default": { "$ref": "#/components/examples/CheckoutExample" } }
}
}
},
"400": { "$ref": "#/components/responses/BadRequest" },
"401": { "$ref": "#/components/responses/Unauthorized" },
"403": { "$ref": "#/components/responses/Forbidden" }
}
},
"get": {
"tags": ["Checkouts"],
"operationId": "listCheckouts",
"summary": "List checkouts",
"description": "Paginated. Same fields as create, per item.",
"parameters": [
{ "$ref": "#/components/parameters/Limit100" },
{ "$ref": "#/components/parameters/Offset" },
{
"name": "status",
"in": "query",
"required": false,
"schema": { "type": "string", "enum": ["open", "completed", "expired", "cancelled"] }
},
{ "$ref": "#/components/parameters/NetworksFilter" }
],
"responses": {
"200": {
"description": "A page of checkouts.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/CheckoutListResponse" }
}
}
},
"401": { "$ref": "#/components/responses/Unauthorized" }
}
}
},
"/gateway/sessions/{sessionId}": {
"get": {
"tags": ["Checkouts"],
"operationId": "getCheckout",
"summary": "Retrieve a checkout",
"description": "Adds a computed `amount` (the effective price: `amount_override`, else the linked payment link's amount), plus the link's own `link_amount`/`link_currency`/`link_description`, and the checkout's `transactions` and `invoices` arrays.",
"parameters": [{ "$ref": "#/components/parameters/SessionId" }],
"responses": {
"200": {
"description": "The checkout, with computed amount and related rows.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/CheckoutDetail" }
}
}
},
"401": { "$ref": "#/components/responses/Unauthorized" },
"403": { "$ref": "#/components/responses/Forbidden" },
"404": { "$ref": "#/components/responses/NotFound" }
}
}
},
"/gateway/sessions/{sessionId}/cancel": {
"post": {
"tags": ["Checkouts"],
"operationId": "cancelCheckout",
"summary": "Cancel a checkout",
"description": "Stops the buyer from paying. If a payment already cleared before the cancel call lands, it still completes: cancelling doesn't reach into the card processor or on-chain state after the fact. Only works while the checkout is `open` (`400` otherwise).",
"parameters": [{ "$ref": "#/components/parameters/SessionId" }],
"responses": {
"200": {
"description": "The checkout was cancelled.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/SuccessResponse" },
"example": { "success": true }
}
}
},
"400": { "$ref": "#/components/responses/BadRequest" },
"401": { "$ref": "#/components/responses/Unauthorized" },
"403": { "$ref": "#/components/responses/Forbidden" },
"404": { "$ref": "#/components/responses/NotFound" },
"409": { "$ref": "#/components/responses/Conflict" }
}
}
},
"/gateway/subscriptions": {
"get": {
"tags": ["Subscriptions"],
"operationId": "listSubscriptions",
"summary": "List subscriptions",
"description": "Paginated. A subscription is created automatically when a buyer pays a payment link with `type: \"subscription\"` at checkout: there is no `POST` create endpoint by design. Every field on this resource is camelCase on the wire.",
"parameters": [
{ "$ref": "#/components/parameters/Limit100" },
{ "$ref": "#/components/parameters/Offset" }
],
"responses": {
"200": {
"description": "A page of subscriptions.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/SubscriptionListResponse" }
}
}
},
"401": { "$ref": "#/components/responses/Unauthorized" }
}
}
},
"/gateway/subscriptions/{id}/cancel": {
"post": {
"tags": ["Subscriptions"],
"operationId": "cancelSubscription",
"summary": "Cancel a subscription",
"description": "Cancels at the end of the current paid period by default: the subscriber keeps what they already paid for, no refund. Pass `atPeriodEnd: false` to cancel immediately instead. Calling cancel again on an already-`canceled` subscription is a no-op. Returns `400` if the subscription never completed a first successful charge (`stripeSubscriptionId` is `null`).",
"parameters": [{ "$ref": "#/components/parameters/SubscriptionId" }],
"requestBody": {
"required": false,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/CancelSubscriptionRequest" },
"example": { "atPeriodEnd": true }
}
}
},
"responses": {
"200": {
"description": "The subscription's updated cancellation state.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/CancelSubscriptionResponse" },
"example": {
"status": "active",
"currentPeriodEnd": "2026-09-06T12:00:00.000Z",
"cancelAtPeriodEnd": true,
"effectiveCancelDate": "2026-09-06T12:00:00.000Z"
}
}
}
},
"400": { "$ref": "#/components/responses/BadRequest" },
"401": { "$ref": "#/components/responses/Unauthorized" },
"403": { "$ref": "#/components/responses/Forbidden" },
"404": { "$ref": "#/components/responses/NotFound" }
}
}
},
"/gateway/customers": {
"get": {
"tags": ["Customers"],
"operationId": "listCustomers",
"summary": "List customers",
"description": "Paginated, newest first, no filters beyond pagination. A customer record is created automatically the first time someone pays you (or you issue them an invoice) with an email attached. There is no `POST` create endpoint: this is a read-only surface. Every field on this resource is camelCase on the wire.",
"parameters": [
{ "$ref": "#/components/parameters/Limit100" },
{ "$ref": "#/components/parameters/Offset" }
],
"responses": {
"200": {
"description": "A page of customers.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/CustomerListResponse" }
}
}
},
"401": { "$ref": "#/components/responses/Unauthorized" }
}
}
},
"/gateway/invoices": {
"get": {
"tags": ["Invoices"],
"operationId": "listInvoices",
"summary": "List invoices",
"description": "Paginated. Every checkout issues an invoice: `issued` the moment the checkout is created, `paid` once the payment settles, or `voided` if cancelled. The seller of record is our Estonian entity, AgentaOS's Merchant of Record entity, unless the payment settled to your own on-chain wallet (`seller_mode: \"crypto\"`), in which case you're the seller.",
"parameters": [
{ "$ref": "#/components/parameters/Limit5000" },
{ "$ref": "#/components/parameters/Offset" },
{ "$ref": "#/components/parameters/From" },
{ "$ref": "#/components/parameters/To" },
{ "$ref": "#/components/parameters/InvoiceStatus" },
{ "$ref": "#/components/parameters/FiatCurrency" },
{ "$ref": "#/components/parameters/NetworksFilter" }
],
"responses": {
"200": {
"description": "A page of invoices.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/InvoiceListResponse" }
}
}
},
"401": { "$ref": "#/components/responses/Unauthorized" }
}
}
},
"/gateway/invoices/statement": {
"get": {
"tags": ["Invoices"],
"operationId": "downloadStatement",
"summary": "Download a statement PDF",
"description": "A statement-style PDF covering a date range: opening/closing balance, every transaction in the ledger, and a VAT summary grouped by rate. `from` and `to` are both required, unlike the other date filters in this API.",
"parameters": [
{ "$ref": "#/components/parameters/FromRequired" },
{ "$ref": "#/components/parameters/ToRequired" },
{ "$ref": "#/components/parameters/FiatCurrency" },
{ "$ref": "#/components/parameters/NetworksFilter" }
],
"responses": {
"200": {
"description": "The statement PDF.",
"content": {
"application/pdf": {
"schema": { "type": "string", "format": "binary" }
}
}
},
"400": { "$ref": "#/components/responses/BadRequest" },
"401": { "$ref": "#/components/responses/Unauthorized" }
}
}
},
"/gateway/invoices/export": {
"get": {
"tags": ["Invoices"],
"operationId": "exportInvoices",
"summary": "Export invoices as CSV",
"description": "Up to 5000 rows for the matching filter, built for accounting software: date, invoice number, description, amount and currency, exchange rate and source, tax name/rate/amount, buyer name/company/country/VAT, and status.",
"parameters": [
{ "$ref": "#/components/parameters/From" },
{ "$ref": "#/components/parameters/To" },
{ "$ref": "#/components/parameters/InvoiceStatus" },
{ "$ref": "#/components/parameters/FiatCurrency" },
{ "$ref": "#/components/parameters/NetworksFilter" }
],
"responses": {
"200": {
"description": "The invoices CSV.",
"content": {
"text/csv": {
"schema": { "type": "string" }
}
}
},
"401": { "$ref": "#/components/responses/Unauthorized" }
}
}
},
"/gateway/invoices/{invoiceId}": {
"get": {
"tags": ["Invoices"],
"operationId": "getInvoice",
"summary": "Retrieve an invoice",
"description": "Same fields as the list, plus `earnings`: a fee/VAT/net breakdown, present only for a card/bank Merchant-of-Record sale with a linked, settled transaction. `null` otherwise (crypto sales, or a not-yet-paid `issued` invoice).",
"parameters": [{ "$ref": "#/components/parameters/InvoiceId" }],
"responses": {
"200": {
"description": "The invoice, with its earnings breakdown.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/InvoiceDetail" },
"examples": { "default": { "$ref": "#/components/examples/InvoiceDetailExample" } }
}
}
},
"401": { "$ref": "#/components/responses/Unauthorized" },
"403": { "$ref": "#/components/responses/Forbidden" },
"404": { "$ref": "#/components/responses/NotFound" }
}
}
},
"/gateway/invoices/{invoiceId}/void": {
"post": {
"tags": ["Invoices"],
"operationId": "voidInvoice",
"summary": "Void an invoice",
"description": "Marks the accounting record void. It never touches the payment itself: if the buyer already paid, nothing is refunded. Use it to correct a bookkeeping mistake, not to reverse a charge. Irreversible: there is no \"un-void\"; an already-voided invoice returns `400` on a repeat call.",
"parameters": [{ "$ref": "#/components/parameters/InvoiceId" }],
"responses": {
"200": {
"description": "The invoice was voided.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/SuccessResponse" },
"example": { "success": true }
}
}
},
"400": { "$ref": "#/components/responses/BadRequest" },
"401": { "$ref": "#/components/responses/Unauthorized" },
"403": { "$ref": "#/components/responses/Forbidden" },
"404": { "$ref": "#/components/responses/NotFound" }
}
}
},
"/gateway/invoices/{invoiceId}/pdf": {
"get": {
"tags": ["Invoices"],
"operationId": "downloadInvoicePdf",
"summary": "Download the invoice PDF",
"description": "Response is `application/pdf` (binary), not JSON. Includes seller and buyer details, the amount (plus fiat equivalent and exchange rate for stablecoin payments), and a tax breakdown.",
"parameters": [{ "$ref": "#/components/parameters/InvoiceId" }],
"responses": {
"200": {
"description": "The invoice PDF.",
"content": {
"application/pdf": {
"schema": { "type": "string", "format": "binary" }
}
}
},
"401": { "$ref": "#/components/responses/Unauthorized" },
"403": { "$ref": "#/components/responses/Forbidden" },
"404": { "$ref": "#/components/responses/NotFound" }
}
}
},
"/gateway/invoices/{invoiceId}/receipt": {
"get": {
"tags": ["Invoices"],
"operationId": "downloadReceiptPdf",
"summary": "Download the receipt PDF",
"description": "Same document family as the invoice PDF, but titled as a receipt with its own receipt number, for a **paid** invoice. Falls back to the plain invoice PDF (still valid proof of payment) for invoices issued before receipts existed on your account, rather than `404`ing.",
"parameters": [{ "$ref": "#/components/parameters/InvoiceId" }],
"responses": {
"200": {
"description": "The receipt PDF (or the invoice PDF, on fallback).",
"content": {
"application/pdf": {
"schema": { "type": "string", "format": "binary" }
}
}
},
"401": { "$ref": "#/components/responses/Unauthorized" },
"403": { "$ref": "#/components/responses/Forbidden" },
"404": { "$ref": "#/components/responses/NotFound" }
}
}
},
"/gateway/invoices/{invoiceId}/send-receipt": {
"post": {
"tags": ["Invoices"],
"operationId": "resendReceipt",
"summary": "Re-send the receipt email",
"description": "Sends the paid receipt to the buyer email on file. Only works for a `paid` invoice with a `buyer_email`: returns `400` otherwise.",
"parameters": [{ "$ref": "#/components/parameters/InvoiceId" }],
"responses": {
"200": {
"description": "The receipt email was sent.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/SendReceiptResponse" },
"example": { "ok": true, "sentTo": "john@example.com" }
}
}
},
"400": { "$ref": "#/components/responses/BadRequest" },
"401": { "$ref": "#/components/responses/Unauthorized" },
"403": { "$ref": "#/components/responses/Forbidden" },
"404": { "$ref": "#/components/responses/NotFound" }
}
}
},
"/gateway/all-transactions": {
"get": {
"tags": ["Transactions"],
"operationId": "listTransactions",
"summary": "List transactions",
"description": "One unified list of everything that moved money on your account: inbound payments (from checkouts and payment links) and outbound sends, across every rail (card, SEPA bank transfer, stablecoins on-chain), in one feed. Only `confirmed` rows are returned: a pending or failed attempt never appears here; `status` on each item is always `confirmed`.",
"parameters": [
{
"name": "direction",
"in": "query",
"required": false,
"schema": { "type": "string", "enum": ["all", "inbound", "outbound"], "default": "all" }
},
{ "$ref": "#/components/parameters/From" },
{ "$ref": "#/components/parameters/To" },
{ "$ref": "#/components/parameters/FiatCurrency" },
{ "$ref": "#/components/parameters/NetworksFilter" },
{ "$ref": "#/components/parameters/Limit5000" },
{ "$ref": "#/components/parameters/Offset" }
],
"responses": {
"200": {
"description": "A page of transactions.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/TransactionListResponse" },
"examples": { "default": { "$ref": "#/components/examples/TransactionListExample" } }
}
}
},
"401": { "$ref": "#/components/responses/Unauthorized" }
}
}
}
},
"components": {
"securitySchemes": {
"ApiKeyAuth": {
"type": "apiKey",
"in": "header",
"name": "x-api-key",
"description": "Your secret key, from app.agentaos.ai -> Settings -> Developers -> API Keys. The key's prefix is both its identity and its environment: `sk_test_...` (sandbox, free, no verification) or `sk_live_...` (real money, requires business verification). A missing or invalid key returns 401."
}
},
"parameters": {
"PaymentLinkId": {
"name": "id",
"in": "path",
"required": true,
"description": "Payment link UUID.",
"schema": { "type": "string", "format": "uuid" }
},
"SessionId": {
"name": "sessionId",
"in": "path",
"required": true,
"description": "The public `session_id` (not the internal `id` UUID).",
"schema": { "type": "string" }
},
"SubscriptionId": {
"name": "id",
"in": "path",
"required": true,
"description": "Subscription UUID (the `id` field from the list response, not `stripeSubscriptionId`).",
"schema": { "type": "string", "format": "uuid" }
},
"InvoiceId": {
"name": "invoiceId",
"in": "path",
"required": true,
"description": "Invoice UUID.",
"schema": { "type": "string", "format": "uuid" }
},
"Limit100": {
"name": "limit",
"in": "query",
"required": false,
"description": "Items per page. Capped server-side at 100.",
"schema": { "type": "integer", "default": 20, "minimum": 1, "maximum": 100 }
},
"Limit5000": {
"name": "limit",
"in": "query",
"required": false,
"description": "Items per page. Capped server-side at 5000.",
"schema": { "type": "integer", "default": 20, "minimum": 1, "maximum": 5000 }
},
"Offset": {
"name": "offset",
"in": "query",
"required": false,
"description": "Number of items to skip, for the next page.",
"schema": { "type": "integer", "default": 0, "minimum": 0 }
},
"NetworksFilter": {
"name": "networks",
"in": "query",
"required": false,
"description": "Comma-separated CAIP-2 network IDs to filter by, e.g. `eip155:8453,eip155:84532`. Ignored if your API key is network-scoped.",
"schema": { "type": "string" }
},
"From": {
"name": "from",
"in": "query",
"required": false,
"description": "ISO 8601 date or datetime, inclusive lower bound.",
"schema": { "type": "string" }
},
"To": {
"name": "to",
"in": "query",
"required": false,
"description": "ISO 8601 date or datetime, inclusive upper bound.",
"schema": { "type": "string" }
},
"FromRequired": {
"name": "from",
"in": "query",
"required": true,
"description": "ISO 8601 date.",
"schema": { "type": "string" }
},
"ToRequired": {
"name": "to",
"in": "query",
"required": true,
"description": "ISO 8601 date.",
"schema": { "type": "string" }
},
"FiatCurrency": {
"name": "fiatCurrency",
"in": "query",
"required": false,
"description": "Filter to rows settled/presented in this fiat currency.",
"schema": { "type": "string", "enum": ["EUR", "USD"] }
},
"InvoiceStatus": {
"name": "status",
"in": "query",
"required": false,
"schema": { "type": "string", "enum": ["all", "issued", "paid", "voided"] }
}
},
"responses": {
"BadRequest": {
"description": "A required field is missing, out of range, or the wrong type. `ValidationPipe` also rejects any field not in the documented schema.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" },
"example": {
"statusCode": 400,
"message": "amount is required when creating a session without a link",
"timestamp": "2026-08-06T12:00:00.000Z"
}
}
}
},
"Unauthorized": {
"description": "Missing or invalid `x-api-key`.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" },
"example": {
"statusCode": 401,
"message": "Invalid API key",
"timestamp": "2026-08-06T12:00:00.000Z"
}
}
}
},
"Forbidden": {
"description": "The key is valid but the resource belongs to a different organization.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" },
"example": {
"statusCode": 403,
"message": "Payment link belongs to another organization",
"timestamp": "2026-08-06T12:00:00.000Z"
}
}
}
},
"NotFound": {
"description": "Resource not found (or not visible to your key; the two are not distinguished).",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" },
"example": {
"statusCode": 404,
"message": "Payment link not found",
"timestamp": "2026-08-06T12:00:00.000Z"
}
}
}
},
"Conflict": {
"description": "The resource was modified concurrently, or the action doesn't apply to its current state.",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" },
"example": {
"statusCode": 409,
"message": "Payment link was modified concurrently",
"timestamp": "2026-08-06T12:00:00.000Z"
}
}
}
}
},
"examples": {
"PaymentLinkExample": {
"value": {
"id": "3f1a2b4c-5d6e-7f8a-9b0c-1d2e3f4a5b6c",
"org_id": "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d",
"user_id": "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
"secure_link_id": "mZrESFyR7RC9RPsJfZCVkg",
"amount": 49.99,
"currency": "EUR",
"description": "Monthly access to Pro features",
"metadata": {},
"checkout_fields": [],
"webhook_url": null,
"success_url": null,
"cancel_url": null,
"tax_rate_id": null,
"status": "active",
"payment_count": 0,
"supported_networks": ["eip155:8453"],
"expires_at": null,
"created_at": "2026-08-06T12:00:00.000Z",
"updated_at": "2026-08-06T12:00:00.000Z",
"name": "Pro plan",
"image_url": null,
"max_uses": null,
"seller_mode": "mor",
"type": "one_time",
"billing_interval": null,
"environment": "live",
"checkoutUrl": "https://app.agentaos.ai/pay/mZrESFyR7RC9RPsJfZCVkg",
"sellerMode": "mor"
}
},
"CheckoutExample": {
"value": {
"id": "a1b2c3d4-e5f6-7a8b-9c0d-1e2f3a4b5c6d",
"payment_link_id": null,
"org_id": "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d",
"session_id": "mZrESFyR7RC9RPsJfZCVkg",
"idempotency_key": "order-48213",
"amount_override": 49.99,
"currency": "EUR",
"metadata": { "payer": { "email": "john@example.com" } },
"webhook_url": "https://myshop.com/webhooks",
"success_url": "https://myshop.com/success",
"cancel_url": "https://myshop.com/cart",
"tax_rate_id": null,
"supported_networks": ["eip155:8453"],
"expires_at": "2026-08-06T12:30:00.000Z",
"status": "open",
"created_at": "2026-08-06T12:00:00.000Z",
"updated_at": "2026-08-06T12:00:00.000Z",
"seller_mode": "mor",
"environment": "live",
"checkoutUrl": "https://app.agentaos.ai/checkout/mZrESFyR7RC9RPsJfZCVkg",
"invoiceId": "b2c3d4e5-f6a7-8b9c-0d1e-2f3a4b5c6d7e",
"invoiceNumber": "INV-2026-0142"
}
},
"InvoiceDetailExample": {
"value": {
"id": "b2c3d4e5-f6a7-8b9c-0d1e-2f3a4b5c6d7e",
"transaction_id": "8c7d6e5f-4a3b-2c1d-0e9f-8a7b6c5d4e3f",
"org_id": "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d",
"session_id": "mZrESFyR7RC9RPsJfZCVkg",
"invoice_number": "INV-2026-0142",
"amount": 49.99,
"currency": "EUR",
"payment_token": "EURC",
"description": "Order #123",
"tx_hash": null,
"network": "stripe",
"fiat_amount": 49.99,
"fiat_currency": "EUR",
"exchange_rate": 1,
"exchange_rate_source": "1:1 peg",
"status": "paid",
"issued_at": "2026-08-06T12:00:00.000Z",
"voided_at": null,
"created_at": "2026-08-06T12:00:00.000Z",
"merchant_name": "Acme Inc",
"buyer_email": "john@example.com",
"buyer_country": "DE",
"buyer_name": "John Doe",
"buyer_company": null,
"buyer_vat": null,
"tax_rate": null,
"tax_amount": null,
"tax_name": null,
"tax_inclusive": null,
"earnings": {
"currency": "EUR",
"grossMinor": 4999,
"agentaosFeeMinor": 215,
"vatMinor": 0,
"netMinor": 4784
}
}
},
"TransactionListExample": {
"value": {
"items": [
{
"id": "8c7d6e5f-4a3b-2c1d-0e9f-8a7b6c5d4e3f",
"payment_link_id": "3f1a2b4c-5d6e-7f8a-9b0c-1d2e3f4a5b6c",
"session_id": "mZrESFyR7RC9RPsJfZCVkg",
"org_id": "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d",
"direction": "inbound",
"payer_address": null,
"payer_type": "human",
"amount": 49.99,
"payment_token": "EURC",
"settlement_token": "EURC",
"status": "confirmed",
"tx_hash": null,
"vendor_reference": "pi_3P...",
"network": "stripe",
"to_address": null,
"recipient_label": null,
"description": "Order #123",
"payment_method": "card",
"seller_of_record": "aristokrates_ou",
"invoice_id": "b2c3d4e5-f6a7-8b9c-0d1e-2f3a4b5c6d7e",
"created_at": "2026-08-06T12:05:00.000Z",
"environment": "live",
"money": {
"currency": "EUR",
"grossMinor": 4999,
"feeMinor": 215,
"vatMinor": 0,
"netMinor": 4784
}
}
],
"total": 214,
"hasMore": true
}
}
},
"schemas": {
"Error": {
"type": "object",
"description": "Every non-2xx response is JSON in this shape. Every response (success or error) also carries an `x-request-id` response header; send that header on your request to have your own id echoed back, otherwise the server mints one. On errors the same id is repeated in the `requestId` body field.",
"properties": {
"statusCode": { "type": "integer", "description": "Same as the HTTP status code." },
"message": {
"description": "Human-readable. A validation failure (400) returns an array of per-field messages instead of one string.",
"anyOf": [
{ "type": "string" },
{ "type": "array", "items": { "type": "string" } }
]
},
"errors": {
"type": "array",
"description": "Present on 400 validation failures: one entry per invalid field. The flat human-readable strings stay in `message` for back-compat; this is the machine-readable, per-field view.",
"items": {
"type": "object",
"properties": {
"field": {
"type": "string",
"description": "Name of the invalid field, dot-notated for nested properties (e.g. `checkoutFields.0.type`)."
},
"message": {
"type": "string",
"description": "Validation messages for that field, joined with `, `."
}
},
"required": ["field", "message"]
}
},
"requestId": {
"type": "string",
"description": "Correlation id, identical to the `x-request-id` response header. Include it when contacting support. On success it is available on the header only, not the body."
},
"timestamp": { "type": "string", "format": "date-time" }
},
"required": ["statusCode", "message", "timestamp"]
},
"SuccessResponse": {
"type": "object",
"properties": {
"success": { "type": "boolean", "const": true }
},
"required": ["success"]
},
"SendReceiptResponse": {
"type": "object",
"properties": {
"ok": { "type": "boolean", "const": true },
"sentTo": { "type": "string", "format": "email" }
},
"required": ["ok", "sentTo"]
},
"CheckoutField": {
"type": "object",
"description": "An extra field collected at checkout.",
"properties": {
"key": { "type": "string", "maxLength": 64 },
"label": { "type": "string", "maxLength": 128 },
"type": { "type": "string", "enum": ["text", "email", "tel", "select"] },
"required": { "type": "boolean" },
"placeholder": { "type": "string", "maxLength": 256 },
"options": {