> For the complete documentation index, see [llms.txt](https://docs.hydromancer.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hydromancer.xyz/readme/rest-api/user-position-data/webdata2.md).

# webData2

{% hint style="info" %}
This is a composite endpoint returning clearinghouse state, open orders, metadata, asset contexts, and more.
{% endhint %}

## POST Request

<table><thead><tr><th width="161.9998779296875">Field</th><th width="119">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code></td><td>string</td><td>Must be <code>"webData2"</code></td></tr><tr><td><code>user</code></td><td>string</td><td>Ethereum address (0x-prefixed, 42 characters)</td></tr></tbody></table>

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST https://api.hydromancer.xyz/info \
  -H "Authorization: Bearer $HYDROMANCER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "webData2",
    "user": "0x0000000000000000000000000000000000000000"
  }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import os

response = requests.post(
    'https://api.hydromancer.xyz/info',
    json={
        'type': 'webData2',
        'user': '0x0000000000000000000000000000000000000000'
    },
    headers={
        'Authorization': f'Bearer {os.environ.get("HYDROMANCER_API_KEY")}',
        'Content-Type': 'application/json'
    }
)

print(response.json())
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
import axios from 'axios';

try {
    const response = await axios.post('https://api.hydromancer.xyz/info', {
        type: 'webData2',
        user: '0x0000000000000000000000000000000000000000'
    }, {
        headers: {
            'Authorization': `Bearer ${process.env.HYDROMANCER_API_KEY}`,
            'Content-Type': 'application/json'
        }
    });

    console.log(response.data);
} catch (error) {
    console.error('Error:', error.message);
}
```

{% endtab %}
{% endtabs %}

***

## Response Fields

| Field                                           | Type    | Description                                                                                            |
| ----------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------ |
| `clearinghouseState`                            | object  | User's clearinghouse state (margin summary, positions, etc.)                                           |
| `clearinghouseState.marginSummary`              | object  | Margin summary with `accountValue`, `totalNtlPos`, `totalRawUsd`, `totalMarginUsed`                    |
| `clearinghouseState.crossMarginSummary`         | object  | Cross margin summary (same fields as marginSummary)                                                    |
| `clearinghouseState.crossMaintenanceMarginUsed` | string  | Cross maintenance margin used                                                                          |
| `clearinghouseState.withdrawable`               | string  | Withdrawable amount                                                                                    |
| `clearinghouseState.assetPositions`             | array   | List of asset positions                                                                                |
| `clearinghouseState.time`                       | int     | Timestamp (ms)                                                                                         |
| `leadingVaults`                                 | array   | Leading vaults for the user                                                                            |
| `totalVaultEquity`                              | string  | Total vault equity                                                                                     |
| `openOrders`                                    | array   | Open orders                                                                                            |
| `agentAddress`                                  | string? | Agent address (null if none)                                                                           |
| `agentValidUntil`                               | int?    | Agent validity timestamp (null if none)                                                                |
| `cumLedger`                                     | string  | Cumulative ledger value                                                                                |
| `meta`                                          | object  | Metadata including universe and margin tables                                                          |
| `meta.universe`                                 | array   | List of perp assets with `szDecimals`, `name`, `maxLeverage`, `marginTableId`, `isDelisted` (optional) |
| `meta.marginTables`                             | array   | Margin table definitions with tiers                                                                    |
| `meta.collateralToken`                          | int     | Collateral token index                                                                                 |
| `assetCtxs`                                     | array   | Asset contexts                                                                                         |
| `serverTime`                                    | int     | Server timestamp (ms)                                                                                  |
| `isVault`                                       | boolean | Whether the user is a vault                                                                            |
| `user`                                          | string  | User address                                                                                           |
| `twapStates`                                    | array   | Active TWAP order states                                                                               |
| `perpsAtOpenInterestCap`                        | array   | List of perp symbols at open interest cap                                                              |

<details>

<summary>Response (truncated)</summary>

```json
{
    "clearinghouseState": {
        "marginSummary": {
            "accountValue": "0.0",
            "totalNtlPos": "0.0",
            "totalRawUsd": "0.0",
            "totalMarginUsed": "0.0"
        },
        "crossMarginSummary": {
            "accountValue": "0.0",
            "totalNtlPos": "0.0",
            "totalRawUsd": "0.0",
            "totalMarginUsed": "0.0"
        },
        "crossMaintenanceMarginUsed": "0.0",
        "withdrawable": "0.0",
        "assetPositions": [],
        "time": 1773660497365
    },
    "leadingVaults": [],
    "totalVaultEquity": "0.0",
    "openOrders": [],
    "agentAddress": null,
    "agentValidUntil": null,
    "cumLedger": "0.0",
    "meta": {
        "universe": [
            {
                "szDecimals": 5,
                "name": "BTC",
                "maxLeverage": 40,
                "marginTableId": 56
            }
        ],
        "marginTables": [
            [
                56,
                {
                    "description": "tiered 40x",
                    "marginTiers": [
                        {
                            "lowerBound": "0.0",
                            "maxLeverage": 40
                        },
                        {
                            "lowerBound": "150000000.0",
                            "maxLeverage": 20
                        }
                    ]
                }
            ]
        ],
        "collateralToken": 0
    },
    "assetCtxs": [],
    "serverTime": 1773660497365,
    "isVault": false,
    "user": "0x0000000000000000000000000000000000000000",
    "twapStates": [],
    "perpsAtOpenInterestCap": [
        "CANTO",
        "FTM",
        "JELLY"
    ]
}
```

</details>
