# subAccounts2

## POST /info

> Request user sub-accounts.

```json
{"openapi":"3.1.1","info":{"title":"Hyperliquid API - info/subAccounts2","version":"1.0.0"},"tags":[{"name":"subAccounts2"}],"servers":[{"url":"https://api.hyperliquid.xyz","description":"Mainnet"},{"url":"https://api.hyperliquid-testnet.xyz","description":"Testnet"}],"paths":{"/info":{"post":{"tags":["subAccounts2"],"description":"Request user sub-accounts.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"description":"Type of request.","enum":["subAccounts2"]},"user":{"type":"string","pattern":"^0[xX][0-9a-fA-F]+$","minLength":42,"maxLength":42,"description":"User address."}},"required":["type","user"],"description":"Request user sub-accounts."}}},"required":true},"responses":{"200":{"description":"Array of user sub-account or null if the user does not have any sub-accounts.","content":{"application/json":{"schema":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"description":"Sub-account name."},"subAccountUser":{"type":"string","pattern":"^0[xX][0-9a-fA-F]+$","minLength":42,"maxLength":42,"description":"Sub-account address."},"master":{"type":"string","pattern":"^0[xX][0-9a-fA-F]+$","minLength":42,"maxLength":42,"description":"Master account address."},"dexToClearinghouseState":{"type":"array","items":{"type":"array","items":[{"type":"string"},{"type":"object","properties":{"marginSummary":{"type":"object","properties":{"accountValue":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Total account value."},"totalNtlPos":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Total notional position value."},"totalRawUsd":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Total raw USD value."},"totalMarginUsed":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Total margin used."}},"required":["accountValue","totalNtlPos","totalRawUsd","totalMarginUsed"],"description":"Margin summary details."},"crossMarginSummary":{"type":"object","properties":{"accountValue":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Total account value."},"totalNtlPos":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Total notional position value."},"totalRawUsd":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Total raw USD value."},"totalMarginUsed":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Total margin used."}},"required":["accountValue","totalNtlPos","totalRawUsd","totalMarginUsed"],"description":"Cross-margin summary details."},"crossMaintenanceMarginUsed":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Maintenance margin used for cross-margin positions."},"withdrawable":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Amount available for withdrawal."},"assetPositions":{"type":"array","items":{"type":"object","properties":{"type":{"description":"Position type.","enum":["oneWay"]},"position":{"type":"object","properties":{"coin":{"type":"string","description":"Asset symbol."},"szi":{"type":"string","pattern":"^-?[0-9]+(\\.[0-9]+)?$","description":"Signed position size."},"leverage":{"oneOf":[{"type":"object","properties":{"type":{"description":"Leverage type.","enum":["isolated"]},"value":{"type":"integer","minimum":1,"description":"Leverage value used."},"rawUsd":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Amount of USD used (1 = $1)."}},"required":["type","value","rawUsd"]},{"type":"object","properties":{"type":{"description":"Leverage type.","enum":["cross"]},"value":{"type":"integer","minimum":1,"description":"Leverage value used."}},"required":["type","value"]}],"description":"Leverage details."},"entryPx":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Average entry price."},"positionValue":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Position value."},"unrealizedPnl":{"type":"string","pattern":"^-?[0-9]+(\\.[0-9]+)?$","description":"Unrealized profit and loss."},"returnOnEquity":{"type":"string","pattern":"^-?[0-9]+(\\.[0-9]+)?$","description":"Return on equity."},"liquidationPx":{"anyOf":[{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","nullable":true}],"description":"Liquidation price."},"marginUsed":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Margin used."},"maxLeverage":{"type":"integer","minimum":1,"description":"Maximum allowed leverage."},"cumFunding":{"type":"object","properties":{"allTime":{"type":"string","pattern":"^-?[0-9]+(\\.[0-9]+)?$","description":"Total funding paid or received since account opening."},"sinceOpen":{"type":"string","pattern":"^-?[0-9]+(\\.[0-9]+)?$","description":"Funding accumulated since the position was opened."},"sinceChange":{"type":"string","pattern":"^-?[0-9]+(\\.[0-9]+)?$","description":"Funding accumulated since the last change in position size."}},"required":["allTime","sinceOpen","sinceChange"],"description":"Cumulative funding details."}},"required":["coin","szi","leverage","entryPx","positionValue","unrealizedPnl","returnOnEquity","liquidationPx","marginUsed","maxLeverage","cumFunding"],"description":"Position details."}},"required":["type","position"],"description":"Position for a specific asset."},"description":"Array of asset positions."},"time":{"type":"integer","minimum":0,"description":"Timestamp when data was retrieved (in ms since epoch)."}},"required":["marginSummary","crossMarginSummary","crossMaintenanceMarginUsed","withdrawable","assetPositions","time"],"description":"Account summary for perpetual trading."}],"minItems":2},"minItems":1,"description":"DEX to clearinghouse state mapping. Always includes the main DEX (empty dex name)."},"spotState":{"type":"object","properties":{"balances":{"type":"array","items":{"type":"object","properties":{"coin":{"type":"string","description":"Asset symbol."},"token":{"type":"integer","minimum":0,"description":"Unique identifier for the token."},"total":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Total balance."},"hold":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Amount on hold."},"entryNtl":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Entry notional value."}},"required":["coin","token","total","hold","entryNtl"],"description":"Balance for a specific spot token."},"description":"Balance for each token."},"evmEscrows":{"type":"array","items":{"type":"object","properties":{"coin":{"type":"string","description":"Asset symbol."},"token":{"type":"integer","minimum":0,"description":"Unique identifier for the token."},"total":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Total balance."}},"required":["coin","token","total"],"description":"Escrowed balance for a specific asset."},"description":"Escrowed balances."}},"required":["balances"],"description":"Account summary for spot trading."}},"required":["name","subAccountUser","master","dexToClearinghouseState","spotState"],"description":"Sub-account details for a user."},"nullable":true}],"description":"Array of user sub-account or null if the user does not have any sub-accounts."}}}},"422":{"description":"Failed to deserialize the JSON body into the target type","content":{"text/plain":{"schema":{"type":"string"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"null"}}}}}}}}}
```
