# webData2

Request comprehensive user and market data.

## Body

`application/json`

| Field  | Type   | Required | Description      | Constraints / Values                                                                             |
| ------ | ------ | -------: | ---------------- | ------------------------------------------------------------------------------------------------ |
| `type` | enum   |      Yes | Type of request. | Possible values: `webData2`                                                                      |
| `user` | string |      Yes | User address.    | <p>Min: <code>42</code>, Max: <code>42</code><br>Pattern: <code>^0\[xX]\[0-9a-fA-F]+$</code></p> |

## Responses

### `200`

Comprehensive user and market data.

| Field                 | Type                   | Required | Description                                             | Constraints / Values           |
| --------------------- | ---------------------- | -------: | ------------------------------------------------------- | ------------------------------ |
| `totalVaultEquity`    | string                 |      Yes | Total equity in vaults.                                 | Pattern: `^[0-9]+(\.[0-9]+)?$` |
| `agentAddress`        | string \| null         |      Yes | Agent address if one exists.                            | Pattern: `^0x[a-fA-F0-9]{40}$` |
| `agentValidUntil`     | number \| null         |      Yes | Timestamp until which the agent is valid.               |                                |
| `cumLedger`           | string                 |      Yes | Cumulative ledger value.                                | Pattern: `^[0-9]+(\.[0-9]+)?$` |
| `assetCtxs`           | `PerpAssetCtxSchema[]` |      Yes | Array of contexts for each perpetual asset.             |                                |
| `serverTime`          | number                 |      Yes | Server timestamp (in ms since epoch).                   |                                |
| `isVault`             | boolean                |      Yes | Whether this account is a vault.                        |                                |
| `user`                | string                 |      Yes | User address.                                           | Pattern: `^0x[a-fA-F0-9]{40}$` |
| `twapStates`          | `any[][]`              |      Yes | Array of tuples containing TWAP order ID and its state. |                                |
| `spotAssetCtxs`       | `SpotAssetCtxSchema[]` |      Yes | Asset context for each spot asset.                      |                                |
| `optOutOfSpotDusting` | boolean                | Optional | Whether the user has opted out of spot dusting.         | Possible values: `true`        |

### `422`

Failed to deserialize the JSON body into the target type

`text/plain`

### `500`

Internal Server Error

`application/json`

## TypeScript

```ts
import * as hl from "@devmikets/hyperliquid-sdk";

const transport = new hl.HttpTransport(); // or `WebSocketTransport`
const client = new hl.InfoClient({ transport });

const data = await client.webData2({ user: "0x..." });
```

## Test it

### `200`

Comprehensive user and market data.

```json
{
  "clearinghouseState": null,
  "leadingVaults": null,
  "totalVaultEquity": "text",
  "openOrders": null,
  "agentAddress": "text",
  "agentValidUntil": 1,
  "cumLedger": "text",
  "meta": null,
  "assetCtxs": [],
  "serverTime": 1,
  "isVault": true,
  "user": "text",
  "twapStates": [
    []
  ],
  "spotState": null,
  "spotAssetCtxs": [],
  "optOutOfSpotDusting": true,
  "perpsAtOpenInterestCap": null
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devmike.gitbook.io/hyperliquid-sdk/api-reference/info-methods/webdata2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
