> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://okx-demo.ferndocs.com/api/api-reference/account/get-balance/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://okx-demo.ferndocs.com/_mcp/server. # Get balance GET https://www.okx.com/api/v5/account/balance Retrieve a list of assets (with non-zero balance), remaining balance, and available amount in the trading account. Reference: https://okx-demo.ferndocs.com/api/api-reference/account/get-balance ## Authentication - `OK-ACCESS-KEY` header (required) — Your API key. - `OK-ACCESS-SIGN` header (required) — Base64-encoded HMAC-SHA256 signature of the prehash string. - `OK-ACCESS-TIMESTAMP` header (required) — ISO 8601 UTC timestamp, e.g. 2020-12-08T09:08:57.715Z. - `OK-ACCESS-PASSPHRASE` header (required) — The passphrase you set when creating the API key. ## Request ### Query parameters - `ccy` (string, optional) — Single currency or multiple currencies (no more than 20) separated with comma, e.g. BTC or BTC,ETH. ## Response ### 200 Successful response - `code` (string, optional) — Result code. `0` means success; any other value is an error code. - `msg` (string, optional) — Error message. Empty on success. - `data` (list of ApiV5AccountBalanceGetResponsesContentApplicationJsonSchemaDataItems, optional) ## Types ### ApiV5AccountBalanceGetResponsesContentApplicationJsonSchemaDataItems - `uTime` (string, optional) — Update time of account information, Unix timestamp in milliseconds. - `totalEq` (string, optional) — The total amount of equity in USD. - `isoEq` (string, optional) — Isolated margin equity in USD. - `adjEq` (string, optional) — Adjusted / effective equity in USD (multi-currency margin and portfolio margin). - `ordFroz` (string, optional) — Cross margin frozen for pending orders in USD. - `imr` (string, optional) — Initial margin requirement in USD. - `mmr` (string, optional) — Maintenance margin requirement in USD. - `mgnRatio` (string, optional) — Margin ratio in USD. - `notionalUsd` (string, optional) — Notional value of positions in USD. - `upl` (string, optional) — Unrealized profit and loss in USD. - `details` (list of ApiV5AccountBalanceGetResponsesContentApplicationJsonSchemaDataItemsDetailsItems, optional) — Detailed asset information in all currencies. ### ApiV5AccountBalanceGetResponsesContentApplicationJsonSchemaDataItemsDetailsItems - `ccy` (string, optional) — Currency. - `eq` (string, optional) — Equity of the currency. - `cashBal` (string, optional) — Cash balance. - `availBal` (string, optional) — Available balance of the currency. - `availEq` (string, optional) — Available equity of the currency. - `frozenBal` (string, optional) — Frozen balance of the currency. - `ordFrozen` (string, optional) — Margin frozen for open orders. - `liab` (string, optional) — Liabilities of the currency. - `upl` (string, optional) — Unrealized profit and loss of the currency. - `interest` (string, optional) — Accrued interest of the currency. - `mgnRatio` (string, optional) — Margin ratio of the currency. - `eqUsd` (string, optional) — Equity of the currency in USD. - `disEq` (string, optional) — Discount equity of the currency in USD. - `uTime` (string, optional) — Update time, Unix timestamp in milliseconds. ## Examples **Response** ```json { "code": "0", "msg": "", "data": [ { "uTime": "1705474164160", "totalEq": "55837.43556134779", "isoEq": "0", "adjEq": "55415.624719833286", "ordFroz": "", "imr": "0", "mmr": "0", "mgnRatio": "", "notionalUsd": "0", "upl": "0", "details": [ { "ccy": "USDT", "eq": "4992.890093622894", "cashBal": "4850.435693622894", "availBal": "4834.317093622894", "availEq": "4834.3170936228935", "frozenBal": "158.573", "ordFrozen": "0", "liab": "0", "upl": "-7.545600000000006", "interest": "0", "mgnRatio": "", "eqUsd": "4991.542013297616", "disEq": "4991.542013297616", "uTime": "1705449605015", "accAvgPx": "", "autoLendMtAmt": "0", "autoLendStatus": "off", "borrowFroz": "0", "clSpotInUseAmt": "", "colBorrAutoConversion": "0", "colRes": "0", "collateralEnabled": false, "collateralRestrict": false, "crossLiab": "0", "fixedBal": "0", "frpType": "0", "imr": "", "isoEq": "0", "isoLiab": "0", "isoUpl": "0", "maxLoan": "0", "maxSpotInUse": "", "mmr": "", "notionalLever": "", "openAvgPx": "", "rewardBal": "0", "smtSyncEq": "0", "spotBal": "", "spotCopyTradingEq": "0", "spotInUseAmt": "", "spotIsoBal": "0", "spotUpl": "", "spotUplRatio": "", "stgyEq": "150", "totalPnl": "", "totalPnlRatio": "", "twap": "0", "uplLiab": "0" } ], "availEq": "55415.624719833286", "borrowFroz": "0", "delta": "0", "deltaLever": "0", "deltaNeutralStatus": "0", "notionalUsdForBorrow": "0", "notionalUsdForFutures": "0", "notionalUsdForOption": "0", "notionalUsdForSwap": "0" } ] } ``` **SDK Code** ```python account_getBalance_example import requests url = "https://www.okx.com/api/v5/account/balance" headers = {"OK-ACCESS-KEY": ""} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript account_getBalance_example const url = 'https://www.okx.com/api/v5/account/balance'; const options = {method: 'GET', headers: {'OK-ACCESS-KEY': ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go account_getBalance_example package main import ( "fmt" "net/http" "io" ) func main() { url := "https://www.okx.com/api/v5/account/balance" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("OK-ACCESS-KEY", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby account_getBalance_example require 'uri' require 'net/http' url = URI("https://www.okx.com/api/v5/account/balance") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["OK-ACCESS-KEY"] = '' response = http.request(request) puts response.read_body ``` ```java account_getBalance_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://www.okx.com/api/v5/account/balance") .header("OK-ACCESS-KEY", "") .asString(); ``` ```php account_getBalance_example request('GET', 'https://www.okx.com/api/v5/account/balance', [ 'headers' => [ 'OK-ACCESS-KEY' => '', ], ]); echo $response->getBody(); ``` ```csharp account_getBalance_example using RestSharp; var client = new RestClient("https://www.okx.com/api/v5/account/balance"); var request = new RestRequest(Method.GET); request.AddHeader("OK-ACCESS-KEY", ""); IRestResponse response = client.Execute(request); ``` ```swift account_getBalance_example import Foundation let headers = ["OK-ACCESS-KEY": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://www.okx.com/api/v5/account/balance")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```