> ## Documentation Index
> Fetch the complete documentation index at: https://goldrush.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# clearinghouseState | Hyperliquid Info API

> Hyperliquid clearinghouseState: fetch a single user's perpetuals account state by wallet address.

<CardGroup cols={2}>
  <Card title="Credit Cost"> 1 per call</Card>
  <Card title="Processing"> Realtime</Card>
</CardGroup>

The Hyperliquid info endpoint with `type: "clearinghouseState"` is used to fetch a single user's perpetuals account state by wallet address.

<Tip>
  Estimate your monthly cost for this API using the [Pricing Calculator](/pricing-calculator?endpoint=%2Fapi-reference%2Fhyperliquid-info%2Fclearinghouse-state).
</Tip>

<Info>
  * Wire-equal to `POST api.hyperliquid.xyz/info` with `{"type": "clearinghouseState", "user": "..."}`.
  * For real-time push instead of polling, subscribe to <a href="https://goldrush.dev/docs/api-reference/streaming-api/subscriptions/wallet-activity-stream" target="_blank" rel="noopener noreferrer">`walletTxs`</a> with the same wallet address.
  * The optional `dex` field returns state on a HIP-3 deployer’s perp DEX. Pass `"*"` or `"ALL_DEXES"` to return state across the native dex and every HIP-3 dex in one call.
  * Wildcard (`"*"` / `"ALL_DEXES"`) requests are billed at a flat `10 credits` vs. `1 credit` for a single-dex call.
  * The `perpDexs` list used for wildcard fan-out is cached \~2 minutes, so a newly-deployed dex may take up to that long to appear in wildcard results.
</Info>

**Note:** Wildcard (`"*"` / `"ALL_DEXES"`) requests are **billed at a flat 10 credits per call.**

## Endpoint

```
POST https://hypercore.goldrushdata.com/info
Authorization: Bearer <GOLDRUSH_API_KEY>
Content-Type: application/json
```

## Request

<ParamField body="type" type="string" required default="clearinghouseState">
  Always `"clearinghouseState"`.
</ParamField>

<ParamField body="user" type="string" required>
  The wallet address (lowercase 0x-prefixed hex).
</ParamField>

<ParamField body="dex" type="string">
  HIP-3 builder DEX identifier. Empty string (default) returns canonical Hyperliquid perp state. Pass a builder code to query a HIP-3 deployer's perp DEX.
</ParamField>

### Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://hypercore.goldrushdata.com/info \
    -H "Authorization: Bearer $GOLDRUSH_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "type": "clearinghouseState",
      "user": "0xecb63caa47c7c4e77f60f1ce858cf28dc2b82b00",
      "dex": ""
    }'
  ```

  ```typescript TypeScript theme={null}
  const response = await fetch("https://hypercore.goldrushdata.com/info", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${process.env.GOLDRUSH_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      type: "clearinghouseState",
      user: "0xecb63caa47c7c4e77f60f1ce858cf28dc2b82b00",
      dex: "",
    }),
  });

  const state = await response.json();
  ```

  ```python Python theme={null}
  import os, requests

  response = requests.post(
      "https://hypercore.goldrushdata.com/info",
      headers={"Authorization": f"Bearer {os.environ['GOLDRUSH_API_KEY']}"},
      json={
          "type": "clearinghouseState",
          "user": "0xecb63caa47c7c4e77f60f1ce858cf28dc2b82b00",
          "dex": "",
      },
  )

  state = response.json()
  ```
</CodeGroup>

## Response

```json theme={null}
{
  "marginSummary": {
    "accountValue": "12450.83",
    "totalNtlPos": "8500.00",
    "totalRawUsd": "5200.50",
    "totalMarginUsed": "1700.00"
  },
  "crossMarginSummary": {
    "accountValue": "12450.83",
    "totalNtlPos": "8500.00",
    "totalRawUsd": "5200.50",
    "totalMarginUsed": "1700.00"
  },
  "crossMaintenanceMarginUsed": "850.00",
  "withdrawable": "10750.83",
  "assetPositions": [
    {
      "type": "oneWay",
      "position": {
        "coin": "ETH",
        "szi": "2.5",
        "leverage": { "type": "cross", "value": 5 },
        "entryPx": "3400.0",
        "positionValue": "8500.00",
        "unrealizedPnl": "120.50",
        "returnOnEquity": "0.07",
        "liquidationPx": "2800.5",
        "marginUsed": "1700.00",
        "maxLeverage": 50,
        "cumFunding": {
          "allTime": "12.30",
          "sinceOpen": "1.50",
          "sinceChange": "0.50"
        }
      }
    }
  ],
  "time": 1735689600000
}
```

### Field descriptions

<Note>
  All numeric fields below (account value, position size, prices, funding amounts, etc.) are returned as **decimal strings**, preserving upstream precision. Do not parse them as floats - keep them as strings or use a fixed-precision decimal type.
</Note>

<ResponseField name="marginSummary" type="object">
  Top-level account margin and value summary.

  <Expandable title="properties">
    <ResponseField name="accountValue" type="string">Total account value in USD.</ResponseField>
    <ResponseField name="totalNtlPos" type="string">Total notional position size.</ResponseField>
    <ResponseField name="totalRawUsd" type="string">Raw USDC balance excluding unrealized PnL.</ResponseField>
    <ResponseField name="totalMarginUsed" type="string">Margin currently committed to open positions.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="crossMarginSummary" type="object">
  Cross-margin subset of the margin summary. Same fields.
</ResponseField>

<ResponseField name="crossMaintenanceMarginUsed" type="string">
  Maintenance margin currently used for cross positions.
</ResponseField>

<ResponseField name="withdrawable" type="string">
  Amount currently withdrawable, in USD.
</ResponseField>

<ResponseField name="assetPositions" type="array<object>">
  Open positions, one entry per coin.

  <Expandable title="properties">
    <ResponseField name="type" type="string">Position type - `"oneWay"` for the standard mode.</ResponseField>

    <ResponseField name="position" type="object">
      <Expandable title="properties">
        <ResponseField name="coin" type="string">Asset symbol.</ResponseField>
        <ResponseField name="szi" type="string">Signed position size (positive = long, negative = short).</ResponseField>

        <ResponseField name="leverage" type="object">
          Two shapes:

          * Cross: `{ "type": "cross", "value": int }`
          * Isolated: `{ "type": "isolated", "value": int, "rawUsd": string }`

          `rawUsd` is **only present** for isolated leverage and may be negative.
        </ResponseField>

        <ResponseField name="entryPx" type="string">Volume-weighted entry price.</ResponseField>
        <ResponseField name="positionValue" type="string">Current notional value.</ResponseField>
        <ResponseField name="unrealizedPnl" type="string">Unrealized PnL in USD.</ResponseField>
        <ResponseField name="returnOnEquity" type="string">Unrealized return on margin used.</ResponseField>
        <ResponseField name="liquidationPx" type="string | null">Liquidation price. **May be literal JSON `null`** when no near-term liquidation applies (e.g. cross-margin with deep cushion).</ResponseField>
        <ResponseField name="marginUsed" type="string">Margin committed to this position.</ResponseField>
        <ResponseField name="maxLeverage" type="int">Maximum leverage for this asset.</ResponseField>
        <ResponseField name="cumFunding" type="object">Cumulative funding paid: `allTime`, `sinceOpen`, `sinceChange`.</ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="time" type="int">
  Snapshot timestamp in milliseconds since Unix epoch.
</ResponseField>

## Related endpoints

<CardGroup cols={2}>
  <Card title="batchClearinghouseState" href="/api-reference/hyperliquid-info/batch-clearinghouse-state">fetch perpetuals account state for up to 50 wallets in a single request.</Card>
  <Card title="batchSpotClearinghouseState" href="/api-reference/hyperliquid-info/batch-spot-clearinghouse-state">fetch spot account balances for up to 50 wallets in a single request.</Card>
  <Card title="spotClearinghouseState" href="/api-reference/hyperliquid-info/spot-clearinghouse-state">fetch a single user's spot account balances by wallet address.</Card>
</CardGroup>

*Last reviewed: 2026-07-07*
