# userFills

## Subscribe to userFills

> Subscription to user fill events for a specific user.

```json
{"openapi":"3.1.1","info":{"title":"Hyperliquid Subscription - userFills","version":"1.0.0"},"tags":[{"name":"userFills"}],"servers":[{"url":"wss://api.hyperliquid.xyz/ws","description":"Mainnet WebSocket"},{"url":"wss://api.hyperliquid-testnet.xyz/ws","description":"Testnet WebSocket"}],"paths":{"/":{"post":{"tags":["userFills"],"summary":"Subscribe to userFills","description":"Subscription to user fill events for a specific user.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"description":"Type of subscription.","enum":["userFills"]},"user":{"type":"string","pattern":"^0[xX][0-9a-fA-F]+$","minLength":42,"maxLength":42,"description":"User address."},"aggregateByTime":{"type":"boolean","description":"If true, partial fills are aggregated when a crossing order fills multiple resting orders."}},"required":["type","user"],"description":"Subscription to user fill events for a specific user."}}},"required":true},"responses":{"200":{"description":"Event of user trade fill.","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"string","pattern":"^0[xX][0-9a-fA-F]+$","minLength":42,"maxLength":42,"description":"User address."},"fills":{"type":"array","items":{"type":"object","properties":{"coin":{"type":"string","description":"Asset symbol."},"px":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Price."},"sz":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Size."},"side":{"enum":["B","A"],"description":"Order side (\"B\" = Bid/Buy, \"A\" = Ask/Sell)."},"time":{"type":"integer","minimum":0,"description":"Timestamp when the trade occurred (in ms since epoch)."},"startPosition":{"type":"string","pattern":"^-?[0-9]+(\\.[0-9]+)?$","description":"Start position size."},"dir":{"type":"string","description":"Direction indicator for frontend display."},"closedPnl":{"type":"string","pattern":"^-?[0-9]+(\\.[0-9]+)?$","description":"Realized PnL."},"hash":{"type":"string","pattern":"^0[xX][0-9a-fA-F]+$","minLength":66,"maxLength":66,"description":"L1 transaction hash."},"oid":{"type":"integer","minimum":0,"description":"Order ID."},"crossed":{"type":"boolean","description":"Indicates if the fill was a taker order."},"fee":{"type":"string","pattern":"^-?[0-9]+(\\.[0-9]+)?$","description":"Fee charged or rebate received (negative indicates rebate)."},"tid":{"type":"integer","minimum":0,"description":"Unique transaction identifier for a partial fill of an order."},"cloid":{"type":"string","pattern":"^0[xX][0-9a-fA-F]+$","minLength":34,"maxLength":34,"description":"Client Order ID."},"liquidation":{"type":"object","properties":{"liquidatedUser":{"type":"string","pattern":"^0[xX][0-9a-fA-F]+$","minLength":42,"maxLength":42,"description":"Address of the liquidated user."},"markPx":{"type":"string","pattern":"^[0-9]+(\\.[0-9]+)?$","description":"Mark price at the time of liquidation."},"method":{"enum":["market","backstop"],"description":"Liquidation method."}},"required":["liquidatedUser","markPx","method"],"description":"Liquidation details."},"feeToken":{"type":"string","description":"Token in which the fee is denominated (e.g., \"USDC\")."},"twapId":{"anyOf":[{"type":"integer","minimum":0,"nullable":true}],"description":"ID of the TWAP."}},"required":["coin","px","sz","side","time","startPosition","dir","closedPnl","hash","oid","crossed","fee","tid","feeToken","twapId"],"description":"Order fill record."},"description":"Array of user trade fills."},"isSnapshot":{"description":"Whether this is an initial snapshot.","enum":[true]}},"required":["user","fills"],"description":"Event of user trade fill."}}}}}}}}}
```
