forked from StellarRoute/StellarRoute
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
1386 lines (1327 loc) · 44.9 KB
/
Copy pathopenapi.yaml
File metadata and controls
1386 lines (1327 loc) · 44.9 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.0.3
info:
title: StellarRoute API
version: 0.1.0
description: |
REST API for DEX aggregation on the Stellar Network.
StellarRoute aggregates liquidity from Stellar's SDEX (Stellar Distributed
Exchange) and Soroban AMM pools to find the best available price for any
token pair.
## Asset identifiers
Assets are encoded in path segments using one of three formats:
| Format | Example | Meaning |
|--------|---------|---------|
| `native` | `native` | XLM (Stellar's native asset) |
| `CODE` | `USDC` | Issued asset — code only (omits issuer) |
| `CODE:ISSUER` | `USDC:GA5ZSEJ...` | Issued asset — fully qualified |
## Error handling
All errors return a JSON body with `error` (machine-readable code) and
`message` (human-readable description). See the `ErrorResponse` schema
and the **Error codes** section below for the full list.
## Rate limiting
Endpoints are rate-limited per IP address. When the limit is exceeded the
API returns **429 Too Many Requests** with `X-RateLimit-*` headers.
## Request correlation
Clients may optionally send `X-Request-ID` with any request. The API will
reuse that value, or generate a UUID when the header is omitted, and echo
the final request ID back in the `X-Request-ID` response header.
## Versioning and deprecation
`/api/v1/*` is in deprecation mode. Responses from v1 routes include
`Deprecation`, `Sunset`, and `Link` headers. Breaking removals require a
notice period and migration guidance.
contact:
name: StellarRoute
url: https://github.com/stellarroute/stellarroute
license:
name: MIT
url: https://opensource.org/licenses/MIT
servers:
- url: http://localhost:3000
description: Local development server
- url: https://api.stellarroute.io
description: Production server (future)
tags:
- name: health
description: Service health and readiness probes
- name: assets
description: Asset metadata — decimals, issuer labels, and trustline hints
- name: activity
description: Indexed on-chain contract swap activity
- name: trading
description: Market data — trading pairs, orderbooks, and price quotes
paths:
/health:
get:
operationId: health_check
summary: Service health check
description: |
Probes PostgreSQL and Redis (when configured) and returns a per-component
status map.
Returns **200 OK** when all required dependencies are healthy.
Returns **503 Service Unavailable** when any required dependency is down.
tags:
- health
responses:
"200":
description: All dependencies healthy
content:
application/json:
schema:
$ref: "#/components/schemas/HealthResponse"
example:
status: healthy
timestamp: "2026-02-23T12:00:00Z"
version: "0.1.0"
components:
database: healthy
redis: healthy
horizon: healthy
soroban_rpc: healthy
"503":
description: One or more dependencies unhealthy
content:
application/json:
schema:
$ref: "#/components/schemas/HealthResponse"
example:
status: unhealthy
timestamp: "2026-02-23T12:00:00Z"
version: "0.1.0"
components:
database: degraded
redis: healthy
horizon: degraded
soroban_rpc: healthy
/health/deps:
get:
operationId: dependency_health
summary: Dependency readiness check
description: |
Returns per-dependency readiness status for infrastructure and external
providers (PostgreSQL, Redis, Horizon, Soroban RPC).
Returns **200 OK** when dependencies are healthy.
Returns **503 Service Unavailable** when one or more are degraded.
tags:
- health
responses:
"200":
description: Dependencies healthy
content:
application/json:
schema:
$ref: "#/components/schemas/DependenciesHealthResponse"
example:
status: ok
timestamp: "2026-02-23T12:00:00Z"
components:
database: healthy
redis: healthy
horizon: healthy
soroban_rpc: healthy
"503":
description: One or more dependencies degraded
content:
application/json:
schema:
$ref: "#/components/schemas/DependenciesHealthResponse"
example:
status: degraded
timestamp: "2026-02-23T12:00:00Z"
components:
database: healthy
redis: healthy
horizon: degraded
soroban_rpc: degraded
/api/v1/assets:
get:
operationId: list_assets_metadata
summary: Bulk asset metadata
description: |
Returns metadata for multiple assets identified by their codes.
tags:
- assets
parameters:
- name: codes
in: query
description: Comma-separated list of asset codes (e.g. `XLM,USDC`)
required: true
schema:
type: string
example: XLM,USDC
responses:
"200":
description: List of asset metadata
content:
application/json:
schema:
$ref: "#/components/schemas/AssetMetadataBulkResponse"
"500":
description: Internal server error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/api/v1/assets/{code}:
get:
operationId: get_asset_metadata
summary: Get asset metadata
description: |
Returns decimals, issuer labels, and domain information for a single asset.
tags:
- assets
parameters:
- name: code
in: path
description: Asset code (e.g. `XLM`, `USDC`)
required: true
schema:
type: string
example: USDC
- name: issuer
in: query
description: Optional issuer address for disambiguating common codes.
required: false
schema:
type: string
example: GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN
responses:
"200":
description: Asset metadata
content:
application/json:
schema:
$ref: "#/components/schemas/AssetMetadataResponse"
"404":
description: Asset not found
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"500":
description: Internal server error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/api/v1/activity/swaps:
get:
operationId: list_swap_activity
summary: Recent indexed contract swaps
description: |
Returns a paginated list of indexed on-chain swap activity from the
`contract_swap_activity` table. Results are ordered by ledger
descending (most recent first).
Use `before_ledger` for cursor-based pagination and `limit` to
control page size (default 50, max 100).
tags:
- activity
parameters:
- name: limit
in: query
description: Maximum number of swaps to return, capped at 100.
required: false
schema:
type: integer
minimum: 1
maximum: 100
default: 50
- name: before_ledger
in: query
description: Return swaps with ledger sequence strictly less than this value.
required: false
schema:
type: integer
format: int64
example: 500000
responses:
"200":
description: Recent indexed contract swaps
content:
application/json:
schema:
$ref: "#/components/schemas/SwapActivityResponse"
example:
swaps:
- event_id: "evt_abc123"
contract_id: "CBKMVLHBS2SNEQIS3EMU3Q4A2OGG5OQ5Z23Q7ITX5DOFGZQD5OZ6PQZ4"
ledger: 499999
ledger_closed_at: "2026-08-20T14:30:00Z"
paging_token: "499999-0"
sender: "GBV4FDE6VRZHQ2YG5NKB7RJE36GDEW3Y3L6YQ4Q5UZ6VJZGJLKZ46AAA"
amount_in: "10.0000000"
amount_out: "1.0500000"
fee_amount: "0.0000100"
route:
from_asset: native
to_asset: "USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN"
source: sdex
source_asset: native
destination_asset: "USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN"
"500":
description: Internal server error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"429":
$ref: "#/components/responses/RateLimited"
/api/v1/pairs:
get:
operationId: list_pairs
summary: List trading pairs
description: |
Returns active trading pairs that currently have offers in the SDEX
orderbook.
Stable sort order:
1. `offer_count DESC`
2. `last_updated DESC`
3. Canonical asset fields ascending as deterministic tie-breakers
Pagination:
- Default page size: `25`
- Max page size: `100`
- `cursor` (preferred) or `offset` (fallback)
tags:
- trading
parameters:
- $ref: "#/components/parameters/PageLimit"
- $ref: "#/components/parameters/PageCursor"
- $ref: "#/components/parameters/PageOffset"
responses:
"200":
description: List of active trading pairs
headers:
Deprecation:
$ref: "#/components/headers/DeprecationHeader"
Sunset:
$ref: "#/components/headers/SunsetHeader"
Link:
$ref: "#/components/headers/DeprecationLinkHeader"
content:
application/json:
schema:
$ref: "#/components/schemas/PairsResponse"
example:
pairs:
- base: XLM
counter: USDC
base_asset: native
counter_asset: "USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN"
offer_count: 42
last_updated: "2026-02-23T11:59:00Z"
- base: USDC
counter: BTC
base_asset: "USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN"
counter_asset: "BTC:GAUTUYY2THLF7SGITDFMXJVYH3LHDSMGEAKSBU267M2K7A3W543CKUEF"
offer_count: 17
last_updated: "2026-02-23T11:58:30Z"
total: 2
limit: 25
next_cursor: "25"
prev_cursor: null
"400":
description: Invalid pagination parameters
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
example:
v: 1
timestamp: 1740312000000
request_id: req_01hyxk6bzv4n9p8m8j1f4c0a2r
data:
error: validation_error
message: Invalid cursor; expected a numeric offset
"404":
description: Trading pairs not found
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
example:
v: 1
timestamp: 1740312000000
request_id: req_01hyxk6bzv4n9p8m8j1f4c0a2r
data:
error: not_found
message: No trading pairs found
"500":
description: Internal server error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
example:
v: 1
timestamp: 1740312000000
request_id: req_01hyxk6bzv4n9p8m8j1f4c0a2r
data:
error: internal_error
message: An internal error occurred
"429":
$ref: "#/components/responses/RateLimited"
/api/v1/markets:
get:
operationId: list_markets
summary: List markets
description: Alias of `/api/v1/pairs` with identical pagination and sorting.
tags:
- trading
parameters:
- $ref: "#/components/parameters/PageLimit"
- $ref: "#/components/parameters/PageCursor"
- $ref: "#/components/parameters/PageOffset"
responses:
"200":
description: List of active markets
headers:
Deprecation:
$ref: "#/components/headers/DeprecationHeader"
Sunset:
$ref: "#/components/headers/SunsetHeader"
Link:
$ref: "#/components/headers/DeprecationLinkHeader"
content:
application/json:
schema:
$ref: "#/components/schemas/PairsResponse"
"400":
description: Invalid pagination parameters
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"500":
description: Internal server error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"429":
$ref: "#/components/responses/RateLimited"
/api/v1/orderbook/{base}/{quote}:
get:
operationId: get_orderbook
summary: Get orderbook
description: |
Returns bids and asks for the given base/quote asset pair.
**Bids** are orders to buy the base asset with the quote asset
(sorted highest price first). **Asks** are orders to sell the base
asset for the quote asset (sorted lowest price first).
Results are cached for **10 seconds**.
tags:
- trading
parameters:
- $ref: "#/components/parameters/BaseAsset"
- $ref: "#/components/parameters/QuoteAsset"
responses:
"200":
description: Orderbook data
content:
application/json:
schema:
$ref: "#/components/schemas/OrderbookResponse"
example:
base_asset:
asset_type: native
asset_code: null
asset_issuer: null
quote_asset:
asset_type: credit_alphanum4
asset_code: USDC
asset_issuer: GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN
bids:
- price: "0.1050000"
amount: "500.0000000"
total: "52.5000000"
asks:
- price: "0.1060000"
amount: "300.0000000"
total: "31.8000000"
summary:
bid: "0.1050000"
ask: "0.1060000"
spread_bps: 95
midpoint: "0.1055000"
timestamp: 1740312000
"400":
description: Invalid asset identifier
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
example:
v: 1
timestamp: 1740312000000
request_id: req_01hyxk6bzv4n9p8m8j1f4c0a2r
data:
error: invalid_asset
message: "Invalid base asset: unknown asset format"
"404":
description: Asset pair not found in the orderbook
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
example:
v: 1
timestamp: 1740312000000
request_id: req_01hyxk6bzv4n9p8m8j1f4c0a2r
data:
error: not_found
message: Asset not found in orderbook
"500":
description: Internal server error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
example:
v: 1
timestamp: 1740312000000
request_id: req_01hyxk6bzv4n9p8m8j1f4c0a2r
data:
error: internal_error
message: An internal error occurred
"429":
$ref: "#/components/responses/RateLimited"
/api/v1/price-history/{base}/{quote}:
get:
operationId: get_price_history
summary: Get 24h price history
description: |
Returns a lightweight 24h sparkline series for the selected trading pair.
The backend derives the series from `orderbook_snapshots.mid_price`
using hourly aggregation buckets. If no snapshots are available in the
trailing 24h window, the endpoint returns an empty `points` array.
tags:
- trading
parameters:
- $ref: "#/components/parameters/BaseAsset"
- $ref: "#/components/parameters/QuoteAsset"
responses:
"200":
description: 24h price history
content:
application/json:
schema:
$ref: "#/components/schemas/PriceHistoryResponse"
example:
base_asset:
asset_type: native
asset_code: null
asset_issuer: null
quote_asset:
asset_type: credit_alphanum4
asset_code: USDC
asset_issuer: GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN
window: "24h"
source: orderbook_snapshots.mid_price
generated_at: 1740312000000
points:
- timestamp: 1740225600000
price: "0.1051000"
- timestamp: 1740229200000
price: "0.1054000"
"400":
description: Invalid asset identifier
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"404":
description: Trading pair not found
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"500":
description: Internal server error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/api/v1/quote/{base}/{quote}:
get:
operationId: get_quote
summary: Get price quote
description: |
Returns the best available price and routing path for trading `amount`
of the base asset for the quote asset (or vice-versa when
`quote_type=buy`).
The router evaluates both SDEX offers and Soroban AMM pools to find
the optimal execution path.
Results are cached for **5 seconds**. Large responses honor
`Accept-Encoding: br` or `Accept-Encoding: gzip`; smaller responses
remain uncompressed. Prometheus metrics track original versus wire
response bytes.
tags:
- trading
parameters:
- $ref: "#/components/parameters/BaseAsset"
- $ref: "#/components/parameters/QuoteAsset"
- $ref: "#/components/parameters/RequestIdHeader"
- name: amount
in: query
description: Amount of the base asset to trade (default `1`)
required: false
schema:
type: string
example: "100"
- name: slippage_bps
in: query
description: Slippage tolerance in basis points (e.g. `50` = 0.50%). Max `10000` (100%).
required: false
schema:
type: integer
default: 50
example: 100
- name: quote_type
in: query
description: |
Direction of the quote:
- `sell` — how much quote asset you receive when **selling** `amount` of the base asset
- `buy` — how much base asset you must spend to **buy** `amount` of the quote asset
required: false
schema:
type: string
enum: [sell, buy]
default: sell
- name: Accept-Encoding
in: header
description: Optional response compression negotiation. Large quote responses support `br` and `gzip`; smaller responses remain uncompressed.
required: false
schema:
type: string
responses:
"200":
description: Best available price quote
headers:
X-Request-ID:
$ref: "#/components/headers/RequestIdHeader"
Vary:
schema:
type: string
description: Includes `Accept-Encoding` when quote response compression is negotiated.
Content-Encoding:
schema:
type: string
enum: [br, gzip]
description: Present when the quote response is compressed.
content:
application/json:
schema:
$ref: "#/components/schemas/QuoteResponse"
example:
base_asset:
asset_type: native
asset_code: null
asset_issuer: null
quote_asset:
asset_type: credit_alphanum4
asset_code: USDC
asset_issuer: GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN
amount: "100.0000000"
price: "0.1055000"
total: "10.5500000"
quote_type: sell
degraded: false
path:
- from_asset:
asset_type: native
asset_code: null
asset_issuer: null
to_asset:
asset_type: credit_alphanum4
asset_code: USDC
asset_issuer: GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN
price: "0.1055000"
source: sdex
timestamp: 1740312000
"400":
description: Invalid parameters (bad asset format or non-positive amount)
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
example:
v: 1
timestamp: 1740312000000
request_id: req_01hyxk6bzv4n9p8m8j1f4c0a2r
data:
error: validation_error
message: Amount must be greater than zero
"404":
description: No trading route found for this pair
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
example:
v: 1
timestamp: 1740312000000
request_id: req_01hyxk6bzv4n9p8m8j1f4c0a2r
data:
error: no_route
message: No trading route found for this pair
"422":
description: Stale market data — all data sources are too old to provide a quote
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
example:
error: stale_market_data
message: All market data inputs are stale
details:
stale_count: 5
fresh_count: 0
threshold_secs_sdex: 60
threshold_secs_amm: 120
"500":
description: Internal server error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
example:
v: 1
timestamp: 1740312000000
request_id: req_01hyxk6bzv4n9p8m8j1f4c0a2r
data:
error: internal_error
message: An internal error occurred
"429":
$ref: "#/components/responses/RateLimited"
/api/v1/route/{base}/{quote}:
get:
operationId: get_route
summary: Get trading route
deprecated: true
description: |
Returns only the optimal execution path and routing steps for trading
`amount` of the base asset for the quote asset.
Unlike the quote endpoint, this returns a simplified response without
detailed pricing breakdown or venue evaluations.
This legacy route is deprecated in favor of `/api/v1/routes/{base}/{quote}`.
Clients should watch the `Deprecation`, `Sunset`, and `Link` headers and
migrate using the guidance in `docs/api/versioning.md`.
tags:
- trading
parameters:
- $ref: "#/components/parameters/BaseAsset"
- $ref: "#/components/parameters/QuoteAsset"
- name: amount
in: query
description: Amount of the base asset to trade (default `1`)
required: false
schema:
type: string
example: "100"
- name: slippage_bps
in: query
description: Slippage tolerance in basis points (e.g. `50` = 0.50%). Max `10000` (100%).
required: false
schema:
type: integer
default: 50
example: 100
- name: quote_type
in: query
description: |
Direction of the quote:
- `sell` — how much quote asset you receive when **selling** `amount` of the base asset
- `buy` — how much base asset you must spend to **buy** `amount` of the quote asset
required: false
schema:
type: string
enum: [sell, buy]
default: sell
responses:
"200":
description: Optimal trading route
content:
application/json:
schema:
$ref: "#/components/schemas/RouteResponse"
"400":
description: Invalid parameters (bad asset format or invalid slippage)
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"404":
description: No trading route found for this pair
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"500":
description: Internal server error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"429":
$ref: "#/components/responses/RateLimited"
components:
parameters:
RequestIdHeader:
name: X-Request-ID
in: header
required: false
description: Optional client-supplied correlation ID echoed back by the API.
schema:
type: string
example: support-ticket-42
BaseAsset:
name: base
in: path
required: true
description: |
Base asset identifier. One of:
- `native` — XLM
- `CODE` — issued asset code only (e.g. `USDC`)
- `CODE:ISSUER` — fully-qualified issued asset (e.g. `USDC:GA5Z...`)
schema:
type: string
example: native
QuoteAsset:
name: quote
in: path
required: true
description: |
Quote asset identifier. One of:
- `native` — XLM
- `CODE` — issued asset code only (e.g. `USDC`)
- `CODE:ISSUER` — fully-qualified issued asset (e.g. `USDC:GA5Z...`)
schema:
type: string
example: USDC
PageLimit:
name: limit
in: query
required: false
description: Page size. Default 25, max 100.
schema:
type: integer
minimum: 1
maximum: 100
default: 25
PageCursor:
name: cursor
in: query
required: false
description: Cursor for the next page (numeric offset token).
schema:
type: string
example: "25"
PageOffset:
name: offset
in: query
required: false
description: Offset fallback for pagination when cursor is not used.
schema:
type: integer
minimum: 0
example: 50
responses:
RateLimited:
description: Rate limit exceeded
headers:
X-RateLimit-Limit:
description: Maximum number of requests allowed in the current window
schema:
type: integer
X-RateLimit-Remaining:
description: Number of requests remaining in the current window
schema:
type: integer
X-RateLimit-Reset:
description: Unix timestamp when the rate limit window resets
schema:
type: integer
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
example:
error: rate_limit_exceeded
message: Too many requests — please slow down
headers:
RequestIdHeader:
description: Correlation ID for the request. Echoes the client-provided value or a server-generated UUID.
schema:
type: string
example: 6b20dc6f-0cab-4f3f-b4eb-4638dbfd0f9d
DeprecationHeader:
description: Indicates that the endpoint version is deprecated.
schema:
type: string
example: "true"
SunsetHeader:
description: RFC 7231 IMF-fixdate indicating planned v1 sunset.
schema:
type: string
example: "Wed, 31 Dec 2026 23:59:59 GMT"
DeprecationLinkHeader:
description: Link to migration guidance for deprecated v1 routes.
schema:
type: string
example: '</docs/api/v1-migration-guide>; rel="deprecation"'
schemas:
HealthResponse:
type: object
required: [status, timestamp, version, components]
description: Service health check result
properties:
status:
type: string
description: Overall health status
enum: [healthy, unhealthy]
example: healthy
timestamp:
type: string
format: date-time
description: ISO-8601 UTC timestamp of the health check
example: "2026-02-23T12:00:00Z"
version:
type: string
description: Deployed crate version
example: "0.1.0"
components:
type: object
description: Per-dependency health status
additionalProperties:
type: string
example:
database: healthy
redis: not_configured
horizon: not_configured
soroban_rpc: not_configured
DependenciesHealthResponse:
type: object
required: [status, timestamp, components]
description: Dependency-only health status for readiness checks
properties:
status:
type: string
enum: [ok, degraded]
example: ok
timestamp:
type: string
format: date-time
example: "2026-02-23T12:00:00Z"
components:
type: object
additionalProperties:
type: string
example:
database: healthy
redis: healthy
horizon: healthy
soroban_rpc: degraded
AssetInfo:
type: object
required: [asset_type]
description: Stellar asset descriptor
properties:
asset_type:
type: string
description: Stellar asset type
enum: [native, credit_alphanum4, credit_alphanum12]
example: credit_alphanum4
asset_code:
type: string
nullable: true
description: Asset code (null for native XLM)
example: USDC
asset_issuer:
type: string
nullable: true
description: G-address of the issuing account (null for native XLM)
example: GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN
TradingPair:
type: object
required: [base, counter, base_asset, counter_asset, offer_count]
description: A tradeable asset pair with active orderbook depth
properties:
base:
type: string
description: Human-readable base asset code
example: XLM
counter:
type: string
description: Human-readable counter asset code
example: USDC