TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/tiagosiebler/gateio-api/llms.txt
Use this file to discover all available pages before exploring further.
gateio-api package ships with a comprehensive set of TypeScript type definitions that cover every request parameter, API response shape, and WebSocket message structure in the SDK. Using these types brings three concrete benefits: your IDE can autocomplete field names as you type, the TypeScript compiler rejects missing required fields or incorrectly typed values at build time, and future SDK upgrades that change an interface will surface breaking changes immediately rather than silently at runtime.
How Types Are Exported
All request types, response types, and WebSocket types are re-exported from the singlegateio-api entry point. You never need to import from a deep path like gateio-api/src/types/request/spot — just import from the package root:
index.ts re-exports every module so your imports stay clean and stable across SDK versions.
Type Categories
Request Types
Request Types
Request types describe the parameters accepted by each REST endpoint or WebSocket API call. They live in
Example: Example: Example:
src/types/request/ and are grouped by product area. Every module is re-exported from the package root.Available request modules:| Module | Product Area |
|---|---|
request/spot | Spot & margin trading |
request/futures | Perpetual futures |
request/delivery | Delivery futures |
request/options | Options contracts |
request/margin | Isolated margin |
request/marginuni | Unified margin |
request/wallet | Wallet & deposits/withdrawals |
request/withdrawal | Withdrawal management |
request/account | Account settings |
request/subaccount | Sub-account management |
request/earn | Earn / staking products |
request/earnuni | Unified earn |
request/autoinvest | Auto-invest plans |
request/flashswap | Flash swap |
request/collateralLoan | Collateral loans |
request/multicollateralLoan | Multi-collateral loans |
request/unified | Unified account |
request/rebate | Referral & rebate |
request/crossex | Cross-exchange settlement |
request/alpha | Alpha products |
request/otc | OTC trading |
request/p2pMerchant | P2P merchant |
request/tradfi | TradFi products |
SubmitSpotOrderReqGetSpotOrdersReqGetSpotOrderBookReqResponse Types
Response Types
Response types describe the shape of data returned by REST API calls. They live in
Example: Example:
src/types/response/ and mirror the request module organisation. Pass them as explicit type annotations or let TypeScript infer them from the client’s return types.Available response modules:| Module | Product Area |
|---|---|
response/spot | Spot markets, orders, balances |
response/futures | Perpetual futures |
response/delivery | Delivery futures |
response/options | Options contracts |
response/margin | Isolated margin |
response/marginuni | Unified margin |
response/wallet | Wallet & transfers |
response/account | Account info |
response/subaccount | Sub-account data |
response/earn | Earn products |
response/earnuni | Unified earn |
response/flashswap | Flash swap quotes & orders |
response/collateralloan | Collateral loan details |
response/multicollateralLoan | Multi-collateral loan details |
response/unified | Unified account balances |
response/rebate | Rebate records |
response/crossex | Cross-exchange data |
response/alpha | Alpha product responses |
response/otc | OTC responses |
response/p2pMerchant | P2P merchant data |
response/tradfi | TradFi responses |
SpotOrderSpotTickerWebSocket Client Types
WebSocket Client Types
These types control the Key fields:
WebsocketClient constructor and describe the shape of every real-time event you receive.WSClientConfigurableOptionsThe configuration interface accepted by the WebsocketClient constructor. All fields are optional.| Field | Type | Description |
|---|---|---|
apiKey | string | Gate.io API key for authenticated channels |
apiSecret | string | Gate.io API secret for signing |
useTestnet | boolean | Connect to testnet WebSocket URLs |
recvWindow | number | Signature validity window in ms |
pingInterval | number | How often to send heartbeat pings (ms) |
pongTimeout | number | How long to wait for a pong before reconnecting (ms) |
reconnectTimeout | number | Delay before attempting reconnection (ms) |
reauthWSAPIOnReconnect | boolean | Re-authenticate WS API automatically after reconnect |
customSignMessageFn | (msg, secret) => Promise<string> | Custom HMAC signing function |
WsKey and FuturesWsKeySee the WsKeys reference for the full listing of connection key types.WebSocket API Types
WebSocket API Types
The WS API types describe the request and response shapes for Gate.io’s real-time order management API. These let you place, amend, cancel, and query orders over WebSocket with full type coverage.Spot WS API request types
Futures WS API request types
WS API topic types
WSAPIResponse<T>Every WS API call resolves to a WSAPIResponse<T> where T is the specific result type. The generic wrapper carries metadata alongside the result:| Type | Topic | Description |
|---|---|---|
WSAPISpotOrderPlaceReq | spot.order_place | Place a new spot order |
WSAPISpotOrderCancelReq | spot.order_cancel | Cancel an order by ID |
WSAPISpotOrderCancelIdsReq | spot.order_cancel_ids | Cancel multiple orders by ID |
WSAPISpotOrderCancelCPReq | spot.order_cancel_cp | Cancel all orders for a currency pair |
WSAPISpotOrderAmendReq | spot.order_amend | Amend price/amount of an open order |
WSAPISpotOrderStatusReq | spot.order_status | Query a single order’s current state |
WSAPISpotOrderListReq | spot.order_list | List open or closed orders |
| Type | Topic | Description |
|---|---|---|
WSAPIFuturesOrderPlaceReq | futures.order_place | Place a new futures order |
WSAPIFuturesOrderCancelReq | futures.order_cancel | Cancel a futures order by ID |
WSAPIFuturesOrderCancelCPReq | futures.order_cancel_cp | Cancel all orders for a contract |
WSAPIFuturesOrderAmendReq | futures.order_amend | Amend a futures order |
WSAPIFuturesOrderListReq | futures.order_list | List futures orders |
WSAPIFuturesOrderStatusReq | futures.order_status | Query a futures order’s state |