Typescript
Table of Contents
Base URLs
const BASE_URLS = {
TESTNET: "https://perps-tradeapi.kanalabs.io",
MAINNET: "https://perps-tradeapi.kana.trade"
};Authentication
All endpoints require an API key passed in the headers:
Core Concepts
Profile Address
All on-chain trades are executed using your profile address, not your wallet address. You must fetch your profile address first.
Endpoint: GET /getProfileAddress
Account Management
Get Wallet Balance
Endpoint: GET /getWalletAccountBalance
Get Profile Balance
Endpoint: GET /getProfileBalanceSnapshot
Get Net Profile Balance
This endpoint returns the net profile balance, which includes both the available balance in trading account and any pending balances from closed positions on all markets.
Endpoint: GET /getNetProfileBalance
Deposit Funds
Endpoint: GET /deposit
Withdraw Funds
Endpoint: GET /withdrawSpecifiMarket
Market Data
Get Market Info
Endpoint: GET /getMarketInfo
Get Market Price
Endpoint: GET /getMarketPrice
Get Last Execution Price
Endpoint: GET /getLastPlacedPrice
Get Perpetual Market Info
Retrieves information about perpetual market, optionally filtered by market ID or base name.
Endpoint: GET /getPerpetualAssetsInfo
Get All Markets
Retrieves information about all available markets.
Endpoint: GET /getPerpetualAssetsInfo/allMarkets
Order Management
Place Limit Order
Places a limit order on the exchange.
Endpoint: GET /placeLimitOrder
Place Market Order
Endpoint: GET /placeMarketOrder
Place Multiple Orders
Places multiple orders in a single transaction.
Endpoint: POST /placeMultipleOrders
Cancel Orders
Endpoint: POST /cancelMultipleOrders
Cancel And Place Multiple Orders
Endpoint: POST /cancelAndPlaceMultipleOrders
Position Management
Get Positions
Endpoint: GET /getPositions
Update Take Profit
Endpoint: GET /updateTakeProfit
Update Stop Loss
Endpoint: GET /updateStopLoss
Trade History
Get Open Orders
Endpoint: GET /getOpenOrders
Get All Open Order Ids
Endpoint: GET /getAllOpenOrderIds
Get Order Status By Order Id
Endpoint: GET /getOrderStatusByOrderId
Get Order History
Endpoint: GET /getOrderHistory
Get All Trades
Endpoint: GET /getAllTrades
Collapse Position
Endpoint: GET /collapsePosition
Add Margin
Endpoint: GET /addMargin
Settle Pnl
This API returns a transaction payload used to manually (or automatically, on user interactions) refresh the user's position and settle the Pnl for a specific market, allowing the user to claim any unreleased Pnl.
Endpoint: GET /settlePnl
Utility Endpoints
Get Account APT Balance
Endpoint: GET /getAccountAptBalance
Helper Types
Last updated