-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathopenapi.json
More file actions
14103 lines (14103 loc) · 435 KB
/
openapi.json
File metadata and controls
14103 lines (14103 loc) · 435 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.0",
"info": {
"title": "Backpack Exchange API",
"description": "\n# Introduction\n\nWelcome to the Backpack Exchange API. This API is for programmatic trade execution. All of the endpoints require requests to be signed with an ED25519 keypair for authentication.\n\nThe API is hosted at `https://api.backpack.exchange/` and the WS API is hosted at `wss://ws.backpack.exchange/`.\n\n# Authentication\n\n\n## Signing requests\n\nSigned requests are required for any API calls that mutate state. Additionally, some read only requests can be performed by signing or via session authentication.\n\nSigned requests require the following additional headers:\n\n- `X-Timestamp` - Unix time in milliseconds that the request was sent.\n- `X-Window` - Time window in milliseconds that the request is valid for, default is `5000` and maximum is `60000`.\n- `X-API-Key` - Base64 encoded verifying key of the ED25519 keypair.\n- `X-Signature` - Base64 encoded signature generated according to the instructions below.\n\n### Generate ED25519 Keys\n\nYou can generate a private/public ED25519 keypair using this Python one-liner:\n\n```python\npython3 -c \"from cryptography.hazmat.primitives.asymmetric import ed25519; import base64; key = ed25519.Ed25519PrivateKey.generate(); seed = key.private_bytes_raw(); pub = key.public_key().public_bytes_raw(); print(f'Seed: {base64.b64encode(seed).decode()}\\nPublic Key: {base64.b64encode(pub).decode()}')\"\n```\n\nThis will output your base64-encoded private key (seed) and public key that can be used for API authentication.\n\n### Signature Generation\n\nTo generate a signature perform the following:\n\n1) The key/values of the request body or query parameters should be ordered alphabetically and then turned into query string format.\n\n2) Append the header values for the timestamp and receive window to the above generated string in the format `×tamp=<timestamp>&window=<window>`. If no `X-Window` header is passed the default value of `5000` still needs to be added to the signing string.\n\nEach request also has an instruction type, valid instructions are:\n\n```\naccountQuery\nbalanceQuery\nborrowLendExecute\nborrowHistoryQueryAll\ncollateralQuery\ndepositAddressQuery\ndepositQueryAll\nfillHistoryQueryAll\nfundingHistoryQueryAll\ninterestHistoryQueryAll\norderCancel\norderCancelAll\norderExecute\norderHistoryQueryAll\norderQuery\norderQueryAll\npnlHistoryQueryAll\npositionHistoryQueryAll\npositionQuery\nquoteSubmit\nstrategyCancel\nstrategyCancelAll\nstrategyCreate\nstrategyHistoryQueryAll\nstrategyQuery\nstrategyQueryAll\nwithdraw\nwithdrawalQueryAll\n```\n\nThe correct instruction type should be prefixed to the signing string. The instruction types for each request are documented alongside the request.\n\nFor example, an API request to cancel an order with the following body:\n\n```json\n{\n \"orderId\": 28\n \"symbol\": \"BTC_USDT\",\n}\n```\n\nWould require the following to be signed:\n\n```text\ninstruction=orderCancel&orderId=28&symbol=BTC_USDT×tamp=1614550000000&window=5000\n```\n\nRegarding batch order execution (`POST /orders`), for each order in the batch, the order parameters should be ordered alphabetically and then turned into query string format. The orderExecute instruction should then be prefixed to that string.\nThe query strings for the orders should be concatenated with `&` and the timestamp and window appended at the end.\n\nFor example, an API request for an order execution batch with the following body:\n\n```json\n[\n {\n \"symbol\": \"SOL_USDC_PERP\",\n \"side\": \"Bid\",\n \"orderType\": \"Limit\",\n \"price\": \"141\",\n \"quantity\": \"12\"\n },\n {\n \"symbol\": \"SOL_USDC_PERP\",\n \"side\": \"Bid\",\n \"orderType\": \"Limit\",\n \"price\": \"140\",\n \"quantity\": \"11\"\n }\n]\n```\n\nWould require the following to be signed:\n\n```text\ninstruction=orderExecute&orderType=Limit&price=141&quantity=12&side=Bid&symbol=SOL_USDC_PERP&instruction=orderExecute&orderType=Limit&price=140&quantity=11&side=Bid&symbol=SOL_USDC_PERP×tamp=1750793021519&window=5000\n```\n\nIf the API endpoint requires query parameters instead of a request body, the same procedure should be used on the query parameters. If the API endpoint does not have a request body or query parameters, only the timestamp and receive window need to be signed.\n\nThis message should be signed using the private key of the ED25519 keypair that corresponds to the public key in the `X-API-Key` header. The signature should then be base64 encoded and submitted in the `X-Signature` header.\n\n\n<br /><br />\n\n---\n\n# Changelog\n\n## 2025-11-12\n\n- Backstop liquidation fills now include a non-zero `tradeId` field on an on-going basis. Previously such fills had a\n zero `tradeId`. This applies to the `/fills` endpoint as well as the trade stream.\n\n## 2025-11-10\n\n- Add a specific error message for withdrawal attempts to non-2FA exempt withdrawal addresses.\n- Set a default limit of `1000` levels each side of the book for `/depth` endpoint.\n\n## 2025-10-23\n\n- Add `j` and `k` fields to the order update stream (take profit limit price and stop loss limit price).\n\n## 2025-09-02\n\n- The `/depth` endpoint now returns a limit of 5,000 price levels on each side of the book.\n\n## 2025-09-01\n\n- The `cumulativeInterest` response field is being removed from the `/position`endpoint.\n- Estimated liquidation price or `l` is being removed from the position update stream. It will remain as a placeholder\n and be set to 0. It will be removed in the future, so client's should not rely on its presence.\n- Liquidation price can be queried for a single position using the Positions API `/position` for example\n `/position?symbol=BTC_USDC_PERP`.\n\n## 2025-08-07\n\n- `/history/pnl` has been removed.\n\n## 2025-06-08\n\n- The order id format is changing, it is no longer a byte shifted timestamp. It is no longer possible to derive the\n order timestamp from the order id. This change will take place at Monday June 9th, 01:00 UTC.\n\n## 2025-04-22\n\n- The `/fills` endpoint now returns all fills for the account, including fills from system orders as well as client\n orders. System orders include liquidations, ADLs and collateral conversions. Previously, by default, it only returned\n fills from client orders. This behavior can be achieved by setting the `fillType` parameter to `User`.\n\n## 2025-04-08\n\n- Added funding rate lower and upper bounds to `/markets` and `/market` endpoints.\n\n## 2025-03-26\n\n- Add open interest stream `openInterest.<symbol>`.\n- Added the option to query `/history/borrowLend/positions` with a signed request using the instruction\n `borrowPositionHistoryQueryAll`.\n\n## 2025-03-19\n\n- The leverage filter has been removed from `/markets` and `/market` endpoints.\n- Added `/openInterest` now takes `symbol` as an optional parameter. When not set, all markets are returned.\n- `/openInterests` has been deprecated.\n- Add stop loss and take profit fields to `/orders/execute`.\n- Add `I` field to the order update stream (related order id).\n- Add `a` and `b` fields to the order update stream (take profit trigger price and stop loss trigger price).\n\n## 2025-02-28\n\n- Added `clientId` to fill history.\n\n## 2025-02-11\n\n- An `O` field has been added to the order update stream. It denotes the origin of the update. The possible values are:\n - `USER`: The origin of the update was due to order entry by the user.\n - `LIQUIDATION_AUTOCLOSE`: The origin of the update was due to a liquidation by the liquidation engine.\n - `ADL_AUTOCLOSE`: The origin of the update was due to an ADL (auto-deleveraging) event.\n - `COLLATERAL_CONVERSION`: The origin of the update was due to a collateral conversion to settle debt on the\n account.\n - `SETTLEMENT_AUTOCLOSE`: The origin of the update was due to the settlement of a position on a dated market.\n - `BACKSTOP_LIQUIDITY_PROVIDER`: The origin of the update was due to a backstop liquidity provider facilitating a\n liquidation.\n\n## 2025-02-07\n\n- Added `r` to denote a reduce only order on the order updates stream.\n- Added `reduceOnly` to the get orders endpoint.\n\n## 2025-02-03\n\n- Added `openInterestLimit` to the markets endpoint. Applicable to futures markets only.\n- Added `orderModified` event to the order update stream. A resting reduce only order's quantity can be decreased in\n order to prevent position side reversal.\n\n## 2025-01-09\n\n- Added `marketType` to the markets endpoint.\n- Added an optional `marketType` filter to the fills and the orders endpoints.\n\n## 2024-12-03\n\n- Add order expiry reason to order update stream.\n- Add `cumulativeInterest` to borrow lend position.\n\n## 2024-12-02\n\n- Add borrow lend history per position endpoint.\n\n## 2024-11-10\n\n- Add `timestamp` field denoting the system time in unix-epoch microseconds to the depth endpoint.\n\n## 2024-10-15\n\n- Convert all error responses to JSON and add a error code.\n\n## 2024-05-14\n\n- Add `executedQuantity` and `executedQuoteQuantity` to order history endpoint.\n\n## 2024-05-03\n\n- Add single market order update stream `account.orderUpdate.<symbol>`.\n\n## 2024-05-02\n\n- Add optional `from` and `to` timestamp to get withdrawals endpoint.\n\n## 2024-05-01\n\n- Add optional `from` and `to` timestamp to get deposits endpoint.\n\n## 2024-03-14\n\n- Add optional `orderId` filter to order history endpoint.\n- Add optional `from` and `to` timestamp to order fills endpoint.\n\n## 2024-02-28\n\n- Return the withdrawal in request withdrawal response.\n\n## 2024-02-24\n\n- An additional field `t` was added to the private order update stream. It is the `trade_id` of the fill that generated\n the order update.\n- Added a maximum value for the `X-Window` header of `60000`.\n\n## 2024-01-16\n\n### Breaking\n\n- A new websocket API is available at `wss://ws.backpack.exchange`. Please see the documentation. The previous API\n remains on the same endpoint and will be deprecated after a migration period. The new API changes the following:\n - Subscription endpoint is now `wss://ws.backpack.exchange` instead of `wss://ws.backpack.exchange/stream`.\n - Can subscribe and unsubscribe to/from multiple streams by passing more than one in the `params` field.\n - Signature should now be sent in a separate `signature` field.\n - Signature instruction changed from `accountQuery` to `subscribe`.\n - Event and engine timestamps are now in `microseconds` instead of `milliseconds`.\n - Add engine timestamp to `bookTicker`, `depth`, and `order` streams.\n - Add quote asset volume to ticker stream.\n - Add sequential trade id to trade stream.\n - Rename the event type in the depth stream from `depthEvent` to `depth`.\n - Change the format of streams from `<symbol>@<type>` to `<type>.<symbol>` or `kline.<interval>.<symbol>` for\n K-lines.\n - Flatten the K-Line in the K-line stream so its not nested.\n\n## 2024-01-11\n\n### Breaking\n\n- Replaced `identifier` field on deposits with `transaction_hash` and `provider_id`.\n This aims to provide clearer representation of the field, particularly for fiat deposits.\n- Removed duplicate `pending` values from the `WithdrawalStatus` and `DepositStatus` spec enum.\n\n\n<br /><br />\n\n---\n ",
"version": "1.0",
"x-logo": {
"url": "https://cdn.prod.website-files.com/66830ad123bea7f626bcf58f/68eccb03852237fd98ffad9b_Backpack-Icon-Color.svg",
"altText": "Backpack Exchange"
}
},
"servers": [
{
"url": "https://api.backpack.exchange"
}
],
"tags": [
{
"name": "API Keys",
"description": "API key Management."
},
{
"name": "Account",
"description": "Account settings and limits."
},
{
"name": "Account Limits",
"description": "Account Limits."
},
{
"name": "Achievements",
"description": "Achievements."
},
{
"name": "Address",
"description": "Saved addresses."
},
{
"name": "Affiliate",
"description": "Affiliate program."
},
{
"name": "Assets",
"description": "Assets and collateral data."
},
{
"name": "Banxa",
"description": "Banxa fiat on-ramp integration for crypto purchases."
},
{
"name": "Bolt Card",
"description": "Bolt card issuance and management."
},
{
"name": "Borrow Lend",
"description": "Borrowing and lending."
},
{
"name": "Borrow Lend Markets",
"description": "Borrowing and lending."
},
{
"name": "Capital",
"description": "Capital management."
},
{
"name": "Country",
"description": "Country management."
},
{
"name": "Disclosures",
"description": "Disclosures"
},
{
"name": "Easy Euro",
"description": "Easy Euro fiat deposit and withdrawal operations."
},
{
"name": "Entity",
"description": "Entity operations."
},
{
"name": "Equals Money",
"description": "Equals Money fiat deposit and withdrawal operations."
},
{
"name": "European Private Beta",
"description": "EU private beta program operations."
},
{
"name": "FTX Creditor Claims",
"description": "FTX Creditor Claims."
},
{
"name": "Front",
"description": "Webhooks for Front customer service platform integration."
},
{
"name": "Keypair",
"description": "Keypair management."
},
{
"name": "Know Your Customer",
"description": "KYC management."
},
{
"name": "Know Your Transaction",
"description": "KYT management."
},
{
"name": "Market Data",
"description": "Market data."
},
{
"name": "Markets",
"description": "Public market data."
},
{
"name": "Notifications",
"description": "User notification preferences."
},
{
"name": "Order",
"description": "Order management."
},
{
"name": "Passkeys",
"description": "Passkey registration and management for passwordless authentication."
},
{
"name": "Performance",
"description": "Performance."
},
{
"name": "Portfolio",
"description": "User portfolio."
},
{
"name": "Position",
"description": "Positions and futures data."
},
{
"name": "Preferences",
"description": "User preferences."
},
{
"name": "Proof of Reserves",
"description": "Proof of reserves."
},
{
"name": "Public Profile",
"description": "Public profile."
},
{
"name": "RFQ",
"description": "RFQ (Request For Quote) - Maker."
},
{
"name": "Rewards",
"description": "Rewards."
},
{
"name": "Risk Dashboard",
"description": "Risk Dashboard."
},
{
"name": "Safe",
"description": "Safe data."
},
{
"name": "Satoshi Test",
"description": "Satoshi test for address ownership verification."
},
{
"name": "Service",
"description": "Service tokens."
},
{
"name": "Session",
"description": "Login session management."
},
{
"name": "Staking",
"description": "Staking."
},
{
"name": "Statistics",
"description": "Statistics"
},
{
"name": "Strategy",
"description": "Strategies."
},
{
"name": "Streams",
"description": "# Usage\n\n## Subscribing\n\nTo use the websocket API, connect to\n`wss://ws.backpack.exchange`.\n\nTo subscribe to a stream with the name `stream` send a text frame\nover the websocket connection with the following JSON payload:\n\n```\n{\n \"method\": \"SUBSCRIBE\",\n \"params\": [\"stream\"]\n}\n```\n\nSimilarly, to unsubscribe from a stream with the name `stream`:\n\n```\n{\n \"method\": \"UNSUBSCRIBE\",\n \"params\": [\"stream\"]\n}\n```\n\nYou can subscribe or unsubscribe from multiple streams if you include\nmore than one in the params field.\n\nAll data from streams is wrapped in a JSON object of the following form:\n\n```\n{\n \"stream\": \"<stream>\",\n \"data\": \"<payload>\"\n}\n```\n\nThe following command can be used to test subscribing to a stream:\n```\n(sleep 1; \\\necho '{\"method\":\"SUBSCRIBE\",\"params\":[\"depth.SOL_USDC\"]}';\\\ncat) |\\\nwscat -c wss://ws.backpack.exchange\n```\nThe payloads for each stream time are outlined below.\n\n## Timing\n\nTimestamps are in microseconds (except for the K-line start and end\ntimes). The event timestamp is the time the event was emitted from\nthe websocket server, and the engine timestamp is the time the event\nwas generated by the matching engine.\n\nIf a message aggregates more than one event (for example, a depth\nmessage), the engine timestamp will be the timestamp of the last\nmatching engine event.\n\n## Keeping the connection alive\n\nTo keep the connection alive, a `Ping` frame will be sent from the\nserver every 60s, and a `Pong` is expected to be received from the\nclient. If a `Pong` is not received within 120s, a `Close` frame will be\nsent and the connection will be closed.\n\nIf the server is shutting down, a `Close` frame will be sent and then a\ngrace period of 30s will be given before the connection is closed. The\nclient should reconnect after receiving the `Close` frame. The client\nwill be reconnected to a server that is not shutting down.\n\n# Private\n\nSubscribing to a private stream requires a valid signature generated\nfrom an ED25519 keypair. For stream subscriptions, the signature\nshould be of the form:\n\n```text\ninstruction=subscribe×tamp=1614550000000&window=5000\n```\n\nWhere the timestamp and window are in milliseconds.\n\nPrivate streams are prefixed with `account.` and require signature data\nto be submitted in the subscribe parameters. The verifying key and\nsignature should be base64 encoded.\n\n```\n{\n \"method\": \"SUBSCRIBE\",\n \"params\": [\"stream\"],\n \"signature\": [\"<verifying key>\", \"<signature>\", \"<timestamp>\", \"<window>\"]\n}\n````\n\n## Order update\n\nOn any mutation to an order the order will be pushed to the order update\nstream. The event type of the order update will be one of the\nfollowing:\n\n- `orderAccepted`\n- `orderCancelled`\n- `orderExpired`\n- `orderFill`\n- `orderModified`\n- `triggerPlaced`\n- `triggerFailed`\n\nAn `orderModified` update will be received when a resting reduce only\norder's quantity is decreased in order to prevent position side\nreversal.\n\n### Stream Name Format\n- For all markets: `account.orderUpdate`\n- For single market: `account.orderUpdate.<symbol>`\n\n```\n{\n \"e\": \"orderAccepted\", // Event type\n \"E\": 1694687692980000, // Event time in microseconds\n \"s\": \"SOL_USD\", // Symbol\n \"c\": 123, // Client order ID\n \"S\": \"Bid\", // Side\n \"o\": \"LIMIT\", // Order type\n \"f\": \"GTC\", // Time in force\n \"q\": \"32123\", // Quantity\n \"Q\": \"32123\", // Quantity in quote\n \"p\": \"20\", // Price\n \"P\": \"21\", // Trigger price\n \"B\": \"LastPrice\", // Trigger by\n \"a\": \"30\", // Take profit trigger price\n \"b\": \"10\", // Stop loss trigger price\n \"j\": \"30\", // Take profit limit price\n \"k\": \"10\", // Stop loss limit price\n \"d\": \"MarkPrice\", // Take profit trigger by\n \"g\": \"IndexPrice\", // Stop loss trigger by\n \"Y\": \"10\", // Trigger quantity\n \"X\": \"New\", // Order state\n \"R\": \"PRICE_BAND\", // Order expiry reason\n \"i\": \"1111343026172067\" // Order ID\n \"t\": 567, // Trade ID\n \"l\": \"1.23\", // Fill quantity\n \"z\": \"321\", // Executed quantity\n \"Z\": \"123\", // Executed quantity in quote\n \"L\": \"20\", // Fill price\n \"m\": true, // Whether the order was maker\n \"n\": \"23\", // Fee\n \"N\": \"USD\", // Fee symbol\n \"V\": \"RejectTaker\", // Self trade prevention\n \"T\": 1694687692989999, // Engine timestamp in microseconds\n \"O\": \"USER\" // Origin of the update\n \"I\": \"1111343026156135\" // Related order ID\n \"H\": 6023471188 // Strategy ID\n \"y\": true // Post only\n}\n```\n\nThere are several possible values for the `O` field (origin of the\nupdate):\n- `USER`: The origin of the update was due to order entry by the user.\n- `LIQUIDATION_AUTOCLOSE`: The origin of the update was due to a\nliquidation by the liquidation engine.\n- `ADL_AUTOCLOSE`: The origin of the update was due to an ADL\n(auto-deleveraging) event.\n- `COLLATERAL_CONVERSION`: The origin of the update was due to a\ncollateral conversion to settle debt on the account.\n- `SETTLEMENT_AUTOCLOSE`: The origin of the update was due to the\nsettlement of a position on a dated market.\n- `BACKSTOP_LIQUIDITY_PROVIDER`: The origin of the update was due to a\nbackstop liquidity provider facilitating a liquidation.\n\nSome fields are conditional on the order settings or event type:\n\n- `c` - Only present if the order has a client order ID.\n- `q` - Only present if the order has a quantity set.\n- `Q` - Only present if the order is reverse market order.\n- `p` - Only present if the order is a limit order.\n- `P` - Only present if the order is a trigger order.\n- `B` - Only present if the order is a trigger order.\n- `a` - Only present if the order has a take profit trigger price set.\n- `b` - Only present if the order has a stop loss trigger price set.\n- `d` - Only present if the order has a take profit trigger price set.\n- `g` - Only present if the order has a stop loss trigger price set.\n- `Y` - Only present if the order is a trigger order.\n- `R` - Only present if the event is a `orderExpired` event.\n- `t` - Only present if the event is a `orderFill` event.\n- `l` - Only present if the event is a `orderFill` event.\n- `L` - Only present if the event is a `orderFill` event.\n- `m` - Only present if the event is a `orderFill` event.\n- `n` - Only present if the event is a `orderFill` event.\n- `N` - Only present if the event is a `orderFill` event.\n\n## Position update\n\nOn any mutation to a position the position will be pushed to the\nposition update stream. The event type of the position update will\nbe one of the following:\n\n- `positionAdjusted`\n- `positionOpened`\n- `positionClosed`\n\nOn subscription, a message will be sent to the client with the current\nopen positions, if any. The `e` field will not be present in the\nmessage.\n\n### Stream Name Format\n- For all markets: `account.positionUpdate`\n- For single market: `account.positionUpdate.<symbol>`\n\n```\n{\n \"e\": \"positionOpened\", // Event type\n \"E\": 1694687692980000, // Event time in microseconds\n \"s\": \"SOL_USDC_PERP\", // Symbol\n \"b\": 123, // Break event price\n \"B\": 122, // Entry price\n \"f\": 0.5, // Initial margin fraction\n \"M\": 122, // Mark price\n \"m\": 0.01, // Maintenance margin fraction\n \"q\": 5, // Net quantity\n \"Q\": 6, // Net exposure quantity\n \"n\": 732 , // Net exposure notional\n \"i\": \"1111343026172067\" // Position ID\n \"p\": \"-1\", // PnL realized\n \"P\": \"0\", // PnL unrealized\n \"T\": 1694687692989999 // Engine timestamp in microseconds\n}\n```\n\nThe net quantity field will be positive if the position is long and\nnegative if the position is short.\n\nThe net exposure quantity field includes exposure from the open\nposition, as well as any open orders.\n\n## RFQ Update\n\nThis WebSocket stream provides real-time updates on RFQs (Request for\nQuotes) that are relevant to makers. Events are pushed to this\nstream whenever there is a significant state change in an RFQ or its\nassociated quotes, allowing makers to monitor and respond to RFQs as\nthey progress through various states.\n\n### Event Types\n\nFor RFQs that submitted by other requesters.\n- `rfqActive`: Indicates that an RFQ is active and open for quotes.\n\nFor RFQs that submitted by your account.\n- `rfqAccepted`: Indicates that an RFQ has been accepted and is no\n- `rfqRefreshed`: Indicates that an RFQ has been refreshed, is active\nand open for quotes.\n- `rfqCancelled`: Indicates that an RFQ has been cancelled or expired.\n- `rfqCandidate`: RFQ has received a new best quote.\n- `rfqFilled`: Indicates that an RFQ has been fully filled with a quote.\n\nFor Quotes submitted by your account.\n- `quoteAccepted`: Indicates that a quote submitted by the maker has\nbeen accepted.\n- `quoteCancelled`: Indicates that a quote has been cancelled due to\nquote submission, RFQ being filled, refreshed, cancelled, or expired.\n\n### Quote Submission and RFQ Timing\n\nMakers should submit quotes before the **submission time** (`w` field)\nis reached, as indicated in each `rfqActive` event. An RFQ remains\nactive until the **expiration time** (`W` field). If no quote is\naccepted or the RFQ is not cancelled, makers may continue to submit\nquotes until expiration.\n\nRFQs can periodically request new quotes by issuing additional\n`rfqActive` events. Each new `rfqActive` event will have the same\nRFQ ID (`R` field) but updated values for **submission time** and\n**expiration time**, allowing makers to participate in extended or\nrenewed quoting periods for ongoing RFQs.\n\n### Stream Name Format\n- For all markets: `account.rfqUpdate`\n- For single market: `account.rfqUpdate.<symbol>`\n\n### Example Messages\n\n**RFQ Accepted** (sent to requester)\n```\n{\n \"e\": \"rfqAccepted\", // Event type\n \"E\": 1730225420369829, // Event time in microseconds\n \"R\": 113392053149171712, // RFQ ID\n \"C\": \"123\", // Client RFQ ID\n \"s\": \"SOL_USDC_RFQ\", // Symbol\n \"S\": \"Bid\", // RFQ side\n \"q\": \"10\", // Quantity (if quantity in base asset)\n \"w\": 1730225480368, // Submission time in milliseconds\n \"W\": 1730225540368, // Expiry time in milliseconds\n \"X\": \"New\", // RFQ status\n \"T\": 1730225420368765 // Engine timestamp in microseconds\n}\n```\n\n**RFQ Active** (broadcast to all rfq listeners)\n```\n{\n \"e\": \"rfqActive\", // Event type\n \"E\": 1730225420369829, // Event time in microseconds\n \"R\": 113392053149171712, // RFQ ID\n \"s\": \"SOL_USDC_RFQ\", // Symbol\n \"q\": \"10\", // Quantity (optional) (if quantity in base asset)\n \"w\": 1730225480368, // Submission time in milliseconds\n \"W\": 1730225540368, // Expiry time in milliseconds\n \"X\": \"New\", // RFQ status\n \"T\": 1730225420368765 // Engine timestamp in microseconds\n}\n```\n\n**RFQ Refreshed** (sent to requester)\n```\n{\n \"e\": \"rfqRefreshed\", // Event type\n \"E\": 1730225450369829, // Event time in microseconds\n \"R\": 113392053149171712, // RFQ ID\n \"C\": \"123\", // Client RFQ ID\n \"s\": \"SOL_USDC_RFQ\", // Symbol\n \"S\": \"Bid\", // RFQ side\n \"q\": \"10\", // Quantity (optional) (if quantity in base asset)\n \"w\": 1730225480368, // Submission time in milliseconds\n \"W\": 1730225540368, // Expiry time in milliseconds\n \"X\": \"New\", // RFQ status\n \"T\": 1730225450368765 // Engine timestamp in microseconds\n}\n```\n\n**RFQ Cancelled** (sent to taker only)\n```\n{\n \"e\": \"rfqCancelled\", // Event type\n \"E\": 1730225460369829, // Event time in microseconds\n \"R\": 113392053149171712, // RFQ ID\n \"C\": \"123\", // Client RFQ ID\n \"s\": \"SOL_USDC_RFQ\", // Symbol\n \"S\": \"Bid\", // RFQ side\n \"Q\": \"150\", // Quote quantity (optional) (if quantity in quote asset)\n \"w\": 1730225480368, // Submission time in milliseconds\n \"W\": 1730225540368, // Expiry time in milliseconds\n \"X\": \"Cancelled\", // RFQ status\n \"T\": 1730225460368765 // Engine timestamp in microseconds\n}\n```\n\n**Quote Accepted** (sent to quoter)\n```\n{\n \"e\": \"quoteAccepted\", // Event type\n \"E\": 1730225434631394, // Event time in microseconds\n \"R\": 113392053149171712, // RFQ ID\n \"u\": 113392054083780608, // Quote ID\n \"C\": \"123\", // Client Quote ID\n \"s\": \"SOL_USDC_RFQ\", // Symbol\n \"X\": \"New\", // Quote status\n \"T\": 1730225434629778 // Engine timestamp in microseconds\n}\n```\n\n**Quote Cancelled** (sent to quoter)\n```\n{\n \"e\": \"quoteCancelled\", // Event type\n \"E\": 1730225583761963, // Event time in microseconds\n \"R\": 113392061354344448, // RFQ ID\n \"u\": 113392062870847488, // Quote ID\n \"C\": \"123\", // Client Quote ID\n \"s\": \"SOL_USDC_RFQ\", // Symbol\n \"X\": \"Cancelled\", // Quote status\n \"T\": 1730225583753811 // Engine timestamp in microseconds\n}\n```\n\n**RFQ Candidate** (sent to requester with quote details)\n```\n{\n \"e\": \"rfqCandidate\", // Event type\n \"E\": 1730225490648996, // Event time in microseconds\n \"R\": 113392053149171712, // RFQ ID\n \"u\": 113392054083780608, // Quote ID\n \"C\": \"123\", // Client RFQ ID\n \"s\": \"SOL_USDC_RFQ\", // Symbol\n \"S\": \"Bid\", // RFQ side\n \"q\": \"10\", // RFQ quantity (in base asset)\n \"Q\": \"150\", // RFQ quote quantity (in quote asset)\n \"p\": \"15.50\", // Taker price (quote price + fee)\n \"X\": \"New\", // RFQ status\n \"T\": 1730225490647080 // Engine timestamp in microseconds\n}\n```\n\n**RFQ Filled** (sent to both requester and quoter)\n```\n// To requester\n{\n \"e\": \"rfqFilled\", // Event type\n \"E\": 1730225497648996, // Event time in microseconds\n \"R\": 113392053149171712, // RFQ ID\n \"u\": 113392054083780608, // Quote ID\n \"C\": \"123\", // Client RFQ ID\n \"s\": \"SOL_USDC_RFQ\", // Symbol\n \"S\": \"Bid\", // RFQ side\n \"Q\": \"150\", // RFQ quote quantity (optional) (if quantity in quote asset)\n \"p\": \"15.50\", // Taker price (quote price + fee)\n \"X\": \"Filled\", // RFQ status\n \"T\": 1730225497647080 // Engine timestamp in microseconds\n}\n\n// To quoter\n{\n \"e\": \"rfqFilled\", // Event type\n \"E\": 1730225497648996, // Event time in microseconds\n \"R\": 113392053149171712, // RFQ ID\n \"u\": 113392054083780608, // Quote ID\n \"C\": \"123\", // Client Quote ID\n \"s\": \"SOL_USDC_RFQ\", // Symbol\n \"p\": \"15.00\", // Price\n \"X\": \"Filled\", // Quote status\n \"T\": 1730225497647080 // Engine timestamp in microseconds\n}\n```\n\n### Field Descriptions\n\n- `e` - Event type (e.g., `rfqActive`, `rfqAccepted`, `rfqRefreshed`,\n`rfqCancelled`, `quoteAccepted`, `quoteCancelled`, `rfqCandidate`,\n`rfqFilled`).\n- `E` - Event time in microseconds.\n- `R` - RFQ ID, identifying the request for quote.\n- `u` - Quote ID, identifying the specific quote.\n- `C` - Client ID (either Client RFQ ID or Client Quote ID depending on\ncontext).\n- `s` - Symbol the RFQ is for.\n- `S` - Side of the RFQ, either \"Bid\" or \"Ask\".\n- `q` - Quantity for the RFQ (in base asset, if quantity in base asset).\n- `Q` - Quote quantity for the RFQ (in quote asset, if quantity in quote\nasset).\n- `p` - Price associated with the quote/fill event.\n- `w` - Submission time for the RFQ in milliseconds.\n- `W` - Expiry time for the RFQ in milliseconds.\n- `X` - Order status (e.g., `New`, `Cancelled`, `Filled`).\n- `T` - Engine timestamp in microseconds.\n\nSome fields are conditional and may be present only in specific events.\nRFQs are either requested in base quantity or quote quantity, but not both.\nEither `q` or `Q` will be present.\n\n# Public\n\n## Book ticker\n\nStream name format: `bookTicker.<symbol>`\n```\n{\n \"e\": \"bookTicker\", // Event type\n \"E\": 1694687965941000, // Event time in microseconds\n \"s\": \"SOL_USDC\", // Symbol\n \"a\": \"18.70\", // Inside ask price\n \"A\": \"1.000\", // Inside ask quantity\n \"b\": \"18.67\", // Inside bid price\n \"B\": \"2.000\", // Inside bid quantity\n \"u\": \"111063070525358080\", // Update ID of event\n \"T\": 1694687965940999 // Engine timestamp in microseconds\n}\n```\n\n## Depth\n\nContains incremental depth updates. Each depth update has the absolute\nvalue of the depths at the given levels, and only changes when the\ndepth has changed.\n\nTo obtain an initial snapshot of the depth, the client should query the\n[REST API](https://docs.backpack.exchange/#tag/Markets/operation/get_depth).\n\nThe depth stream will push updates as quickly as possible, but under\nload it may aggregate more than one update into a single event. In\nthis case the `U` and `u` fields will not be the same. The `U` field\nis the first update ID in the event, and the `u` field is the final\nupdate ID in the event.\n\nThere are alternative depth streams that aggregates updates into a\nsingle message over a 200ms, 600ms or 1000ms period instead of pushing\nupdates in realtime. This is useful for reducing network traffic.\n\nUpdates are sequential, so `U` will always be `u + 1` from the previous\nmessage. If this is not the case, the client should assume that the\ndepth has been invalidated and requery the REST API.\n\nStream name format: `depth.<symbol>` (realtime)\nStream name format: `depth.200ms.<symbol>` (aggregated)\nStream name format: `depth.600ms.<symbol>` (aggregated)\nStream name format: `depth.1000ms.<symbol>` (aggregated)\n```\n{\n \"e\": \"depth\", // Event type\n \"E\": 1694687965941000, // Event time in microseconds\n \"s\": \"SOL_USDC\", // Symbol\n \"a\": [ // Asks\n [\n \"18.70\",\n \"0.000\"\n ]\n ],\n \"b\": [ // Bids\n [\n \"18.67\",\n \"0.832\"\n ],\n [\n \"18.68\",\n \"0.000\"\n ]\n ],\n \"U\": 94978271, // First update ID in event\n \"u\": 94978271, // Last update ID in event\n \"T\": 1694687965940999 // Engine timestamp in microseconds\n}\n```\n\n## K-Line\n\nStream name format: `kline.<interval>.<symbol>`\n\n```\n{\n \"e\": \"kline\", // Event type\n \"E\": 1694687692980000, // Event time in microseconds\n \"s\": \"SOL_USD\", // Symbol\n \"t\": \"2024-09-11T12:00:00\", // K-Line start time (ISO 8601 format)\n \"T\": \"2024-09-11T12:01:00\", // K-Line close time (ISO 8601 format)\n \"o\": \"18.75\", // Open price\n \"c\": \"19.25\", // Close price\n \"h\": \"19.80\", // High price\n \"l\": \"18.50\", // Low price\n \"v\": \"32123\", // Base asset volume\n \"n\": 93828, // Number of trades\n \"X\": false // Is this k-line closed?\n}\n```\n\n## Liquidation\n\nContains updates for liquidation events for all liquidation types.\n\nStream name format: `liquidation`\n\n```\n{\n \"e\": \"liquidation\", // Event type\n \"E\": 1694688638091000, // Event time in microseconds\n \"q\": \"10\", // Quantity\n \"p\": \"18.70\", // Price\n \"S\": \"Bid\", // Side\n \"s\": \"SOL_USDC\", // Symbol\n \"T\": 567, // Engine timestamp in microseconds\n}\n```\n\n## Mark price\n\nStream name format: `markPrice.<symbol>`\n\n```\n{\n \"e\": \"markPrice\", // Event type\n \"E\": 1694687965941000, // Event time in microseconds\n \"s\": \"SOL_USDC\", // Symbol\n \"p\": \"18.70\", // Mark price\n \"f\": \"1.70\", // Estimated funding rate. Not included for prediction markets\n \"i\": \"19.70\", // Index price. Not included for prediction markets\n \"n\": 1694687965941, // Next funding timestamp in milliseconds. Not included for prediction markets\n \"T\": 1694687965940999 // Engine timestamp in microseconds\n}\n```\n\n## Ticker\n\nThe ticker stream pushes 24hr rolling statistics for a single symbol\nevery second.\n\nStream name format: `ticker.<symbol>`\n\n```\n{\n \"e\": \"ticker\", // Event type\n \"E\": 1694687692980000, // Event time in microseconds\n \"s\": \"SOL_USD\", // Symbol\n \"o\": \"18.75\", // First price\n \"c\": \"19.24\", // Last price\n \"h\": \"19.80\", // High price\n \"l\": \"18.50\", // Low price\n \"v\": \"32123\", // Base asset volume\n \"V\": \"928190\", // Quote asset volume\n \"n\": 93828 // Number of trades\n}\n```\n## Open interest\n\nOpen interest updates are pushed to the openInterest stream every 60\nseconds.\n\nStream name format: `openInterest.<symbol>`\n```\n{\n \"e\": \"openInterest\", // Event type\n \"E\": 1694687965941000, // Event time in microseconds\n \"s\": \"SOL_USDC_PERP\", // Symbol\n \"o\": \"100\", // Open interest in contracts\n}\n```\n\n## Trade\n\nContains public trade data for a single symbol. The trade ID is a\nsequential number specific to the symbol. This stream includes updates\nfor trades executed as a result of liquidations.\n\nStream name format: `trade.<symbol>`\n```\n{\n \"e\": \"trade\", // Event type\n \"E\": 1694688638091000, // Event time in microseconds\n \"s\": \"SOL_USDC\", // Symbol\n \"p\": \"18.68\", // Price\n \"q\": \"0.122\", // Quantity\n \"b\": \"111063114377265150\", // Buyer order ID\n \"a\": \"111063114585735170\", // Seller order ID\n \"t\": 12345, // Trade ID\n \"T\": 1694688638089000, // Engine timestamp in microseconds\n \"m\": true // Is the buyer the maker?\n}\n```"
},
{
"name": "Subaccount",
"description": "Subaccounts"
},
{
"name": "Sygna Bridge",
"description": "Sygna Bridge travel rule compliance webhooks and callbacks."
},
{
"name": "System",
"description": "Exchange system status."
},
{
"name": "Trades",
"description": "Public trade data."
},
{
"name": "User",
"description": "User operations."
},
{
"name": "Verify VASP",
"description": "Verify VASP account verification and search."
},
{
"name": "Wallet Links",
"description": "Wallet links."
},
{
"name": "WebAuthn",
"description": "WebAuthn."
},
{
"name": "Withdrawal Delays",
"description": "Withdrawal delay configuration for enhanced security."
}
],
"paths": {
"/api/v1/account": {
"get": {
"tags": [
"Account"
],
"summary": "Get account.",
"description": "**Instruction:** `accountQuery`",
"parameters": [
{
"name": "X-API-KEY",
"schema": {
"type": "string"
},
"in": "header",
"description": "API key",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "X-SIGNATURE",
"schema": {
"type": "string"
},
"in": "header",
"description": "Signature of the request",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "X-TIMESTAMP",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "header",
"description": "Timestamp of the request in milliseconds",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "X-WINDOW",
"schema": {
"type": "integer",
"format": "uint64"
},
"in": "header",
"description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)",
"required": false,
"deprecated": false,
"explode": true
}
],
"responses": {
"200": {
"description": "Success.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/AccountSummary"
}
}
}
},
"400": {
"description": "Bad request.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/ApiErrorResponse"
}
}
}
},
"500": {
"description": "Internal server error.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/ApiErrorResponse"
}
}
}
}
},
"operationId": "get_account"
},
"patch": {
"tags": [
"Account"
],
"summary": "Update account.",
"description": "Update account settings.\n\n**Instruction:** `accountUpdate`",
"parameters": [
{
"name": "X-API-KEY",
"schema": {
"type": "string"
},
"in": "header",
"description": "API key",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "X-SIGNATURE",
"schema": {
"type": "string"
},
"in": "header",
"description": "Signature of the request",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "X-TIMESTAMP",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "header",
"description": "Timestamp of the request in milliseconds",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "X-WINDOW",
"schema": {
"type": "integer",
"format": "uint64"
},
"in": "header",
"description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)",
"required": false,
"deprecated": false,
"explode": true
}
],
"requestBody": {
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/UpdateAccountSettingsRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Success."
},
"400": {
"description": "Bad request.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/ApiErrorResponse"
}
}
}
},
"401": {
"description": "Unauthorized.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/ApiErrorResponse"
}
}
}
},
"500": {
"description": "Internal server error.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/ApiErrorResponse"
}
}
}
},
"503": {
"description": "System under maintenance.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/ApiErrorResponse"
}
}
}
}
},
"operationId": "update_account_settings"
}
},
"/api/v1/account/convertDust": {
"post": {
"tags": [
"Capital"
],
"summary": "Convert a dust balance.",
"description": "Converts a dust balance to USDC. The balance (including lend) must be\nless than the minimum quantity tradable on the spot order book.\n\n**Instruction:** `convertDust`",
"parameters": [
{
"name": "X-API-KEY",
"schema": {
"type": "string"
},
"in": "header",
"description": "API key",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "X-SIGNATURE",
"schema": {
"type": "string"
},
"in": "header",
"description": "Signature of the request",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "X-TIMESTAMP",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "header",
"description": "Timestamp of the request in milliseconds",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "X-WINDOW",
"schema": {
"type": "integer",
"format": "uint64"
},
"in": "header",
"description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)",
"required": false,
"deprecated": false,
"explode": true
}
],
"requestBody": {
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/AccountConvertDustPayload"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Success."
},
"400": {
"description": "Bad request.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/ApiErrorResponse"
}
}
}
},
"500": {
"description": "Internal server error.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/ApiErrorResponse"
}
}
}
},
"503": {
"description": "System under maintenance.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/ApiErrorResponse"
}
}
}
}
},
"operationId": "convert_dust"
}
},
"/api/v1/account/limits/borrow": {
"get": {
"tags": [
"Account"
],
"summary": "Get max borrow quantity.",
"description": "Retrieves the maxmimum quantity an account can borrow\nfor a given asset based on the accounts existing exposure\nand margin requirements\n\n**Instruction:** `maxBorrowQuantity`",
"parameters": [
{
"name": "X-API-KEY",
"schema": {
"type": "string"
},
"in": "header",
"description": "API key",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-SIGNATURE",
"schema": {
"type": "string"
},
"in": "header",
"description": "Signature of the request",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-TIMESTAMP",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "header",
"description": "Timestamp of the request in milliseconds",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-WINDOW",
"schema": {
"type": "integer",
"format": "uint64"
},
"in": "header",
"description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "symbol",
"schema": {
"type": "string"
},
"in": "query",
"description": "The asset to borrow.",
"required": true,
"deprecated": false,
"explode": true
}
],
"responses": {
"200": {
"description": "Success.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/MaxBorrowQuantity"
}
}
}
},
"400": {
"description": "Bad request.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/ApiErrorResponse"
}
}
}
},
"500": {
"description": "Internal server error.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/ApiErrorResponse"
}
}
}
},
"503": {
"description": "Service unavailable.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/ApiErrorResponse"
}
}
}
}
},
"operationId": "get_max_borrow_quantity"
}
},
"/api/v1/account/limits/order": {
"get": {
"tags": [
"Account"
],
"summary": "Get max order quantity.",
"description": "Retrieves the maxmimum quantity an account can trade\nfor a given symbol based on the account's balances, existing exposure\nand margin requirements.\n\n**Instruction:** `maxOrderQuantity`",
"parameters": [
{
"name": "X-API-KEY",
"schema": {
"type": "string"
},
"in": "header",
"description": "API key",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-SIGNATURE",
"schema": {
"type": "string"
},
"in": "header",
"description": "Signature of the request",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-TIMESTAMP",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "header",
"description": "Timestamp of the request in milliseconds",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-WINDOW",
"schema": {
"type": "integer",
"format": "uint64"
},
"in": "header",
"description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "symbol",
"schema": {
"type": "string"
},
"in": "query",
"description": "The market symbol to trade.",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "side",
"schema": {
"$ref": "#/components/schemas/Side"
},
"in": "query",
"description": "The side of the order.",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "price",
"schema": {
"type": "string",
"format": "decimal"
},
"in": "query",
"description": "The limit price of the order. Not included for market orders.",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "reduceOnly",
"schema": {
"type": "boolean"
},
"in": "query",
"description": "Whether the order is reduce only.",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "autoBorrow",
"schema": {
"type": "boolean"
},
"in": "query",
"description": "Whether the order uses auto borrow.",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "autoBorrowRepay",
"schema": {
"type": "boolean"
},
"in": "query",
"description": "Whether the order uses auto borrow repay.",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "autoLendRedeem",
"schema": {
"type": "boolean"
},
"in": "query",
"description": "Whether the order uses auto lend redeem.",
"required": false,
"deprecated": false,
"explode": true
}
],
"responses": {
"200": {
"description": "Success.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/MaxOrderQuantity"
}
}
}
},
"400": {
"description": "Bad request.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/ApiErrorResponse"
}
}
}
},
"500": {
"description": "Internal server error.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/ApiErrorResponse"
}
}
}
}
},
"operationId": "get_max_order_quantity"
}
},
"/api/v1/account/limits/withdrawal": {
"get": {
"tags": [
"Account"
],
"summary": "Get max withdrawal quantity.",
"description": "Retrieves the maxmimum quantity an account can withdraw\nfor a given asset based on the accounts existing exposure\nand margin requirements\nThe response will include the maximum quantity that can be withdrawn\nand whether the withdrawal is with auto borrow or auto lend redeem\nenabled.\n\n**Instruction:** `maxWithdrawalQuantity`",
"parameters": [
{
"name": "X-API-KEY",
"schema": {
"type": "string"
},
"in": "header",
"description": "API key",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-SIGNATURE",
"schema": {
"type": "string"
},
"in": "header",
"description": "Signature of the request",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-TIMESTAMP",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "header",
"description": "Timestamp of the request in milliseconds",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-WINDOW",
"schema": {
"type": "integer",
"format": "uint64"
},
"in": "header",
"description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "symbol",
"schema": {
"type": "string"
},
"in": "query",
"description": "The asset to withdraw.",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "autoBorrow",
"schema": {
"type": "boolean"
},
"in": "query",
"description": "Whether the withdrawal is with auto borrow.",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "autoLendRedeem",
"schema": {
"type": "boolean"
},
"in": "query",
"description": "Whether the withdrawal is with auto lend redeem.",
"required": false,
"deprecated": false,
"explode": true
}
],
"responses": {
"200": {
"description": "Success.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/MaxWithdrawalQuantity"
}
}
}
},
"400": {
"description": "Bad request.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/ApiErrorResponse"
}
}
}
},
"500": {
"description": "Internal server error.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/ApiErrorResponse"
}
}
}
}
},
"operationId": "get_max_withdrawal_quantity"
}
},
"/api/v1/assets": {
"get": {
"tags": [
"Assets"
],
"summary": "Get assets.",
"description": "Get all supported assets.",
"responses": {
"200": {
"description": "Success.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MarketAsset"
}
}
}
}
},
"500": {
"description": "Internal server error.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/ApiErrorResponse"
}
}
}
}
},
"operationId": "get_assets"
}
},
"/api/v1/collateral": {
"get": {
"tags": [
"Assets"
],
"summary": "Get collateral.",
"description": "Get collateral parameters for assets.",
"responses": {
"200": {
"description": "Success.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CollateralSummary"
}
}
}
}
},
"500": {
"description": "Internal server error.",
"content": {